On Thursday 25 Jul 2002 9:18 am, Jerome Alet wrote:
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).
Both dtml-with and dtml-var use the same mechanism to compute the value on which they operate. dtml-var stuffs the value into its output, and dtml-with stuffs the value onto the stack. If you need <dtml-var x> to give a string prestentation of the object, and <dtml-with x> to give you access to the object's properties (rather than those of the string) then x needs a __str__ Another option is to add a method which returns the string, so you have to render it as <dtml-var myinstance fmt=mymethod>. You havent really explained that this class is, and what behaviour you want from these different operations, so its hard to give overall good advice.