changeset 2642:bb5a8da5d9e6

fix #439 logged in user cannot view item with non-ascii name
author RogerHaase <haaserd@gmail.com>
date Sun, 29 Jun 2014 09:10:01 -0700
parents ecf5a2e34ec7
children fee0bfbbed08
files MoinMoin/user.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/user.py	Sun Jun 29 09:08:23 2014 -0700
+++ b/MoinMoin/user.py	Sun Jun 29 09:10:01 2014 -0700
@@ -209,14 +209,14 @@
     :return: subscription string
     """
     if keyword == ITEMID:
-        subscription = "{0}:{1}".format(ITEMID, value)
+        subscription = u"{0}:{1}".format(ITEMID, value)
     elif keyword in [NAME, TAGS, NAMERE, NAMEPREFIX, ]:
         if namespace is not None:
-            subscription = "{0}:{1}:{2}".format(keyword, namespace, value)
+            subscription = u"{0}:{1}:{2}".format(keyword, namespace, value)
         else:
-            raise ValueError("The subscription by {0} keyword requires a namespace".format(keyword))
+            raise ValueError(u"The subscription by {0} keyword requires a namespace".format(keyword))
     else:
-        raise ValueError("Invalid keyword string: {0}".format(keyword))
+        raise ValueError(u"Invalid keyword string: {0}".format(keyword))
     return subscription
 
 
@@ -349,7 +349,7 @@
         name = getattr(self, NAME, [])
         itemid = getattr(self, ITEMID, None)
 
-        return "<{0}.{1} at {2:#x} name:{3!r} itemid:{4!r} valid:{5!r} trusted:{6!r}>".format(
+        return u"<{0}.{1} at {2:#x} name:{3!r} itemid:{4!r} valid:{5!r} trusted:{6!r}>".format(
             self.__class__.__module__, self.__class__.__name__, id(self),
             name, itemid, self.valid, self.trusted)
 
@@ -585,10 +585,10 @@
         subscriptions = set()
         itemid = meta.get(ITEMID)
         if itemid is not None:
-            subscriptions.update(["{0}:{1}".format(ITEMID, itemid)])
-        subscriptions.update("{0}:{1}:{2}".format(NAME, item_namespace, name)
+            subscriptions.update([u"{0}:{1}".format(ITEMID, itemid)])
+        subscriptions.update(u"{0}:{1}:{2}".format(NAME, item_namespace, name)
                              for name in meta.get(NAME, []))
-        subscriptions.update("{0}:{1}:{2}".format(TAGS, item_namespace, tag)
+        subscriptions.update(u"{0}:{1}:{2}".format(TAGS, item_namespace, tag)
                              for tag in meta.get(TAGS, []))
         if subscriptions & set(self.subscriptions):
             return True