[Zope] My little aquisition misunderstanding...

Dieter Maurer dieter at handshake.de
Wed Nov 19 14:28:45 EST 2003


Jaroslav Lukesh wrote at 2003-11-19 17:08 +0100:
 > Imagine folder structure (at Zope 2.5.1):
 > 
 > Method1
 > Method2
 > object2
 > object1
 >    +------object3
 > 
 > 
 > Method1 (simplified) return object2!!!
 > 
 > <dtml-with object1>
 > 	<dtml-with aq_explicit>
 > 		<dtml-try>
 > 			<dtml-var object2>
 > 		<dtml-except>
 > 		</dtml-try>
 > 	</dtml-with>
 > </dtml-with>
 > 
 > It does not matter, how much <dtml-with aq_explicit> tags you define, with
 > only one works like with paranoid-wide spread <dtml-with aq_explicit> tags.
 > I was play with "only" appendics in dtml-with tag, but no success until I
 > make Method2
 > 
 > Method2 (simplified) works as expected and render nothing:
 > 
 > <dtml-with object1>
 > 	<dtml-if "_.hasattr(aq_explicit, 'object2')">
 > 		<dtml-var object2>
 > 	</dtml-if>
 > </dtml-with>
 > 
 > Does aq_explicit  fail if is used with <dtml-try> tags or I am weak?

No. "aq_explicit" works the same way with "dtml-with" and without.

Note, that "aq_explicit" is not safe. From 2.6.2 on, you
can use "aq_inner.aq_explicit" (which is safe).
But, this is not your problem.

I expect your problem is how DTML lookup works:

  "dtml-with" pushes the object onto the DTML namespace stack.
  "aq_explicit" will not be able to resolve "object2" but
  the "object1" above will. You get it from there.

  A "dtml-with aq_explicit only" should have worked, though.

-- 
Dieter



More information about the Zope mailing list