Quellcode durchsuchen

More bugfixes and cleanup.

tags/v0.1^2
Ben Kurtovic vor 12 Jahren
Ursprung
Commit
e8b078d4d0
4 geänderte Dateien mit 9 neuen und 8 gelöschten Zeilen
  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 Datei anzeigen

@@ -79,7 +79,7 @@ class AFCReport(Command):
url = page.url.replace("en.wikipedia.org/wiki", "enwp.org")
short = self.statistics.get_short_title(page.title)
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_url = user.get_talkpage().url



+ 4
- 4
earwigbot/commands/crypt.py Datei anzeigen

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

class Crypt(Command):
"""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"
commands = ["crypt", "hash", "encrypt", "decrypt"]

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

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

+ 1
- 1
earwigbot/commands/help.py Datei anzeigen

@@ -62,7 +62,7 @@ class Help(Command):
if command.__doc__:
doc = command.__doc__.replace("\n", "")
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))
return



+ 3
- 2
earwigbot/wiki/site.py Datei anzeigen

@@ -734,7 +734,8 @@ class Site(object):
:py:class:`~earwigbot.wiki.user.User` object representing the currently
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()
return User(self, username)

Laden…
Abbrechen
Speichern