mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Guard feedparser import and warn the user if it's not available
This commit is contained in:
parent
e938c4d31b
commit
9cc917bd36
@ -1,5 +1,6 @@
|
|||||||
###
|
###
|
||||||
# Copyright (c) 2002-2004, Jeremiah Fincher
|
# Copyright (c) 2002-2004, Jeremiah Fincher
|
||||||
|
# Copyright (c) 2008, James Vega
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -33,8 +34,6 @@ import socket
|
|||||||
import sgmllib
|
import sgmllib
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import feedparser
|
|
||||||
|
|
||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
import supybot.utils as utils
|
import supybot.utils as utils
|
||||||
import supybot.world as world
|
import supybot.world as world
|
||||||
@ -43,6 +42,13 @@ import supybot.ircutils as ircutils
|
|||||||
import supybot.registry as registry
|
import supybot.registry as registry
|
||||||
import supybot.callbacks as callbacks
|
import supybot.callbacks as callbacks
|
||||||
|
|
||||||
|
try:
|
||||||
|
import feedparser
|
||||||
|
except ImportError:
|
||||||
|
raise callbacks.Error, \
|
||||||
|
'You need to have feedparser installed to use this plugin. ' \
|
||||||
|
'Download it at <http://feedparser.org/>'
|
||||||
|
|
||||||
def getFeedName(irc, msg, args, state):
|
def getFeedName(irc, msg, args, state):
|
||||||
if not registry.isValidRegistryName(args[0]):
|
if not registry.isValidRegistryName(args[0]):
|
||||||
state.errorInvalid('feed name', args[0],
|
state.errorInvalid('feed name', args[0],
|
||||||
|
Loading…
Reference in New Issue
Block a user