changeset 889:4cac830aca1e storage-ng

user obj: use .itemid consistently
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 26 Sep 2011 15:54:12 +0200
parents 2db836239438
children 9c862a0aee26
files MoinMoin/app.py MoinMoin/apps/frontend/views.py MoinMoin/auth/__init__.py MoinMoin/security/ticket.py MoinMoin/user.py MoinMoin/util/edit_lock.py
diffstat 6 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/app.py	Mon Sep 26 13:08:03 2011 +0200
+++ b/MoinMoin/app.py	Mon Sep 26 15:54:12 2011 +0200
@@ -220,7 +220,7 @@
         # could have a param where the admin could tell whether he wants to
         # trust it)
         userobj.auth_trusted = userobj.auth_method in app.cfg.auth_methods_trusted
-        session['user.id'] = userobj.uuid
+        session['user.itemid'] = userobj.itemid
         session['user.auth_method'] = userobj.auth_method
         session['user.auth_attribs'] = userobj.auth_attribs
     return userobj
--- a/MoinMoin/apps/frontend/views.py	Mon Sep 26 13:08:03 2011 +0200
+++ b/MoinMoin/apps/frontend/views.py	Mon Sep 26 15:54:12 2011 +0200
@@ -1288,7 +1288,7 @@
 @frontend.route('/+logout')
 def logout():
     flash(_("You are now logged out."), "info")
-    for key in ['user.id', 'user.auth_method', 'user.auth_attribs', ]:
+    for key in ['user.itemid', 'user.auth_method', 'user.auth_attribs', ]:
         if key in session:
             del session[key]
     return redirect(url_for('.show_root'))
--- a/MoinMoin/auth/__init__.py	Mon Sep 26 13:08:03 2011 +0200
+++ b/MoinMoin/auth/__init__.py	Mon Sep 26 15:54:12 2011 +0200
@@ -426,8 +426,8 @@
 
 def setup_from_session():
     userobj = None
-    if 'user.id' in session:
-        auth_userid = session['user.id']
+    if 'user.itemid' in session:
+        auth_userid = session['user.itemid']
         auth_method = session['user.auth_method']
         auth_attrs = session['user.auth_attribs']
         logging.debug("got from session: %r %r" % (auth_userid, auth_method))
--- a/MoinMoin/security/ticket.py	Mon Sep 26 13:08:03 2011 +0200
+++ b/MoinMoin/security/ticket.py	Mon Sep 26 15:54:12 2011 +0200
@@ -30,7 +30,7 @@
         # for age-check of ticket
         tm = "%010x" % time.time()
 
-    kw['uid'] = flaskg.user.valid and flaskg.user.uuid or ''
+    kw['uid'] = flaskg.user.valid and flaskg.user.itemid or ''
 
     hmac_data = []
     for value in sorted(kw.items()):
--- a/MoinMoin/user.py	Mon Sep 26 13:08:03 2011 +0200
+++ b/MoinMoin/user.py	Mon Sep 26 15:54:12 2011 +0200
@@ -187,7 +187,7 @@
 
         self._cfg = app.cfg
         self.valid = 0
-        self.uuid = uid
+        self.itemid = uid
         self.auth_username = auth_username
         self.auth_method = kw.get('auth_method', 'internal')
         self.auth_attribs = kw.get('auth_attribs', ())
@@ -211,24 +211,24 @@
 
         # we got an already authenticated username:
         check_password = None
-        if not self.uuid and self.auth_username:
+        if not self.itemid and self.auth_username:
             users = search_users(name_exact=self.auth_username)
             if users:
-                self.uuid = users[0].meta[ITEMID]
+                self.itemid = users[0].meta[ITEMID]
             if not password is None:
                 check_password = password
-        if self.uuid:
+        if self.itemid:
             self.load_from_id(check_password)
         elif self.name and self.name != 'anonymous':
             users = search_users(name_exact=self.name)
             if users:
-                self.uuid = users[0].meta[ITEMID]
-            if self.uuid:
+                self.itemid = users[0].meta[ITEMID]
+            if self.itemid:
                 # no password given should fail
                 self.load_from_id(password or u'')
         # Still no ID - make new user
-        if not self.uuid:
-            self.uuid = make_uuid()
+        if not self.itemid:
+            self.itemid = make_uuid()
             if password is not None:
                 self.enc_password = crypt_password(password)
 
@@ -240,9 +240,9 @@
             self.may = Default(self)
 
     def __repr__(self):
-        return "<%s.%s at 0x%x name:%r uuid:%r valid:%r>" % (
+        return "<%s.%s at 0x%x name:%r itemid:%r valid:%r>" % (
             self.__class__.__module__, self.__class__.__name__,
-            id(self), self.name, self.uuid, self.valid)
+            id(self), self.name, self.itemid, self.valid)
 
     @property
     def language(self):
@@ -283,7 +283,7 @@
                          password in the user account file.
         """
         try:
-            item = self._user_backend.get_item(itemid=self.uuid)
+            item = self._user_backend.get_item(itemid=self.itemid)
             rev = item[CURRENT]
         except KeyError: # was: (NoSuchItemError, NoSuchRevisionError):
             return
--- a/MoinMoin/util/edit_lock.py	Mon Sep 26 13:08:03 2011 +0200
+++ b/MoinMoin/util/edit_lock.py	Mon Sep 26 15:54:12 2011 +0200
@@ -31,7 +31,7 @@
     timestamp = time.time()
     addr = request.remote_addr
     hostname = wikiutil.get_hostname(addr) or u''
-    userid = flaskg.user.valid and flaskg.user.uuid or ''
+    userid = flaskg.user.valid and flaskg.user.itemid or ''
 
     item.change_metadata()
     item[EDIT_LOCK_TIMESTAMP] = str(timestamp)