[Zope] python: calling DTML-methods without quoting

Chris Withers chris at simplistix.co.uk
Tue Oct 4 13:01:42 EDT 2005


Chris wrote:
> I hope this is not a FAQ, but I looked for some info to no avail.

And my answer to this FAQ, as always, is "use ZPT".

> If I call a DTML-Method from an other Method (e.g. <dtml-var someDTML>), 
>  HTML entities are not converted.

This is calling and rendering whatever someDTML is...

> However if I call it from python (e.g. <dtml-var "somePath.someDTML"> 
> the entities are html_quoted.

This is likely inserting a python repr of whatever somePath.someDTML 
resolves too...

> This changed with Zope 2.7.x (?). Before that DTMLMethods were not 
> quoted when called from python.

Where are you calling one from python?

> I know the easy workaround is to dtml-with to the namespace of the 
> object and call it the zope-way.

Huh?

> I have a customer with several large applications which run on an old 
> Zope only for the described reason. The applications relay heavily on 
> calling DTML-Methods to include pieces of HTML, JavaScript, etc. 
> Changing the old code would be an enormous effort.

...but likely worth it in the long run ;-)

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope mailing list