changeset 449:8ec16f62e989

Moved type check of the superuser setting. imported from: moin--main--1.5--patch-453
author Alexander Schremmer <alex@alexanderweb.de.tla>
date Sat, 18 Feb 2006 16:12:14 +0000
parents 45924beef130
children 215d66f88732
files ChangeLog MoinMoin/multiconfig.py MoinMoin/user.py
diffstat 3 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 18 15:31:50 2006 +0000
+++ b/ChangeLog	Sat Feb 18 16:12:14 2006 +0000
@@ -2,6 +2,18 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-02-18 17:12:14 GMT	Alexander Schremmer <alex@alexanderweb.de.tla>	patch-453
+
+    Summary:
+      Moved type check of the superuser setting.
+    Revision:
+      moin--main--1.5--patch-453
+
+
+    modified files:
+     ChangeLog MoinMoin/multiconfig.py MoinMoin/user.py
+
+
 2006-02-18 16:31:50 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-452
 
     Summary:
--- a/MoinMoin/multiconfig.py	Sat Feb 18 15:31:50 2006 +0000
+++ b/MoinMoin/multiconfig.py	Sat Feb 18 16:12:14 2006 +0000
@@ -437,10 +437,14 @@
         # Try to decode certain names which allow unicode
         self._decode()
 
-        # Make sure directories are accessible
         self._check_directories()
 
-        # Load plugin module
+        if not isinstance(self.superuser, list):
+            msg = """The superuser</b> setting in your wiki configuration is not a list
+                     (e.g. ['Sample User', 'AnotherUser']).
+                     Please change it in your wiki configuration and try again."""
+            raise error.ConfigurationError(msg)
+        
         self._loadPluginModule()
 
         # Preparse user dicts
--- a/MoinMoin/user.py	Sat Feb 18 15:31:50 2006 +0000
+++ b/MoinMoin/user.py	Sat Feb 18 16:12:14 2006 +0000
@@ -902,11 +902,8 @@
 
     def isSuperUser(self):
         superusers = self._request.cfg.superuser
-        # some people managed to WRONGLY assign a string instead of a list and
-        # then dumb things may happen when username is a substring of cfg.superuser
-        islisttype = isinstance(superusers, (list, tuple))
-        return self.valid and self.name and \
-                islisttype and self.name in superusers
+        assert isinstance(superusers, (list, tuple))
+        return self.valid and self.name and self.name in superusers
 
     def host(self):
         """ Return user host """