I have a date property and need to support an unknown date type. If I leave the field blank, I get a syntax error when I try and save the properties (no more info on error yet, see previous post on error_tb in manager interface). Error Type: AttributeError Error Value: SyntaxError instance has no attribute 'replace' I would be happy to use '' or None. I found this post http://mail.zope.org/pipermail/zope-dev/2001-October/013476.html to handle None. Is this the preferred approach? What is the best/easiest way to support a default unknown date? I can also use 0001-01-01 but this is a bit hackish. Zope 2.7 JDH
"John" == John Hunter <jdhunter@ace.bsd.uchicago.edu> writes:
John> I would be happy to use '' or None. I found this post John> http://mail.zope.org/pipermail/zope-dev/2001-October/013476.html John> to handle None. Is this the preferred approach? I used this approach and am happy with it... from ZPublisher import Converters def date_or_none(val): if val.lower().strip() == 'none': return 'None' return Converters.field2date(val) type_converters = Converters.type_converters type_converters.update({'date' : date_or_none})
participants (1)
-
John Hunter