Commits

Bruno Martin  committed 73d9dbe Merge

merge

  • Participants
  • Parent commits 89c1de1, 52d669c
  • Branches namespaces

Comments (0)

Files changed (3)

File MoinMoin/storage/middleware/_tests/test_serialization.py

 
 
 contents = [
-    (u'Foo', {'name': u'Foo', 'contenttype': u'text/plain'}, ''),
-    (u'Foo', {'name': u'Foo', 'contenttype': u'text/plain'}, '2nd'),
-    (u'Subdir', {'name': u'Subdir', 'contenttype': u'text/plain'}, ''),
-    (u'Subdir/Foo', {'name': u'Subdir/Foo', 'contenttype': u'text/plain'}, ''),
-    (u'Subdir/Bar', {'name': u'Subdir/Bar', 'contenttype': u'text/plain'}, ''),
+    (u'Foo', {'name': [u'Foo'], 'contenttype': u'text/plain', 'namespace': u''}, u''),
+    (u'Foo', {'name': [u'Foo'], 'contenttype': u'text/plain', 'namespace': u''}, u'2nd'),
+    (u'Subdir', {'name': [u'Subdir'], 'contenttype': u'text/plain', 'namespace': u''}, u''),
+    (u'Subdir/Foo', {'name': [u'Subdir/Foo'], 'contenttype': u'text/plain', 'namespace': u''}, u''),
+    (u'Subdir/Bar', {'name': [u'Subdir/Bar'], 'contenttype': u'text/plain', 'namespace': u''}, u''),
 ]
 
 

File MoinMoin/util/_tests/test_interwiki.py

 
     def test__split_namespace(self):
         map = set()
-        map.add('ns1')
-        map.add('ns1:ns2')
+        map.add(u'ns1')
+        map.add(u'ns1:ns2')
         tests = [('', ('', '')),
                  ('OtherWiki:', ('', 'OtherWiki:')),
                  ('ns1:', ('ns1', '')),
         for markup, (namespace, pagename) in tests:
             assert _split_namespace(map, markup) == (namespace, pagename)
             (namespace, pagename) = _split_namespace(map, markup)
-            assert isinstance(namespace, unicode)
-            assert isinstance(pagename, unicode)
 
     def test_split_interwiki(self):
         app.cfg.namespace_mapping = [(u'', 'default_backend'), (u'ns1:', 'default_backend'), (u'ns1:ns2:', 'other_backend')]

File MoinMoin/util/interwiki.py

     if namespace:
         length = len(namespace) + 1
         url = url[length:]
-    return namespace.decode('utf-8'), url.decode('utf-8')
+    return namespace, url
 
 def split_interwiki(wikiurl):
     """ Split a interwiki name, into wikiname and pagename, e.g:
     :rtype: tuple
     :returns: (wikiname, namespace, pagename)
     """
+    if not isinstance(wikiurl, unicode):
+        wikiurl = wikiurl.decode('utf-8')
     namespace_mapping = set()
     for namespace, _ in app.cfg.namespace_mapping:
         namespace_mapping.add(namespace.rstrip(':'))
     # Base case: no colon in wikiurl
     if not ':' in wikiurl:
-        return u'Self', u'', wikiurl.decode('utf-8')
+        return u'Self', u'', wikiurl
     if not wikiurl.startswith(':'):
         wikiname, item_name = _split_namespace(set(app.cfg.interwiki_map.keys()), wikiurl)
         namespace = u''
             if ':' in wikiname:
                 namespace = wikiname.split(':', 1)[1]
                 wikiname = wikiname.split(':', 1)[0]
-        return wikiname.decode('utf-8'), namespace.decode('utf-8'), item_name.decode('utf-8')
+        return wikiname, namespace, item_name
     else:
         namespace, item_name =  _split_namespace(set(namespace_mapping), wikiurl.split(':', 1)[1])
         if not namespace:
             item_name = u':{0}'.format(item_name)
-        return u'Self', namespace.decode('utf-8'), item_name.decode('utf-8')
+        return u'Self', namespace, item_name
 
 def join_wiki(wikiurl, wikitail, namespace):
     """