diff --git a/NEWS b/NEWS index 02c3f43..7a43b3e 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ """ character entity so it doesn't show up as a change in the diff. * Fixed a bug where attempting to load a notebook preview without access would give a "list index out of range" error instead of an access error. + * Fixed a bug where the Valid_id() validator would raise a TypeError when + given a None value. Now raising a ValueError instead. 1.3.13: May 5, 2008 * Instructions for enabling JavaScript, linked from various forms that diff --git a/controller/Database.py b/controller/Database.py index 9e45dbc..855e6a6 100644 --- a/controller/Database.py +++ b/controller/Database.py @@ -343,7 +343,12 @@ class Valid_id( object ): self.__none_okay = none_okay def __call__( self, value ): - if self.__none_okay and value in ( None, "None", "" ): return None + if value in ( None, "None", "" ): + if self.__none_okay: + return None + else: + raise ValueError() + if self.ID_PATTERN.search( value ): return str( value ) raise ValueError()