diff MoinMoin/themes/__init__.py @ 1414:614005b5edb3

fixed some .format() unicode issues, partially fixing bug #124
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 07 Jul 2012 20:22:21 +0200
parents 4ac437141bbe
children d697fd14e772
line wrap: on
line diff
--- a/MoinMoin/themes/__init__.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/themes/__init__.py	Sat Jul 07 20:22:21 2012 +0200
@@ -40,7 +40,7 @@
     try:
         return get_theme(theme_name)
     except KeyError:
-        logging.warning("Theme {0} was not found; using default of {1} instead.".format(theme_name, app.cfg.theme_default))
+        logging.warning("Theme {0!r} was not found; using default of {1!r} instead.".format(theme_name, app.cfg.theme_default))
         theme_name = app.cfg.theme_default
         return get_theme(theme_name)
 
@@ -144,7 +144,7 @@
             aliasname = name
 
         wikiname, itemname = getInterwikiHome(name)
-        title = "{0} @ {1}".format(aliasname, wikiname)
+        title = u"{0} @ {1}".format(aliasname, wikiname)
         # link to (interwiki) user homepage
         if is_local_wiki(wikiname):
             exists = self.storage.has_item(itemname)
@@ -245,10 +245,10 @@
                                 pass # ignore invalid lines
                         f.close()
                         app.cache.set(cid, sisteritems)
-                        logging.info("Site: {0} Status: Updated. Pages: {1}".format(sistername, len(sisteritems)))
+                        logging.info("Site: {0!r} Status: Updated. Pages: {1}".format(sistername, len(sisteritems)))
                     except IOError as err:
                         (title, code, msg, headers) = err.args # code e.g. 304
-                        logging.warning("Site: {0} Status: Not updated.".format(sistername))
+                        logging.warning("Site: {0!r} Status: Not updated.".format(sistername))
                         logging.exception("exception was:")
                 if current in sisteritems:
                     url = sisteritems[current]
@@ -299,11 +299,11 @@
         # only tell ip / hostname if show_hosts is True
         if hostname:
             text = hostname[:15]  # 15 = len(ipaddr)
-            name = title = '{0}[{1}]'.format(hostname, addr)
+            name = title = u'{0}[{1}]'.format(hostname, addr)
             css = 'editor host'
         else:
             name = text = addr
-            title = '[{0}]'.format(addr)
+            title = u'[{0}]'.format(addr)
             css = 'editor ip'
 
     userid = meta.get(USERID)
@@ -316,7 +316,7 @@
             aliasname = name
         if title:
             # we already have some address info
-            title = "{0} @ {1}".format(aliasname, title)
+            title = u"{0} @ {1}".format(aliasname, title)
         else:
             title = aliasname
         if u.mailto_author and u.email: