Hi everyone, I have the following problem: For example consider the code: <dtml-in "test.ba.objectValues()"> <dtml-var id> </dtml-in> This gives the ids in the folder test/ba. My problem is that in my applcation I get the path like "test/ba" in the example through a REQUEST. The script <dtml-in "_[tt].ba.objectValues()"> <dtml-var id> </dtml-in> works if the variable "tt" contains the value "test". But I don't have found a possibility to call the method if the given path (or better the relevant part of the path) contains more than one folder. The code <dtml-in "_[tt].objectValues()"> <dtml-var id> </dtml-in> don't works if the variable "tt" contains "test.ba". Thank you in advance for your help. Regards Ernst-Dieter
Nikel, Ernst-Dieter wrote:
Hi everyone,
I have the following problem:
For example consider the code:
<dtml-in "test.ba.objectValues()"> <dtml-var id> </dtml-in>
This gives the ids in the folder test/ba.
My problem is that in my applcation I get the path like "test/ba" in the example through a REQUEST. The script
<dtml-in "_[tt].ba.objectValues()"> <dtml-var id> </dtml-in>
works if the variable "tt" contains the value "test". But I don't have found a possibility to call the method if the given path (or better the relevant part of the path) contains more than one folder.
The code
<dtml-in "_[tt].objectValues()"> <dtml-var id> </dtml-in>
don't works if the variable "tt" contains "test.ba".
Take a look at restrictedTraverse() (search the online help). Three other remarks: - It's in general not a good idea to trust anything coming from the client (the REQUEST) like you do. If you are using restrictedTravere for instance, your code will possibly reveal contents of folders which you don't want revealed if the user sends the right value for tt. - If you just need the ids of your objects, better use objectIds instead of objectValues, the former is much faster. - If you need to use objectValues, don't use id to get the Ids of these objects, use getId(), because not every object implements the id attribute in the same way. cheers, oliuver
On to, 12.06.2003 at 11:03 +0200, Nikel, Ernst-Dieter wrote:
I have the following problem:
For example consider the code:
<dtml-in "test.ba.objectValues()"> <dtml-var id> </dtml-in>
This gives the ids in the folder test/ba.
My problem is that in my applcation I get the path like "test/ba" in the example through a REQUEST. The script
<dtml-in "_[tt].ba.objectValues()"> <dtml-var id> </dtml-in>
works if the variable "tt" contains the value "test". But I don't have found a possibility to call the method if the given path (or better the relevant part of the path) contains more than one folder.
The code
<dtml-in "_[tt].objectValues()"> <dtml-var id> </dtml-in>
don't works if the variable "tt" contains "test.ba".
I don't know dtml, but you can probably translate this python code to dtml: for k in container.REQUEST.resolve_url(tt).objectValues(): print k.getId() If you have the full url, you can use request.resolve_url() to get the object, and call objectValues() on that. -- paavo. "joskus voi tää meno käydä ahdistavaksi kun on täällä muodostunut tavaksi muuttaa jokaisen elämän arvo rahaksi"
participants (3)
-
Nikel, Ernst-Dieter -
Oliver Bleutgen -
Paavo Parkkinen