witten
/
luminotes
Archived
1
0
Fork 0

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:
Dan Helfman 2008-05-05 23:32:45 +00:00
parent 1d17ea4eff
commit 8bed4a7f4d
2 changed files with 8 additions and 1 deletions

2
NEWS
View File

@ -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

View File

@ -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()