Browse Source

More bugfixes and cleanup.

tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
e8b078d4d0
4 changed files with 9 additions and 8 deletions
  1. +1
    -1
      earwigbot/commands/afc_report.py
  2. +4
    -4
      earwigbot/commands/crypt.py
  3. +1
    -1
      earwigbot/commands/help.py
  4. +3
    -2
      earwigbot/wiki/site.py

+ 1
- 1
earwigbot/commands/afc_report.py View File

@@ -79,7 +79,7 @@ class AFCReport(Command):
url = page.url.replace("en.wikipedia.org/wiki", "enwp.org") url = page.url.replace("en.wikipedia.org/wiki", "enwp.org")
short = self.statistics.get_short_title(page.title) short = self.statistics.get_short_title(page.title)
status = self.get_status(page) status = self.get_status(page)
user = self.site.get_user(page.creator())
user = self.site.get_user(page.get_creator())
user_name = user.name user_name = user.name
user_url = user.get_talkpage().url user_url = user.get_talkpage().url




+ 4
- 4
earwigbot/commands/crypt.py View File

@@ -30,7 +30,7 @@ __all__ = ["Crypt"]


class Crypt(Command): class Crypt(Command):
"""Provides hash functions with !hash (!hash list for supported algorithms) """Provides hash functions with !hash (!hash list for supported algorithms)
and blowfish encryption with !encrypt and !decrypt."""
and Blowfish encryption with !encrypt and !decrypt."""
name = "crypt" name = "crypt"
commands = ["crypt", "hash", "encrypt", "decrypt"] commands = ["crypt", "hash", "encrypt", "decrypt"]


@@ -68,11 +68,11 @@ class Crypt(Command):
self.reply(data, msg.format(data.command)) self.reply(data, msg.format(data.command))
return return


cipher = Blowfish.new(hashlib.sha256(key))
cipher = Blowfish.new(hashlib.sha256(key).digest())
try: try:
if data.command == "encrypt": if data.command == "encrypt":
self.reply(data, cipher.encrypt(text))
self.reply(data, cipher.encrypt(text).encode("hex"))
else: else:
self.reply(data, cipher.decrypt(text))
self.reply(data, cipher.decrypt(text.decode("hex")))
except ValueError as error: except ValueError as error:
self.reply(data, error.message) self.reply(data, error.message)

+ 1
- 1
earwigbot/commands/help.py View File

@@ -62,7 +62,7 @@ class Help(Command):
if command.__doc__: if command.__doc__:
doc = command.__doc__.replace("\n", "") doc = command.__doc__.replace("\n", "")
doc = re.sub("\s\s+", " ", doc) doc = re.sub("\s\s+", " ", doc)
msg = "help for command \x0303{0}\x0301: \"{1}\""
msg = 'help for command \x0303{0}\x0301: "{1}"'
self.reply(data, msg.format(target, doc)) self.reply(data, msg.format(target, doc))
return return




+ 3
- 2
earwigbot/wiki/site.py View File

@@ -734,7 +734,8 @@ class Site(object):
:py:class:`~earwigbot.wiki.user.User` object representing the currently :py:class:`~earwigbot.wiki.user.User` object representing the currently
logged-in (or anonymous!) user is returned. logged-in (or anonymous!) user is returned.
""" """
username = self._unicodeify(username)
if not username:
if username:
username = self._unicodeify(username)
else:
username = self._get_username() username = self._get_username()
return User(self, username) return User(self, username)

Loading…
Cancel
Save