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

Dieter Maurer dieter at handshake.de
Sat Feb 12 14:43:02 EST 2005


"Junkmail" <junkmail at chipworks.net> writes on 10 Feb 2005 18:26:52 -0800:
> I've been playing with Zope for about a year and took the plunge last
> week into making a product.

You should send Zope related questions to the Zope mailing list.
You will need to subcribe. You can do this at "http://www.zope.org".

> ...
> 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.

There is a fundamental difference when you "call" an object
with ZPublisher (i.e. via the Web) and when you use it
in a template.

ZPublisher effectively "calls" "index_html" and if
this is "None", it calls the object.

A template (usually) calls the object (if it is callable) and
then converts the result into a string.


Apparently, your ZInstance is not callable.
Therefore, it is converted into a string.
Apparently, it does not have a custom "__str__",
therefore, you get the standard string conversion for instances
(that's what you see).

> 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.

This should not happen in ZPT (unless you use "structure").

> So if I call /home I get the proper HTML output: "<b>What I am looking
> for</b>" but when in another object I reference <dtml-var home> I get:
> "<TextileClass at home>".
> 
> Any thoughts are appreciated.

Call a method on your ZInstance.

To get the same result as via ZPublisher (the Web),
call its "index_html". This may need arguments (I do not know).


Dieter



More information about the Python-list mailing list