Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
Allow empty date setting to dateBone
Browse files Browse the repository at this point in the history
Setting a date back to empty is not possible using fromClient right now: Empty string is converted to None, and None is not allowed by super-call to baseBone.isInvalid() as valid value. So this might fix the problem and integrates with [#32](viur-framework/viur-vi#32) in vi.
  • Loading branch information
phorward committed Apr 15, 2019
1 parent 05b017d commit 2ca5d22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bones/dateBone.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def fromClient( self,valuesCache, name, data ):
"""
rawValue = data.get(name, None)
if not rawValue:
value = None
value = rawValue
elif unicode(rawValue).replace("-", "", 1).replace(".","",1).isdigit():
if int(rawValue) < -1*(2**30) or int(rawValue)>(2**31)-2:
value = False # its invalid
Expand Down Expand Up @@ -158,7 +158,7 @@ def fromClient( self,valuesCache, name, data ):
else:
err = self.isInvalid(value)
if not err:
valuesCache[name] = value
valuesCache[name] = value if value else None
if value is None:
return "No value entered"
return err
Expand Down

0 comments on commit 2ca5d22

Please sign in to comment.