[Zope] Re[2]: [Zope] Re[2]: [Zope] comparing variables from different name spaces?

Ainis Ainis <ainis@mindless.com>
Tue, 28 Sep 1999 19:42:20 +0200


Hello Ethan,

Tuesday, Tuesday, September 28, 1999, you wrote:

EF> Ainis wrote:

>> So I tried:
>> <dtml-if "PARENTS[-3].id">
>> but i get an error if it does not exist. So how do i check if the
>> variable exists?

>>From Michel Pelletier:

EF> <dtml-with test>
EF>   <dtml-if "dir2 in PARENTS">
EF>     dir2 is one of your parents
EF>   </dtml-if>
EF> </dtml-with>

EF> This will work no matter where dir2 is in the acquisition hierarchy (as
EF> long as it's within test).

Yeah, but this is not the answer I was looking for. This checks for any parent
and I need to check only for the parent at the root.
example:
  I have folders:
  /test/blah/qwer/wert/erty/rtyu/
  /test/ouch/asdf/sdfg/dfgh/fghj/

  so when i execute a script from /test/blah/qwer/wert/erty/rtyu/ i
  get a list of subfolders in /test/, that's "blah" and "ouch" and then i
  must determine which one of the two is my parent. Your model would
  not work in a case when any other parent of the current folder has
  also id of blah which could happen on my site :)

I have partially solved my problem. I'm comparing a list of /test/
subfolders with "PARENTS[-3].id" and it works just fine but thing
blows up when I try to execute script from /test/ and it's easy to
understand why because in /test/ "PARENTS[-3].id" does not exist.
My problem now is only to check if "PARENTS[-3].id" exists but how can
I do that? <dtml-if "PARENTS[-3].id"> for some strange reason does not
work :(

Best regards,
 Ainis                            mailto:ainis@mindless.com