[ZCM] [ZC] 759/ 2 Reject "access to selection / multiple selection properties in DTML Methods"
Collector: Zope Bugs, Features, and Patches ...
zope-coders-admin@zope.org
Fri, 10 Jan 2003 12:12:10 -0500
Issue #759 Update (Reject) "access to selection / multiple selection properties in DTML Methods"
Status Rejected, Zope/bug medium
To followup, visit:
http://collector.zope.org/Zope/759
==============================================================
= Reject - Entry #2 by ajung on Jan 10, 2003 12:12 pm
Status: Pending => Rejected
dupe (#760)
________________________________________
= Request - Entry #1 by abel on Jan 7, 2003 7:56 am
- add a lines property named 'ref_' to a folder and fill in some values.
- copy the contents of lib/python/OFS/dtml/properties.dtml into a DTML Method 'proptest' in this folder.
- create a subfolder in the folder
- add a selection or multiple selection property to the subfolder, with the lines property 'ref_' from the parent folder as the "choice values".
- call the method 'proptest' on the subfolder. Instead of showing the [multiple] selection, the output will be "no value for ref_".
While the regular properties tab of the ZMI works fine, the property 'ref_' of the parent folder cannot be accessed from the DTML Method with the same source code.
Some more details:
- If something like '<dtml-var ref_>' is inserted near the start of the DTML Method proptest, the [multi] selection property will be shown correctly.
- If line 130 of the 'proptest':
> <dtml-elif "_.has_key(select_variable)">
> <div class="form-element">
> <select name="<dtml-var id>:utf8:list" multiple
> size="<dtml-var "_.min(7, _.len(_[select_variable]))">">
> <dtml-in "_[select_variable]">
> <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>
> <dtml-else>
is changed to
> <dtml-elif "1 or _.has_key(select_variable)">
> ...
Zope raises an "unauthorized" error.
- As a workaround, it is possible to change lines 100 and 130 to
> <dtml-elif "_.has_key(_.str(select_variable))">
select_variable is of type ustring, and for whichever reason access to things like _[select_variable] seems to be denied, while access to _[_.str(select_variable)]] works. More exactly: If there has been at least one access to _[_.str(select_variable)]], accessing _[select_variable] works too.
==============================================================