Bladeren bron

Some more fixes, mainly unicode-related.

tags/v0.1^2
Ben Kurtovic 12 jaren geleden
bovenliggende
commit
1adf8b26cd
6 gewijzigde bestanden met toevoegingen van 10 en 10 verwijderingen
  1. +1
    -1
      earwigbot/commands/editcount.py
  2. +3
    -3
      earwigbot/commands/langcode.py
  3. +1
    -1
      earwigbot/commands/trout.py
  4. +1
    -1
      earwigbot/irc/connection.py
  5. +3
    -3
      earwigbot/wiki/page.py
  6. +1
    -1
      earwigbot/wiki/user.py

+ 1
- 1
earwigbot/commands/editcount.py Bestand weergeven

@@ -48,7 +48,7 @@ class Editcount(Command):
self.reply(data, msg.format(name))
return

safe = quote_plus(user.name)
safe = quote_plus(user.name.encode("utf8"))
url = "http://toolserver.org/~tparis/pcount/index.php?name={0}&lang={1}&wiki={2}"
fullurl = url.format(safe, site.lang, site.project)
msg = "\x0302{0}\x0301 has {1} edits ({2})."


+ 3
- 3
earwigbot/commands/langcode.py Bestand weergeven

@@ -43,12 +43,12 @@ class Langcode(Command):

for site in matrix.itervalues():
if site["code"] == code:
name = site["name"]
name = site["name"].encode("utf8")
if name != site["localname"]:
name += " ({0})".format(site["localname"])
name += " ({0})".format(site["localname"].encode("utf8"))
sites = ", ".join([s["url"] for s in site["site"]])
msg = "\x0302{0}\x0301 is {1} ({2})".format(code, name, sites)
self.reply(data, msg)
return

self.reply(data, "site \x0302{0}\x0301 not found.".format(code))
self.reply(data, "language \x0302{0}\x0301 not found.".format(code))

+ 1
- 1
earwigbot/commands/trout.py Bestand weergeven

@@ -42,7 +42,7 @@ class Trout(Command):
target = " ".join(data.args) or data.nick
normal = normalize("NFKD", target.decode("utf8")).lower()
if normal in self.exceptions:
self.reply(data, self.exceptions["normal"])
self.reply(data, self.exceptions[normal])
else:
msg = "slaps {0} around a bit with a large {1}."
self.action(data.chan, msg.format(target, animal))

+ 1
- 1
earwigbot/irc/connection.py Bestand weergeven

@@ -156,7 +156,7 @@ class IRCConnection(object):

def ping(self, target):
"""Ping another entity on the server."""
msg = "PING {0} {0}".format(target)
msg = "PING {0}".format(target)
self._send(msg)

def pong(self, target):


+ 3
- 3
earwigbot/wiki/page.py Bestand weergeven

@@ -149,7 +149,7 @@ class Page(CopyrightMixIn):
contains "[") it will always be invalid, and cannot be edited.
"""
if self._exists == self.PAGE_INVALID:
e = "Page '{0}' is invalid.".format(self._title)
e = u"Page '{0}' is invalid.".format(self._title)
raise exceptions.InvalidPageError(e)

def _assert_existence(self):
@@ -161,7 +161,7 @@ class Page(CopyrightMixIn):
"""
self._assert_validity()
if self._exists == self.PAGE_MISSING:
e = "Page '{0}' does not exist.".format(self._title)
e = u"Page '{0}' does not exist.".format(self._title)
raise exceptions.PageNotFoundError(e)

def _load(self):
@@ -581,7 +581,7 @@ class Page(CopyrightMixIn):
"""
if self._namespace < 0:
ns = self._site.namespace_id_to_name(self._namespace)
e = "Pages in the {0} namespace can't have talk pages.".format(ns)
e = u"Pages in the {0} namespace can't have talk pages.".format(ns)
raise exceptions.InvalidPageError(e)

if self._is_talkpage:


+ 1
- 1
earwigbot/wiki/user.py Bestand weergeven

@@ -96,7 +96,7 @@ class User(object):
if not hasattr(self, attr):
self._load_attributes()
if not self._exists:
e = "User '{0}' does not exist.".format(self._name)
e = u"User '{0}' does not exist.".format(self._name)
raise UserNotFoundError(e)
return getattr(self, attr)



Laden…
Annuleren
Opslaan