[Zope-dev] display a ZClass instance

Michel Pelletier michel@digicool.com
Mon, 12 Jul 1999 16:05:34 -0400


> -----Original Message-----
> From: Itamar S.-T. [mailto:itamars@ibm.net]
> Sent: Monday, July 12, 1999 1:39 PM
> To: zope-dev@zope.org
> Subject: [Zope-dev] display a ZClass instance
> 
> 
> I create a ZClass, which inherits from ObjectContainer, with 
> a index_html
> DTML method, and create an instance of the class called test.
> 
> http://localhost:9673/test or 
> http://localhost:9673/test/index_html works
> fine, but if I try doing <!--#var test--> from inside the DTML method
> http://localhost:9673/test/index_html it writes in the html 
> file (it doesn't
> show up since Netscape thinks its a tag)
> 
> 	<AnouncementsClass instance at 84f9e10>
> 
> instead of what I want it to do - that is, show the output of
> test/index_html.
> How then do I display it?  Does it need to inherit from anything else?
> 

If I understand your question correctly, try: <!--#var index_html-->

Saying <!--#var test--> will just render the repr of the object, which
because it's a ZClass is excatly what you get.  DTML does a bit of
sniffing when you #var objects, and if that object is a DTML object
(like the test object's index_html) it will render it correctly.

-Michel

> -- 
> Itamar - itamars@ibm.net
> ----------------------------o---------------------------------
-------------o
>  Sealingwax Greeting Cards  | Trust? Ha! The US dollar is 
> backed by ICBMs! |
>  http://www.sealingwax.com  |      --Anonymous Coward, 
> Slashdot            |
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://www.zope.org/mailman/listinfo/zope-dev
> 
> (For non-developer, user-level issues, use the companion list,
> zope@zope.org, http://www.zope.org/mailman/listinfo/zope )
>