[ZCM] [ZC] 775/ 1 Request "manage_changeProperties can't set boolean properties to false"
Collector: Zope Bugs, Features, and Patches ...
zope-coders-admin@zope.org
Fri, 17 Jan 2003 11:47:17 -0500
Issue #775 Update (Request) "manage_changeProperties can't set boolean properties to false"
Status Pending, Zope/bug+solution medium
To followup, visit:
http://collector.zope.org/Zope/775
==============================================================
= Request - Entry #1 by to_be on Jan 17, 2003 11:47 am
manage_changeProperties doesn't set boolean properties to false because the unchecked checkboxes don't appear in the REQUEST. This is a pity: if someone would build his own form and use manage_editProperties (because this method does this), all properties not contained in the form would be harmed as well.
My solution is:
1.) add a <input type="hidden" name="_checkboxes:utf8:string:list" value="<dtml-var id>"/> to each checked checkbox (in OFS/dtml/properties.dtml)
2.) change the leading if/else in OFS.PropertyManager.manage_changeProperties to
if REQUEST is None:
props={}
checkboxes = []
else:
checkboxes = REQUEST.form.get('_checkboxes',[])
if checkboxes:
props = {}
for name in checkboxes:
props[name] = 0
for name, value in REQUEST.form.items():
props[name] = value
else:
props = REQUEST
This way all checkboxes which have been checked will get unchecked if they aren't found in the REQUEST.
==============================================================