Zope: Adding a layer causes valid output to become an object reference?

Junkmail junkmail at chipworks.net
Tue Feb 15 11:28:39 EST 2005


Dieter,

Thanks for the reply.  I ran across an article in the Zope FAQ that
nailed the problem on the head.  Basically it said the same thing you
are saying.  For those that follow in my footsteps one day...

ZPublisher Implicitly calls the method of a url which in the case of a
zclass is a call to index_html.  From ZPT and DTML however you must
Explicitly call the method of your zclass, for example:

  <dtml-var "get_users.index_html()">

The paren () on the end are important!!

To make matters worse my external script references parameters in the
actual object I'm calling, but since I'm not calling a DTML method and
I have to explicitly reference the method I want to call, the DTML
namespace gets shipped to my external method instead of the namespace
of my called object.  I read "groking acquisition" 4 times before I
groked it.  To fix that I changed the index_html of my zclass to a
python script and call my external script from there so I can pass the
proper namespaces to the external script.  I suppose I can do that from
a DTML method, but the python script makes it absolutely clear what the
intention is.

I think the proper thing for the long term is re-write this as a
Product and emulate the way a DTML method accepts a call so I can avoid
all the "blah.index_html()" references and provide something a bit less
error prone (more standard).

I'm highly tempted to hack the existing DTML method into a new product
and leave DTML in it so I can combine Textile with DTML in a single
object.

Thanks,

Mike




More information about the Python-list mailing list