| @@ -48,7 +48,7 @@ class Editcount(Command): | |||||
| self.reply(data, msg.format(name)) | self.reply(data, msg.format(name)) | ||||
| return | 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}" | url = "http://toolserver.org/~tparis/pcount/index.php?name={0}&lang={1}&wiki={2}" | ||||
| fullurl = url.format(safe, site.lang, site.project) | fullurl = url.format(safe, site.lang, site.project) | ||||
| msg = "\x0302{0}\x0301 has {1} edits ({2})." | msg = "\x0302{0}\x0301 has {1} edits ({2})." | ||||
| @@ -43,12 +43,12 @@ class Langcode(Command): | |||||
| for site in matrix.itervalues(): | for site in matrix.itervalues(): | ||||
| if site["code"] == code: | if site["code"] == code: | ||||
| name = site["name"] | |||||
| name = site["name"].encode("utf8") | |||||
| if name != site["localname"]: | 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"]]) | sites = ", ".join([s["url"] for s in site["site"]]) | ||||
| msg = "\x0302{0}\x0301 is {1} ({2})".format(code, name, sites) | msg = "\x0302{0}\x0301 is {1} ({2})".format(code, name, sites) | ||||
| self.reply(data, msg) | self.reply(data, msg) | ||||
| return | return | ||||
| self.reply(data, "site \x0302{0}\x0301 not found.".format(code)) | |||||
| self.reply(data, "language \x0302{0}\x0301 not found.".format(code)) | |||||
| @@ -42,7 +42,7 @@ class Trout(Command): | |||||
| target = " ".join(data.args) or data.nick | target = " ".join(data.args) or data.nick | ||||
| normal = normalize("NFKD", target.decode("utf8")).lower() | normal = normalize("NFKD", target.decode("utf8")).lower() | ||||
| if normal in self.exceptions: | if normal in self.exceptions: | ||||
| self.reply(data, self.exceptions["normal"]) | |||||
| self.reply(data, self.exceptions[normal]) | |||||
| else: | else: | ||||
| msg = "slaps {0} around a bit with a large {1}." | msg = "slaps {0} around a bit with a large {1}." | ||||
| self.action(data.chan, msg.format(target, animal)) | self.action(data.chan, msg.format(target, animal)) | ||||
| @@ -156,7 +156,7 @@ class IRCConnection(object): | |||||
| def ping(self, target): | def ping(self, target): | ||||
| """Ping another entity on the server.""" | """Ping another entity on the server.""" | ||||
| msg = "PING {0} {0}".format(target) | |||||
| msg = "PING {0}".format(target) | |||||
| self._send(msg) | self._send(msg) | ||||
| def pong(self, target): | def pong(self, target): | ||||
| @@ -149,7 +149,7 @@ class Page(CopyrightMixIn): | |||||
| contains "[") it will always be invalid, and cannot be edited. | contains "[") it will always be invalid, and cannot be edited. | ||||
| """ | """ | ||||
| if self._exists == self.PAGE_INVALID: | 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) | raise exceptions.InvalidPageError(e) | ||||
| def _assert_existence(self): | def _assert_existence(self): | ||||
| @@ -161,7 +161,7 @@ class Page(CopyrightMixIn): | |||||
| """ | """ | ||||
| self._assert_validity() | self._assert_validity() | ||||
| if self._exists == self.PAGE_MISSING: | 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) | raise exceptions.PageNotFoundError(e) | ||||
| def _load(self): | def _load(self): | ||||
| @@ -581,7 +581,7 @@ class Page(CopyrightMixIn): | |||||
| """ | """ | ||||
| if self._namespace < 0: | if self._namespace < 0: | ||||
| ns = self._site.namespace_id_to_name(self._namespace) | 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) | raise exceptions.InvalidPageError(e) | ||||
| if self._is_talkpage: | if self._is_talkpage: | ||||
| @@ -96,7 +96,7 @@ class User(object): | |||||
| if not hasattr(self, attr): | if not hasattr(self, attr): | ||||
| self._load_attributes() | self._load_attributes() | ||||
| if not self._exists: | 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) | raise UserNotFoundError(e) | ||||
| return getattr(self, attr) | return getattr(self, attr) | ||||