On Wed, 19 May 2004 17:01:57 -0400 Jim Fulton <jim@zope.com> wrote:
Casey Duncan wrote: [..]
Which seems reasonable. The dotted notation seems ok, but it implies that this notation is recognized in general in path expressions which is confusing because it isn't. If we didn't use dots then it might look like: tal:content="x/(modules/foo/bar/baz)y/z"
I'm not sure what you mean here. If the thing in the parens was a path expression, it would be:
x/(modules/foo.bar/baz)y/z
IOW, modules excepts dotted names.
It does already you mean? I did not know that. Seems a bit weird, but I can see why. Not sure I could explain it to a ZPT newbie without making their head cave in though...
If the thing in the parenthesis is just another path expression, that mitigates the need for namespaces IMO. The above could then become: tal:define="baz modules/foo/bar/baz" tal:content="x/(baz)y/z"
True, but then, the obvious syntax would be:
x/baz(y)/z
which is the top of a slippery slope. :)
Tempting but no way ;^). I still think "(baz)y" is pretty good. "baz(y)" is a big ole can o' knarly worms.
It would also make it harder to provide predefined adapter names.
We'd like to be able to define some adapters (e.g. 'zope', 'format', etc.) in ZCML and let people just use them in ZPT without having to use defines.
Ok, I see better the reasoning. Why not just have a new top-level name like "adapters" or "adapt" so that we can avoid new language constructs? That might also make it easier to read and only a bit more verbose. So adapters would be a mapping of registered name=>adapter object. So the above could be: tal:content="x/(adapters/baz)y/z" That puts the adapters all in one big bag, but honestly I think it is manageable. If desired, the adapters could be categorized through traversal: tal:content="x/(adapters/zope/frobnob)y/z" This seems nice and explicit to me. I don't mind typing the word "adapters" and it's clear that it is one even if I'm not familiar with the casting syntax. If I used it alot in one template I could just do: tal:define="frobnob adapters/zope/frobnob" -Casey