[Zope] Re: Adding Custom Namespaces to ZPT?
Hartmut Goebel
h.goebel@crazy-compilers.com
Mon, 09 Jun 2003 21:42:17 +0200
Evan Simpson schrieb:
> For the most part, yes, but additional namespaces didn't occur to us
> when implementing ZPT, and it is hardly trivial to define how such
> extensibility should work.
After having a look into TALInterpreter.py I think a have a clue, why
this is complicated. *sign*
Otherwise: TALInterpreter uses bytecode_handlers, thus adding new
bytecodes should be quite easy. So the only problem being left (as far
as I can see) is: how to make adding bytecodes or namespaces extensible.
Meanwhile I tried something different: I patched HTMLTALParser.py and
ZopePageTemplate/__init__.py to recognice namespaces. One may pass a
dict of namespaces to PageTemplate(). If a tag's prefix belongs to a
namespace listed here, the tag get patched into somthing like
<metal:block
tal:define="year string:'1999'"
tal:content="python:namspaces['hg'].copyright(year=year)"
/>
Quite a hack, but works :-) Do you want to get the patch?
Never the less I would prefere a really expantable solution.
> but most of them are not
> integrated with Zope.
It seams as if I have bad luck on this topic.
Regards
+++hartmut
--
| Hartmut Goebel | We build the crazy compilers |
| h.goebel@crazy-compilers.com | Compiler Manufacturer |