[Zope] max 2 levels of indirection?

J Cameron Cooper zope-l at jcameroncooper.com
Mon Aug 22 17:52:26 EDT 2005


Sean Dunn wrote:
> I’m running Zope 2.0.7, and I’m having a problem.. Consider me a newbie, 
> as I’ve only been using Zope for a few weeks.
> 
> After boiling the problem down to a test case, it seemed that I couldn’t 
> have a DTML method call a DTML method which then calls a Python script. 
> But then I realized it was a more general problem of max number levels 
> of indirection.. So I can’t have a DTML->DTML->DTML or 
> DTML->DTML->PythonScript. Is this a bug? When I try this, I get a Name 
> Error, which says that the name of the 3^rd level object is not defined.
> 
> Here’s an example:
> 
> DTML Method TestA:
> 
> <dtml-var expr=”TestB()”>
> 
> DTML Method TestB:
> 
> <dtml-var expr=”TestC()”>
> 
> DTML Method TestC:
> 
> Test C has run.
> 
> If I view TestA, I get the NameError that TestC doesn’t exist. If I view 
> TestB, I get the output “Test C has run”. All objects are in the same 
> folder.
> 
> Is there some namespace weirdness that I don’t understand?

When you call DTML methods directly, they expect to be passed certain 
parameters, including the namespace. When you simply use the names, this 
is done implicitly. When calling explicitly, you can lose the namespace 
if you don't follow the proper convention. I think you'll find that it 
works if you try::

  DTML Method TestA:

  <dtml-var TestB>

  DTML Method TestB:

  <dtml-var TestC>

  DTML Method TestC:

  Test C has run.

For calling DTML explicitly, it usually looks like::

  <dtml-var expr=”TestC(None, _)”>

See http://www.plope.com/Books/2_7Edition/AppendixE.stx for why.

Also:
http://mail.zope.org/pipermail/zope-db/2003-March/001554.html

This is one of the good reasons to avoid DTML, by the way.

		--jcc
-- 
"Building Websites with Plone"
http://plonebook.packtpub.com


More information about the Zope mailing list