Fixed a bug where the Valid_id() validator would raise a TypeError when
given a None value. Now raising a ValueError instead.
This commit is contained in:
parent
1d17ea4eff
commit
8bed4a7f4d
2
NEWS
2
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
|
||||
|
|
|
@ -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()
|
||||
|
|
Reference in New Issue