comparing variables from different name spaces?
Hello ALL, How do i compare variables from two different namespaces? In my current situation I need to check if my current path is in some directory tree. For example lets say I have folders /test/dir1 /test/dir2 /test/dir3 In these folders there are alot more other folders, so when i currently am in for example /test/dir2/hardware/prices/index_html the script should check in which of those 3 root folders (dir1, dir2 or dir3) am i. Now lets look at the part of /test/dir2/hardware/prices/index_html source: <dtml-with test> <dtml-in "objectValues(['Folder'])"> <!--#var id--> </dtml-in--> </dtml-with--> Ok, so in this case i have a loop in which i go through ids of all folders in /test/ but now how do I check test's subfolder's id is PARENT of my current /test/dir2/hardware/prices/ folder? I think the easiest way would be- <dtml-if dir2> but that has to be done only from /test/dir2/hardware/prices/ names pace which (i think) I have already lost with <dtml-with test>. So how do I compare the older name space's variable with newer one's? I also tried some tricks with <dtml-with blah only> but with no success. P.S. excuse me if this turns out to be lame question, I'm a bit new to Zope Best regards, Ainis mailto:ainis@mindless.com
Ainis wrote:
Hello ALL, How do i compare variables from two different namespaces?
In my current situation I need to check if my current path is in some directory tree. For example lets say I have folders /test/dir1 /test/dir2 /test/dir3
In these folders there are alot more other folders, so when i currently am in for example /test/dir2/hardware/prices/index_html the script should check in which of those 3 root folders (dir1, dir2 or dir3) am i.
Now lets look at the part of /test/dir2/hardware/prices/index_html source:
<dtml-with test> <dtml-in "objectValues(['Folder'])"> <!--#var id--> </dtml-in--> </dtml-with-->
Ok, so in this case i have a loop in which i go through ids of all folders in /test/ but now how do I check test's subfolder's id is PARENT of my current /test/dir2/hardware/prices/ folder? I think the easiest way would be- <dtml-if dir2> but that has to be done only from /test/dir2/hardware/prices/ names pace which (i think) I have already lost with <dtml-with test>. So how do I compare the older name space's variable with newer one's?
Perhaps this is what your looking for: <dtml-with test> <dtml-if "dir2 in PARENTS"> dir2 is one of your parents </dtml-if> </dtml-with> -Michel
participants (2)
-
Ainis -
Michel Pelletier