changeset 3106:af3dd2bc85cc

merged main
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 23 Feb 2008 21:45:02 +0100
parents 80e1a910a2f1 (current diff) ce6f12d51736 (diff)
children c6e39279f83b
files
diffstat 3 files changed, 31 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_user.py	Sat Feb 23 21:43:47 2008 +0100
+++ b/MoinMoin/_tests/test_user.py	Sat Feb 23 21:45:02 2008 +0100
@@ -158,6 +158,25 @@
         theUser = user.User(self.request, name=name, password=password)
         theUser.subscribe(pagename)
         assert not theUser.isSubscribedTo([testPagename]) # list(!) of pages to check
+        
+    def testRenameUser(self):
+        """ create user and then rename user and check
+        if the old username is removed from the cache name2id
+        """
+        # Create test user
+        # Use iso charset to create user with old enc_password, as if
+        # the user file was migrated from pre 1.3 wiki.
+        name = u'__Some Name__'
+        password = name
+        self.createUser(name, password)
+        # Login - this should replace the old password in the user file
+        theUser = user.User(self.request, name=name)
+        # Rename user
+        theUser.name = u'__SomeName__'
+        theUser.save()
+        theUser = user.User(self.request, name=name, password=password)
+        
+        assert not theUser.exists()
 
     # Helpers ---------------------------------------------------------
 
--- a/MoinMoin/search/builtin.py	Sat Feb 23 21:43:47 2008 +0100
+++ b/MoinMoin/search/builtin.py	Sat Feb 23 21:45:02 2008 +0100
@@ -555,8 +555,10 @@
                         clock.stop('_xapianProcess')
             finally:
                 clock.stop('_xapianSearch')
-        else:
-            # we didn't use xapian in this request
+        elif not index:
+            # we didn't use xapian in this request because we have no index,
+            # so we can just disable it until admin builds an index and
+            # restarts moin processes
             self.request.cfg.xapian_search = 0
 
         # some postprocessing by _moinSearch is required
--- a/MoinMoin/user.py	Sat Feb 23 21:43:47 2008 +0100
+++ b/MoinMoin/user.py	Sat Feb 23 21:45:02 2008 +0100
@@ -616,6 +616,14 @@
             data.write(line)
         data.close()
 
+        arena = 'user'
+        key = 'name2id'
+        cache = caching.CacheEntry(self._request, arena, key, scope='wiki').remove()
+        try:
+            del self._request.cfg.cache.name2id
+        except:
+            pass
+        
         if not self.disabled:
             self.valid = 1