1. hacklab
  2. moin-2.0

Commits

Bruno Martin  committed 89c1de1

users profile items now use "userprofiles" namespace

  • Participants
  • Parent commits c0890c4
  • Branches namespaces

Comments (0)

Files changed (1)

File MoinMoin/user.py

View file
  • Ignore whitespace
 
 from MoinMoin import config, wikiutil
 from MoinMoin.config import WIKINAME, NAME, NAME_EXACT, ITEMID, ACTION, CONTENTTYPE, \
-                            EMAIL, OPENID, CURRENT, MTIME, CONTENTTYPE_USER
+                            EMAIL, OPENID, CURRENT, MTIME, CONTENTTYPE_USER, NAMESPACE
 from MoinMoin.i18n import _, L_, N_
 from MoinMoin.util.interwiki import getInterwikiHome, getInterwikiName, is_local_wiki
 from MoinMoin.util.crypto import crypt_password, upgrade_password, valid_password, \
                                  generate_token, valid_token, make_uuid
 from MoinMoin.storage.error import NoSuchItemError, ItemAlreadyExistsError, NoSuchRevisionError
+from MoinMoin.storage import USERPROFILES
 
 
 def create_user(username, password, email, openid=None, validate=True, is_encrypted=False):
                                          # maybe add option to not index wiki users
                                          # separately, but share them in the index also.
         CONTENTTYPE: CONTENTTYPE_USER,
+        NAMESPACE: USERPROFILES,
     })
     backend = get_user_backend()
     docs = backend.documents(**q)
         self.auth_method = kw.get('auth_method', 'internal')
         self.auth_attribs = kw.get('auth_attribs', ())
         self.bookmarks = {} # interwikiname: bookmark
+        self.namespace = USERPROFILES
 
         self.__dict__.update(copy.deepcopy(self._cfg.user_defaults))
 
             from MoinMoin.security import Default
             self.may = Default(self)
 
+
     def __repr__(self):
         return "<{0}.{1} at {2:#x} name:{3!r} itemid:{4!r} valid:{5!r}>".format(
             self.__class__.__module__, self.__class__.__name__, id(self),
             meta[key] = value
         meta[CONTENTTYPE] = CONTENTTYPE_USER
         meta[ACTION] = u'SAVE'
+        if not isinstance(self.name, list):
+            meta[NAME] = [meta[NAME]]
         item.store_revision(meta, StringIO(''), overwrite=True)
 
         if not self.disabled: