access to selection / multiple selection properties in DTML Methods

Bug #142417 reported by Abel Deuring
2
Affects Status Importance Assigned to Milestone
Zope 2
Won't Fix
Medium
Unassigned

Bug Description

- 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.

Tags: bug zope
Revision history for this message
Hanno Schlichting (hannosch) wrote :

This sounds like an overcomplicated mix of DTML and the ticket has seen no interest in years. I'd call this a wontfix.

Changed in zope2:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.