For none_okay validator flag, allow empty strings as well.
This commit is contained in:
parent
e963007ae5
commit
f81707ea2f
|
@ -259,7 +259,7 @@ class Valid_id( object ):
|
||||||
self.__none_okay = none_okay
|
self.__none_okay = none_okay
|
||||||
|
|
||||||
def __call__( self, value ):
|
def __call__( self, value ):
|
||||||
if self.__none_okay and value is None: return None
|
if self.__none_okay and value in ( None, "" ): return None
|
||||||
if self.ID_PATTERN.search( value ): return str( value )
|
if self.ID_PATTERN.search( value ): return str( value )
|
||||||
|
|
||||||
raise ValueError()
|
raise ValueError()
|
||||||
|
|
Reference in New Issue