Skip to content
This repository was archived by the owner on Jun 18, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Currency/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@
# contributions.
__contributors__ = {}

import config
import plugin
from . import config
from . import plugin
from imp import reload
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!

if world.testing:
import test
from . import test

Class = plugin.Class
configure = config.configure
Expand Down
5 changes: 2 additions & 3 deletions Currency/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# POSSIBILITY OF SUCH DAMAGE.
###

import plugin
from . import plugin

import supybot.conf as conf
import supybot.utils as utils
Expand All @@ -45,8 +45,7 @@ class CurrencyCommand(registry.String):
def setValue(self, s):
m = plugin.Currency.currencyCommands
if s not in m:
raise registry.InvalidRegistryValue,\
format('Command must be one of %L.', m)
raise registry.InvalidRegistryValue(format('Command must be one of %L.', m))
registry.String.setValue(self, s)

Currency = conf.registerPlugin('Currency')
Expand Down
8 changes: 4 additions & 4 deletions Currency/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def xe(self, irc, msg, args, number, curr1, curr2):
irc.error(self._symbolError, Raise=True)
url = 'http://www.xe.com/ucc/convert.cgi?Amount=%s&From=%s&To=%s'
try:
text = utils.web.getUrl(url % (number, curr1, curr2))
except utils.web.Error, e:
text = utils.web.getUrl(url % (number, curr1, curr2)).decode()
except utils.web.Error as e:
irc.error(str(e), Raise=True)
err = self._xeCurrError.search(text)
if err is not None:
Expand Down Expand Up @@ -98,8 +98,8 @@ def yahoo(self, irc, msg, args, number, curr1, curr2):
url = r'http://finance.yahoo.com/d/quotes.csv?'\
r's=%s%s=X&f=sl1d1t1ba&e=.csv' % (curr1, curr2)
try:
text = utils.web.getUrl(url)
except utils.web.Error, e:
text = utils.web.getUrl(url).decode()
except utils.web.Error as e:
irc.error(str(e), Raise=True)
if 'N/A' in text:
irc.error('You used an incorrect currency symbol.', Raise=True)
Expand Down