changeset 2243:880f995b9d0b

Allow possibility of creating item with name u'' (dont allways convert name u'' into namespace_root).
author Ashutosh Singla <ashu1461@gmail.com>
date Sun, 18 Aug 2013 14:56:23 +0530
parents d274858671d8
children ec92e2ded24d
files MoinMoin/items/__init__.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Sun Aug 18 14:51:05 2013 +0530
+++ b/MoinMoin/items/__init__.py	Sun Aug 18 14:56:23 2013 +0530
@@ -275,7 +275,7 @@
         return cls(*args, **kw)
 
     @classmethod
-    def create(cls, name=u'', itemtype=None, contenttype=None, rev_id=CURRENT, item=None):
+    def create(cls, name=u'', itemtype=None, contenttype=None, rev_id=CURRENT, item=None, set_root=False):
         """
         Create a highlevel Item by looking up :name or directly wrapping
         :item and extract the Revision designated by :rev_id revision.
@@ -296,7 +296,7 @@
         fqname = split_fqname(name)
         if fqname.field not in UFIELDS:  # Need a unique key to extract stored item.
             raise FieldNotUniqueError("field {0} is not in UFIELDS".format(fqname.field))
-        if not fqname.value and fqname.field == NAME_EXACT:
+        if set_root and not fqname.value and fqname.field == NAME_EXACT:
             fqname = fqname.get_root_fqname()
 
         rev = get_storage_revision(fqname, itemtype, contenttype, rev_id, item)