changeset 2559:ba76f4025416

stricter argument checking for required_arg
author Johannes Berg <johannes AT sipsolutions DOT net>
date Wed, 25 Jul 2007 10:50:04 +0200
parents fb05ca2c0bdc
children 575541d1fdb4
files MoinMoin/wikiutil.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Wed Jul 25 10:49:49 2007 +0200
+++ b/MoinMoin/wikiutil.py	Wed Jul 25 10:50:04 2007 +0200
@@ -1529,8 +1529,8 @@
         Initialise a required_arg
         @param argtype: the type the argument should have
         """
-        if not isinstance(argtype, type):
-            raise TypeError("argtype must be a type")
+        if not argtype in (bool, int, long, float, complex, unicode):
+            raise TypeError("argtype must be a valid type")
         self.argtype = argtype
 
 
@@ -1561,6 +1561,7 @@
 
         In other cases return the value itself.
         """
+        # if extending this, extend required_arg as well!
         if isinstance(default, bool):
             return get_bool(request, value, name, default)
         elif isinstance(default, int) or isinstance(default, long):