[Zope] still problem with dtml-with

Jerome Alet alet@librelogiciel.com
Thu, 25 Jul 2002 10:18:34 +0200


Hi,

some days ago I've posted a message asking for help wrt a Python
product : dtml-with didn't work with instances of this product.

Toby Dickenson answered and gave me what I thought to be the
solution : rename the "__call__" method I had defined to "index_html"

Now dtml-with works, but dtml-var doesn't (it worked before).

In other terms :

if I put this in my product class definition :
    def __call__(self) :
        ...
    index_html = None    
    
    this gives me :
    
      <dtml-var MyInstance> ==> renders correctly
      <dtml-in "objectValues(['MyClass'])">
        <dtml-var oneMethod> ==> works correctly
      </dtml-in>
      <dtml-with MyInstance>
        <dtml-var oneMethod> ==> searches oneMethod in the container 
      </dtml-with>               and doesn't find it so doesn't work
      
and if I put this instead :      

    def index_html(self) :
        ...
        
    it gives me :
    
      <dtml-var MyInstance> ==> renders incorrectly as 
                                <MyClass instance at ffeeddcc>
      <dtml-in "objectValues(['MyClass'])">
        <dtml-var oneMethod> ==> works correctly
      </dtml-in>
      <dtml-with MyInstance>
        <dtml-var oneMethod> ==> works correctly 
      </dtml-with>               
    
So my question is : is it possible to have the best of both worlds ?    

I want <dtml-var MyInstance> to render it as HTML, and I want to
be able to call some instances methods inside a <dtml-with>.

Toby also told me to double quote my instance's id, which works
but how can I delete these double quotes and make it still work ?

Thanks in advance for any help or pointer.

Jerome Alet