[Zope-dev] patch for &dtml-foo:bar:baz;

Jon Franz jfranz@one.net
Fri, 18 Aug 2000 14:19:39 -0400


This may, or may not, break the alternate syntax patch/download @
http://www.zope.org/Members/Coventry/dtml_shortcut
I'll investigate and find out, and release a new dtml_shortcut if needbe.
(I specifically used a colon since it is valid xml) What about using a colon
as the separator, but explicitly give the tag the name dtml-root?
<dtml-root foo:bar:childofbar>

having a whole tag of type ':' seems weird (in addition to possibly breaking
current patches and such ;)

if we didn't want the root to be the default we could use something like
<dtml-trans [path]:[path]> with something like _root or __root being set
aside as a special name for starting at the root (otherwise it would start
in the current directory)...?


>>>
This patch changes lib/python/DocumentTemplate/DT_HTML.py so that you
can use paths for traversal in DTML entity syntax. The delimiter is ':',
as it is valid as part of an XML entity, but not valid as part of a Zope
object id.

You can use &dtml-:foo:bar; to ensure that traversal occurs from the
root object.

This patch is against Zope 2.2.1b1. It relies on the
restrictedTraverse() api.

A 2.1.x version would be possible, but would be rather messy.
<<<