changeset 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 caa408751799
children ac21bb448ba8 bda9795afce6
files MoinMoin/apps/admin/views.py MoinMoin/auth/smb_mount.py MoinMoin/converter/archive_in.py MoinMoin/converter/everything.py MoinMoin/datastruct/backends/__init__.py MoinMoin/script/account/disable.py MoinMoin/script/account/resetpw.py MoinMoin/signalling/log.py MoinMoin/themes/__init__.py MoinMoin/util/interwiki.py
diffstat 10 files changed, 22 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/admin/views.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/apps/admin/views.py	Sat Jul 07 20:22:21 2012 +0200
@@ -77,9 +77,9 @@
         if ok:
             setattr(u, key, val)
             u.save()
-            flash('{0}.{1}: {2} -> {3}'.format(user_name, key, unicode(oldval), unicode(val), ), "info")
+            flash(u'{0}.{1}: {2} -> {3}'.format(user_name, key, unicode(oldval), unicode(val), ), "info")
         else:
-            flash('modifying {0}.{1} failed'.format(user_name, key, ), "error")
+            flash(u'modifying {0}.{1} failed'.format(user_name, key, ), "error")
     return redirect(url_for('.userbrowser'))
 
 
--- a/MoinMoin/auth/smb_mount.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/auth/smb_mount.py	Sat Jul 07 20:22:21 2012 +0200
@@ -49,7 +49,7 @@
         self.coding = coding
 
     def do_smb(self, username, password, login):
-        logging.debug("login={0} logout={1}: got name={2}".format(login, not login, username))
+        logging.debug("login={0} logout={1}: got name={2!r}".format(login, not login, username))
 
         import os, pwd, subprocess
         web_username = self.dir_user
--- a/MoinMoin/converter/archive_in.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/converter/archive_in.py	Sat Jul 07 20:22:21 2012 +0200
@@ -38,7 +38,7 @@
 
     def process_name(self, member_name):
         attrib = {
-            xlink.href: Iri(scheme='wiki', authority='', path='/'+self.item_name, query='do=get&member={0}'.format(member_name)),
+            xlink.href: Iri(scheme='wiki', authority='', path='/'+self.item_name, query=u'do=get&member={0}'.format(member_name)),
         }
         return moin_page.a(attrib=attrib, children=[member_name, ])
 
--- a/MoinMoin/converter/everything.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/converter/everything.py	Sat Jul 07 20:22:21 2012 +0200
@@ -27,7 +27,7 @@
         attrib = {
             xlink.href: Iri(scheme='wiki', authority='', path='/'+item_name, query='do=get&rev={0}'.format(rev.revid)),
         }
-        return moin_page.a(attrib=attrib, children=["Download {0}.".format(item_name)])
+        return moin_page.a(attrib=attrib, children=[u"Download {0}.".format(item_name)])
 
 
 from . import default_registry
--- a/MoinMoin/datastruct/backends/__init__.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/datastruct/backends/__init__.py	Sat Jul 07 20:22:21 2012 +0200
@@ -80,7 +80,7 @@
         raise NotImplementedError()
 
     def __repr__(self):
-        return "<{0} groups={1}>".format(self.__class__, list(self))
+        return "<{0!r} groups={1!r}>".format(self.__class__, list(self))
 
     def _retrieve_members(self, group_name):
         raise NotImplementedError()
@@ -250,7 +250,7 @@
                     yield group_name
 
     def __repr__(self):
-        return "<{0} name={1} members={2} member_groups={3}>".format(self.__class__, self.name, self.members, self.member_groups)
+        return "<{0!r} name={1!r} members={2!r} member_groups={3!r}>".format(self.__class__, self.name, self.members, self.member_groups)
 
 
 class BaseDict(object, DictMixin):
--- a/MoinMoin/script/account/disable.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/script/account/disable.py	Sat Jul 07 20:22:21 2012 +0200
@@ -37,15 +37,15 @@
             u = user.User(auth_username=name)
 
         if not u.exists():
-            print 'This user "{0}" does not exists!'.format(u.name)
+            print 'This user "{0!r}" does not exists!'.format(u.name)
             return
 
-        print " {0:<20} {1:<25} {2:<35}".format(u.id, u.name, u.email),
+        print " {0:<20} {1:!r<25} {2:<35}".format(u.id, u.name, u.email),
         if not u.disabled: # only disable once
             u.disabled = 1
-            u.name = "{0}-{1}".format(u.name, u.id)
+            u.name = u"{0}-{1}".format(u.name, u.id)
             if u.email:
-                u.email = "{0}-{1}".format(u.email, u.id)
+                u.email = u"{0}-{1}".format(u.email, u.id)
             u.subscribed_items = [] # avoid using email
             u.save()
             print "- disabled."
--- a/MoinMoin/script/account/resetpw.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/script/account/resetpw.py	Sat Jul 07 20:22:21 2012 +0200
@@ -41,7 +41,7 @@
             u = user.User(auth_username=name)
 
         if not u.exists():
-            print 'This user "{0}" does not exists!'.format(u.name)
+            print 'This user "{0!r}" does not exists!'.format(u.name)
             return
 
         u.enc_password = crypto.crypt_password(password)
--- a/MoinMoin/signalling/log.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/signalling/log.py	Sat Jul 07 20:22:21 2012 +0200
@@ -15,9 +15,9 @@
 @item_displayed.connect_via(ANY)
 def log_item_displayed(app, item_name):
     wiki_name = app.cfg.interwikiname
-    logging.info("item {0}:{1} displayed".format(wiki_name, item_name))
+    logging.info(u"item {0}:{1} displayed".format(wiki_name, item_name))
 
 @item_modified.connect_via(ANY)
 def log_item_modified(app, item_name):
     wiki_name = app.cfg.interwikiname
-    logging.info("item {0}:{1} modified".format(wiki_name, item_name))
+    logging.info(u"item {0}:{1} modified".format(wiki_name, item_name))
--- 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:
--- a/MoinMoin/util/interwiki.py	Sat Jul 07 20:19:20 2012 +0200
+++ b/MoinMoin/util/interwiki.py	Sat Jul 07 20:22:21 2012 +0200
@@ -132,7 +132,7 @@
     :rtype: unicode
     :returns: wiki_name:item_name
     """
-    return "{0}:{1}".format(app.cfg.interwikiname, item_name)
+    return u"{0}:{1}".format(app.cfg.interwikiname, item_name)
 
 
 def getInterwikiHome(username):