Mixing ZPT and DTML in CMF
I know that ZPT and dtml-should not be mixed together, but I am moving old site from dtml to ZPT in CMF and wanted to test around, a couple of things. I stumbled into a strange behaviour when I wanted to use portal_url-tool in on of my dtml-piece that was later on included into a ZPT-template. In ZPT I include the file in the following way: <span tal:replace="structure container/navbar">Navigation bar</span> navbar is a DTML-method, in which I state: <dtml-let osoite1="portal_url" path="_.str(osoite1)+'/'" > Which makes no sense, since osoite1 will be an istance or URLTool. Meaning when I view the DTML-method it will show something like <URLTool instance at 906d7a8> But when that is included into the ZPT it will transform into the absolute url. Great. First I tried to use in dtml portal_url() which actually made it work in the DTML, but caused TALES-error in ZPT. ... Now my question is, that can anyone share any wisdow from where this behaviour comes from? I will be moving from the DTML later on, but for now it would be nice to know. -huima
Heimo Laukkanen writes:
.... <dtml-let osoite1="portal_url" path="_.str(osoite1)+'/'" >
Which makes no sense, since osoite1 will be an istance or URLTool. The problem will go away, when you use
<dtml-let osite1=portal_url path="osoite1+'/'" > "portal_url" is an object without custom "__str__" method, therefore "str(portal_url)" results in "<URL Tool instance ...>". However, "portal_url" is designed to be called to return the URL. As using "portal_url" as a DTML name rather than an expression (that's what the missing "..." above mean) entails calling (if possible) you get assign the URL and not the object. Dieter
participants (2)
-
Dieter Maurer -
Heimo Laukkanen