Commits

Thomas Waldmann committed 614005b

fixed some .format() unicode issues, partially fixing bug #124

  • Participants
  • Parent commits caa4087

Comments (0)

Files changed (10)

File MoinMoin/apps/admin/views.py

         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'))
 
 

File MoinMoin/auth/smb_mount.py

         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

File MoinMoin/converter/archive_in.py

 
     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, ])
 

File MoinMoin/converter/everything.py

         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

File MoinMoin/datastruct/backends/__init__.py

         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()
                     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):

File MoinMoin/script/account/disable.py

             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."

File MoinMoin/script/account/resetpw.py

             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)

File MoinMoin/signalling/log.py

 @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))

File MoinMoin/themes/__init__.py

     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)
 
             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)
                                 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]
         # 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)
             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:

File MoinMoin/util/interwiki.py

     :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):