Johan -
I have done a similiar hotfix by using None - which I think is a better alternative than ''. If you want to see all of the source, download the following Product, http://www.zope.org/Members/natsukashi/Products/CMFPropertyCore, and look inside the file CMFPropertyCore/LinkPropertyManager.py 1) I created my own converter functions and simply call the real function if the value is not none. Here is an excerpt from a file called LinkPropertyManager.py: from OFS.PropertyManager import PropertyManager from ZPublisher import Converters class LinkPropertyManager(PropertyManager): def field2float(v): if not v: return None else: return Converters.field2float(v) def field2int(v): if not v: return None else: return Converters.field2int(v) def field2long(v): if not v: return None else: return Converters.field2long(v) def field2date(v): if not v: return None else: return Converters.field2date(v) def field2link(v): if hasattr(v,'read'): v=v.read() else: v=str(v) return v type_converters = Converters.type_converters type_converters.update({'float' : field2float , 'int' : field2int , 'long' : field2long , 'date' : field2date , 'link' : field2link }) PropertyManager.type_converters = LinkPropertyManager.type_converters 2) Since you are patching the type converter, you might as well patch the manage_propertiesForm. This can be done by hotfixing the OFS.PropertyManager.PropertyManager.manage_propertiesForm value with your own dtml file. Here is a diff between the CMFPropertyCore/dtml/properties.dtml file and zope's properties.dtml file. bash$ diff -c properties.dtml /opt/arseed/tfs-lib/zope/zope-2.4.1/lib/python/OFS/dtml/properties.dtml *** properties.dtml Thu Aug 9 10:41:41 2001 --- /opt/arseed/tfs-lib/zope/zope-2.4.1/lib/python/OFS/dtml/properties.dtml Wed Oct 3 07:49:38 2001 *************** *** 58,74 **** <dtml-if "type == 'int'"> <input type="text" name="<dtml-var id>:<dtml-var type>" size="35" value="<dtml-if "hasProperty(id)"><dtml-var ! "'%s' % (getProperty(id) or '')" html_quote></dtml-if>"> <dtml-elif "type == 'long'"> <input type="text" name="<dtml-var id>:<dtml-var type>" size="35" value="<dtml-if "hasProperty(id)"><dtml-var ! "('%s' % (getProperty(id) or ''))[:-1]" html_quote></dtml-if>"> <dtml-elif "type in ('float', 'date')"> <input type="text" name="<dtml-var id>:<dtml-var type>" size="35" ! value="<dtml-var "getProperty(id)" html_quote null="">"> <dtml-elif "type=='string'"> <input type="text" name="<dtml-var id>:string" size="35" ! value="<dtml-var "getProperty(id)" html_quote null="">"> <dtml-elif "type=='boolean'"> <input type="checkbox" name="<dtml-var id>:boolean" size="35" <dtml-if "getProperty(id)">CHECKED</dtml-if>> --- 58,74 ---- <dtml-if "type == 'int'"> <input type="text" name="<dtml-var id>:<dtml-var type>" size="35" value="<dtml-if "hasProperty(id)"><dtml-var ! "'%s' % getProperty(id)" html_quote></dtml-if>"> <dtml-elif "type == 'long'"> <input type="text" name="<dtml-var id>:<dtml-var type>" size="35" value="<dtml-if "hasProperty(id)"><dtml-var ! "('%s' % getProperty(id))[:-1]" html_quote></dtml-if>"> <dtml-elif "type in ('float', 'date')"> <input type="text" name="<dtml-var id>:<dtml-var type>" size="35" ! value="<dtml-var "getProperty(id)" html_quote>"> <dtml-elif "type=='string'"> <input type="text" name="<dtml-var id>:string" size="35" ! value="<dtml-var "getProperty(id)" html_quote>"> <dtml-elif "type=='boolean'"> <input type="checkbox" name="<dtml-var id>:boolean" size="35" <dtml-if "getProperty(id)">CHECKED</dtml-if>> *************** *** 77,83 **** value="<dtml-in "getProperty(id)"><dtml-var sequence-item html_quote> </dtml-in>"> <dtml-elif "type=='text'"> <textarea name="<dtml-var id>:text" rows="6" cols="35"><dtml-var ! "getProperty(id)" html_quote null=""></textarea> <dtml-elif "type=='lines'"> <textarea name="<dtml-var id>:lines" rows="6" cols="35"><dtml-in "getProperty(id)"><dtml-var sequence-item html_quote><dtml-if --- 77,83 ---- value="<dtml-in "getProperty(id)"><dtml-var sequence-item html_quote> </dtml-in>"> <dtml-elif "type=='text'"> <textarea name="<dtml-var id>:text" rows="6" cols="35"><dtml-var ! "getProperty(id)" html_quote></textarea> <dtml-elif "type=='lines'"> <textarea name="<dtml-var id>:lines" rows="6" cols="35"><dtml-in "getProperty(id)"><dtml-var sequence-item html_quote><dtml-if *************** *** 91,97 **** <dtml-in "getProperty(select_variable)"> <option <dtml-if "_['sequence-item']==getProperty(id)">SELECTED</dtml-if> ! ><dtml-var sequence-item html_quote null="" ></option> </dtml-in> </select> </div> --- 91,97 ---- <dtml-in "getProperty(select_variable)"> <option <dtml-if "_['sequence-item']==getProperty(id)">SELECTED</dtml-if> ! ><dtml-var sequence-item html_quote></option> </dtml-in> </select> </div> *************** *** 101,107 **** <dtml-in "_[select_variable]"> <option <dtml-if "_['sequence-item']==getProperty(id)">SELECTED</dtml-if> ! ><dtml-var sequence-item html_quote null="" ></option> </dtml-in> </select> </div> --- 101,107 ---- <dtml-in "_[select_variable]"> <option <dtml-if "_['sequence-item']==getProperty(id)">SELECTED</dtml-if> ! ><dtml-var sequence-item html_quote></option> </dtml-in> </select> </div> *************** *** 121,127 **** <option<dtml-if "getProperty(id) and (_['sequence-item'] in getProperty(id))" > SELECTED</dtml-if ! >><dtml-var sequence-item html_quote null=""></option> </dtml-in> </select> </div> --- 121,127 ---- <option<dtml-if "getProperty(id) and (_['sequence-item'] in getProperty(id))" > SELECTED</dtml-if ! >><dtml-var sequence-item html_quote></option> </dtml-in> </select> </div> *************** *** 133,139 **** <option<dtml-if "getProperty(id) and (_['sequence-item'] in getProperty(id))" > SELECTED</dtml-if ! >><dtml-var sequence-item html_quote null=""></option> </dtml-in> </select> </div> --- 133,139 ---- <option<dtml-if "getProperty(id) and (_['sequence-item'] in getProperty(id))" > SELECTED</dtml-if ! >><dtml-var sequence-item html_quote></option> </dtml-in> </select> </div> *************** *** 142,156 **** No value for <dtml-var select_variable>. </div> </dtml-if> - <dtml-elif "type=='link'"> - <input type="text" name="<dtml-var id>:string" size="35" - value="<dtml-var "getProperty(id)[1]" html_quote null="">"> <dtml-else> <em>Unknown property type</em> </dtml-if> <dtml-else> <table border="1"> ! <tr><td><dtml-var "getProperty(id)" html_quote null=""></td></tr> </table> </dtml-if> </td> --- 142,153 ---- No value for <dtml-var select_variable>. </div> </dtml-if> <dtml-else> <em>Unknown property type</em> </dtml-if> <dtml-else> <table border="1"> ! <tr><td><dtml-var "getProperty(id)" html_quote></td></tr> </table> </dtml-if> </td> At Wed, 3 Oct 2001 17:06:24 +0200, Johan Carlsson wrote: > > Hi, > We currently want to use date-properties in the regular property sheet. > The current date-property doesn't accept an empty value. > We want to be able to submit an empty string and set a NullDate value > indicating. Also a NullDate value should return an empty string when the > "manage_propertiesForm" is rendered, e.g. showing an empty field. > > We have currently chosen a empty string "", to represent the NullDate value. > (We haven't found any NullDate representation in DateTime and have concluded > that it doesn't exist?) > Choosing None as the NullDate value would have been preferred but it > generates > issues with the rendering of "manage_propertiesForm". > > > Question: > > Is there anything better then an empty string for the NullDate value? > > Best Regards, > Johan Carlsson > www.torped.se > > > [Here's our hot-patch] > > from ZPublisher import Converters > > def fixedfield2date(v): > print "Fixed field2date conversion", fixedfield2date, v > from DateTime import DateTime > if hasattr(v,'read'): v=v.read() > else: v=str(v) > if v=='': > return v > return DateTime(v) > > Converters.field2date = fixedfield2date > Converters.type_converters['date'] = fixedfield2date > > print "ZPublisher.Converters.field2date patched." > > > > > _______________________________________________ > Zope-Dev maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope ) > _______________________________________________ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )