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

2005-02-15 Thread Junkmail
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

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2005-02-10 Thread Junkmail
I've been playing with Zope for about a year and took the plunge last
week into making a product.

To keep it [arguably] simple I used a ZClass to wrap an external
method.  My ZClass works and returns the output I expect.

What doesn't work is when I refer to an object I've created from a
dtml-var or a tal:content or tal:replace statement.  Instead of the
proper output I receive: TextileClass at home where TextileClass is
my class name and home is the Object ID I'm referencing.  The fact that
the  and  surround the output make it invisible in the browser and
had me chasing ghosts for a while.  I'd bet I'm not groking something
here.

So if I call /home I get the proper HTML output: bWhat I am looking
for/b but when in another object I reference dtml-var home I get:
TextileClass at home.

Any thoughts are appreciated.

Mike

PS: Yes it is a wrapper for Textile ver 2 and I plan on publishing it.
It is however limited to Zope 2.7+ due to the implementation of Textile
requiring Python 2.3

-- 
http://mail.python.org/mailman/listinfo/python-list