Commits

Miks Kalniņš committed 0616fb2

Fixed possible str.format(x) issues when x contains unicode. (Fixes #2)

  • Participants
  • Parent commits c19fa25

Comments (0)

Files changed (5)

File MoinMoin/storage/__init__.py

     """
     backend_name_uri = uri.split(':', 1)
     if len(backend_name_uri) != 2:
-        raise ValueError("malformed backend uri: {0}".format(uri))
+        raise ValueError(u"malformed backend uri: {0}".format(uri))
     backend_name, backend_uri = backend_name_uri
     module = __import__(BACKENDS_PACKAGE + '.' + backend_name, globals(), locals(), ['MutableBackend', ])
     return module.MutableBackend.from_uri(backend_uri, stores)

File MoinMoin/storage/backends/stores.py

     def from_uri(cls, uri, stores):
         store_name_uri = uri.split(':', 1)
         if len(store_name_uri) != 2:
-            raise ValueError("malformed store uri: {0}".format(uri))
+            raise ValueError(u"malformed store uri: {0}".format(uri))
         store_name, store_uri = store_name_uri
         for store in stores:
             if store.store_name == store_name:
                 break
         else:
-            raise ValueError("No store plugin matches name: {0}".format(store_name))
+            raise ValueError(u"No store plugin matches name: {0}".format(store_name))
         meta_store_uri = store_uri % dict(kind='meta')
         data_store_uri = store_uri % dict(kind='data')
         return cls(store.getByteStoreFromURI(meta_store_uri), store.getFileStoreFromURI(data_store_uri))

File MoinMoin/themes/__init__.py

 @contextfunction
 def global_theme_template(ctx, templatename, fallback=True):
     theme = ctx["_theme"]
-    templatepath = '_themes/{0}/{1}'.format(theme, templatename)
+    templatepath = u'_themes/{0}/{1}'.format(theme, templatename)
     if not fallback or template_exists(templatepath):
         return templatepath
     else:
     try:
         return app.themes[theme_name]
     except KeyError:
-        logging.warning("Theme {0!r} was not found; using default of {1!r} instead.".format(theme_name, app.cfg.theme_default))
+        logging.warning(u"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 app.themes[theme_name]
 
     context["_theme"] = theme
     # Try using current themes template.
     try:
-        output = flask_render_template("_themes/{0}/{1}".format(theme, template), **context)
+        output = flask_render_template(u"_themes/{0}/{1}".format(theme, template), **context)
     except TemplateNotFound:
         output = flask_render_template(template, **context)
     flaskg.clock.stop('render_template')

File contrib/ExamplePlugin/ExampleMoinPlugin/__init__.py

     def hello(self, name):
         if not name:
             name = self.default_name
-        return "Hello, {0}!".format(name)
+        return u"Hello, {0}!".format(name)

File wikiconfig.py

 
     # XXX we use rather relaxed ACLs for the development wiki:
     mappings = create_simple_mapping(
-        uri='stores:fs:{0}/%(nsname)s/%(kind)s'.format(data_dir),
+        uri=u'stores:fs:{0}/%(nsname)s/%(kind)s'.format(data_dir),
         content_acl=dict(before=u'',
                          default=u'All:read,write,create,destroy,admin',
                          after=u'',