[Zope] still problem with dtml-with

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 25 Jul 2002 09:43:37 +0100


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 o=
n=20
which they operate. dtml-var stuffs the value into its output, and dtml-w=
ith=20
stuffs the value onto the stack.

If you need <dtml-var x> to give a string prestentation of the object, an=
d=20
<dtml-with x> to give you access to the object's properties (rather than=20
those of the string) then x needs a __str__

Another option is to add a method which returns the string, so you have t=
o=20
render it as <dtml-var myinstance fmt=3Dmymethod>.

You havent really explained that this class is, and what behaviour you wa=
nt=20
from these different operations, so its hard to give overall good advice.