Ashutosh Singla avatar Ashutosh Singla committed 880f995 Draft

Allow possibility of creating item with name u'' (dont allways convert name u'' into namespace_root).

Comments (0)

Files changed (1)

MoinMoin/items/__init__.py

         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.
         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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.