[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
I've updated http://dev.zope.org/Zope3/TALESPathExpressionAdapters based on comments to date. I think we are narrowing down on a short syntx of the form: ob/##adaptername where '#' is some character. See the proposal for reasons. I've also given the current status there. Jim Jim Fulton wrote: Jim Fulton wrote: I've posted two proposals: http://dev.zope.org/Zope3/TALESPathExpressionAdapters Proposes a mechanism for easily using adapters in TALES expressions. http://dev.zope.org/Zope3/ZPTVariableNamespaces proposes a mechanism for qualifying names defined in TAL and used in TALES expressions. Based on initial comments, I've retracted ZPTVariableNamespaces and updated: http://dev.zope.org/Zope3/TALESPathExpressionAdapters I've thrown out a few more spellings for adapter use: ob->adaptername context->dc/title ob~adaptername context~dc/title ob[adaptername] context[dc]/title Of course, Steve suggested: ob:adaptername context:dc/title So far the cast syntax seems to be the most popular: (adaptername)ob (dc)context/title with one dissension. :) One disadvantage I see with the cast notation is that it's a bit jarring in: a/b/(adapter)c/d as the adapter is applied to a/b/c. The order just doesn't seem quite right. I'd love to get more feedback or suggestions for the syntax. As far as in-template definition, I'd like to borrow from Evan's work and allow 'adapter' to be used like 'local' or 'global' in tal:define: tal:define="adapter dc modules/zope.app.dublincore/IZopeDublinCore" Thoughts? Jim P.S. Thanks for all the comments so far. :) -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
Chris Withers wrote: How does: "take adapter, apply to it object with name as a parameter" That's close to the meaning of Even Simpson's Zope 2 ':' extension. Which is why we don't want to use this syntax for adapters. ...differ from: Well, what we did in bristol, enabled: my_content_object/zope:title Which really gets a special adapter named "zope" which exposes zapi-like functionality for ZPT. what we did doesn't supply title as a paramter to the adapter. ... Steve pointed out some problems with the syntax, which the above examples should make obvious. ... "Don't suppose you have a URL for that off hand?" http://dev.zope.org/Zope3/TALESPathExpressionAdapters Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
How does: "take adapter, apply to it object with name as a parameter" That's close to the meaning of Even Simpson's Zope 2 ':' extension. Which is why we don't want to use this syntax for adapters. ...differ from: Well, what we did in bristol, enabled: my_content_object/zope:title Which really gets a special adapter named "zope" which exposes zapi-like functionality for ZPT. ? I'm afraid neither of those means anything to me so your equivalency makes so sense :-S right, which is why we want to pick a different syntax. When I understand the difference, I hope I'll agree :-) Steve pointed out some problems with the syntax, which the above examples should make obvious. Hurm :-S Don't suppose you have a use for that off hand? Use for what? I wish I could excuse that as a typo :-S "Don't suppose you have a URL for that off hand?" cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
Chris Withers wrote: Jim Fulton wrote: Yup. We implemented: ob/adapter:name ...which to me says: "take adapter, apply to it object with name as a parameter" That's close to the meaning of Even Simpson's Zope 2 ':' extension. Which is why we don't want to use this syntax for adapters. ...what I'd like it to say would give meaning to: my_content_object/zapi:title ...meaning apply the title adapter from the zapi package to my_content_object, which was where I left things last time I came close to understanding Zoppe 3. Well, what we did in bristol, enabled: my_content_object/zope:title Which really gets a special adapter named "zope" which exposes zapi-like functionality for ZPT. What's the equivalent to that in today's Zope 3 land? What I described still works. But we want to pick a different syntax, like: my_content_object#zope/title which is equivalent to: ob/adapter:/name and, in fact, you can say just: ob/adapter: I'm afraid neither of those means anything to me so your equivalency makes so sense :-S right, which is why we want to pick a different syntax. Steve pointed out some problems with the syntax, which the above examples should make obvious. Hurm :-S Don't suppose you have a use for that off hand? Use for what? Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
Jim Fulton wrote: Yup. We implemented: ob/adapter:name ...which to me says: "take adapter, apply to it object with name as a parameter" ...what I'd like it to say would give meaning to: my_content_object/zapi:title ...meaning apply the title adapter from the zapi package to my_content_object, which was where I left things last time I came close to understanding Zoppe 3. What's the equivalent to that in today's Zope 3 land? which is equivalent to: ob/adapter:/name and, in fact, you can say just: ob/adapter: I'm afraid neither of those means anything to me so your equivalency makes so sense :-S Steve pointed out some problems with the syntax, which the above examples should make obvious. Hurm :-S Don't suppose you have a use for that off hand? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
Chris Withers wrote: ... I thought we had this whole discussion about 1-2 years ago, and I REMEMBER writing CODE for this back then that involved : as the adapter indicator. Yup. We implemented: ob/adapter:name which is equivalent to: ob/adapter:/name and, in fact, you can say just: ob/adapter: Why are we having this whole discussion again? Steve pointed out some problems with the syntax, which the above examples should make obvious. Was there something wrong with the code? :-S Nope. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
Garrett Smith wrote: I want to thank everyone who's participating in this thread. The input is extremely valuable. This might get an award for longest thread before The Edict is handed down ;) Yeah, and I have to admit being a bemused bystander... I thought we had this whole discussion about 1-2 years ago, and I REMEMBER writing CODE for this back then that involved : as the adapter indicator. Why are we having this whole discussion again? Was there something wrong with the code? :-S Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
Garrett Smith wrote: What was the reasoning behind selecting @@ for the view namespace shortcut? (IIRC, the motivation was to use characters that could be used in URLs, but I'm not sure that's an issue for adapters...or is it?) Legal in urls, no English. @@ looks like two eyes viwing something. :) Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
On Friday 28 May 2004 11:21, Garrett Smith wrote: > What was the reasoning behind selecting @@ for the view namespace > shortcut? Because it looks like two eyes. > (IIRC, the motivation was to use characters that could be used > in URLs, but I'm not sure that's an issue for adapters...or is it?) That was one consideration; there was extensive research done on which characters would be permissible. I do not think we have the same issue with the adapters though. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
On Friday 28 May 2004 11:21, Garrett Smith wrote: > context/##dc/title Not so good; looks convoluted. > context/**dc/title This one looks good. Remind me of the power of a number, like dc takes over context. :-) > context/::dc/title I am fine with this one as well. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
On Friday 28 May 2004 02:48, Philipp von Weitershausen wrote: > Garrett Smith wrote: > > This problem seems analogous to view lookup -- > > "content/++view++index.html" and "content/@@index.html" are equivalent. > > > > So, applied to adapters, we could use: > > > > content/++adapter++dc/title (or '++adapt++') > > +1 on ++adapt++. > > I think using the the traversal machinery and its syntax would be a very > elegant solution. Then using either ##, ** or :: as a shortcut (in > analogy to @@) would be even more consistent, since in current > component-architecture-speak, views are multi-adapters. > > Just compare them visually: > > - context/@@absolute_url +1 -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
On Thu, May 27, 2004 at 10:00:50PM +0200, Tonico Strasser wrote: > Jim Fulton wrote: > >On IRC, Martijn Faassen suggested (brainstormed really :) '#', as in: > > > > context#dc/title > > > >I like this becase # kinda looks like a special kind of slash. :) Looks ok to me. > Hm, special kind of slash ... what about > > context\dc/title -1. I see \d and automatically read it as "escape d". -- Paul Winkler http://www.slinkp.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
Casey Duncan wrote: On Fri, 21 May 2004 09:07:24 -0400 Jim Fulton <[EMAIL PROTECTED]> wrote: Jim Fulton wrote: I've posted two proposals: http://dev.zope.org/Zope3/TALESPathExpressionAdapters Proposes a mechanism for easily using adapters in TALES expressions. http://dev.zope.org/Zope3/ZPTVariableNamespaces proposes a mechanism for qualifying names defined in TAL and used in TALES expressions. Based on initial comments, I've retracted ZPTVariableNamespaces and updated: http://dev.zope.org/Zope3/TALESPathExpressionAdapters I've thrown out a few more spellings for adapter use: ob->adaptername context->dc/title Hmm, C style, kinda nice, except the use of angle brakets might make like difficult. ">" is not a problem. "<" would be a probkem. It really is hard for me to see the intended order of execution of this as well. It reads "context to dublin core, get title". That's exactly right. The order, left to right, is very simple. The problem with: (dc)context/title is that the order is: skip one, right to left, then left to right. The order is more complicated, except that there is an alternative left to right interpretation ... Having dublin core go first makes more sense to me so it would read "with the dublin core of context, get title". So, here you thinking of this as: start with the dublin core protocol adapt it from context get title ... One disadvantage I see with the cast notation is that it's a bit jarring in: a/b/(adapter)c/d as the adapter is applied to a/b/c. The order just doesn't seem quite right. It's all in the eye of the beholder I guess. This says to me "d of c (modified by adapter) of b of a". Wow :) But this seems wrong. It's really "(c of b of a) modified by adapter". Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
On Wed, 19 May 2004 17:01:57 -0400 Jim Fulton <[EMAIL PROTECTED]> 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 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces
Casey Duncan wrote: On Wed, 19 May 2004 16:00:43 -0400 Jim Fulton <[EMAIL PROTECTED]> wrote: I've posted two proposals: http://dev.zope.org/Zope3/TALESPathExpressionAdapters I have to say I am not found of "*", I'm not attached to '*'. Feel free to suggest alternatives (other than ':', '/', '|', or '?'. Is that all ;) > but using the parenthesis to "cast" the variable seems fairly natural and isn't colored by completelt different meaning in other languages. So the example: tal:content="x/y*foo.bar.baz/z" would be: tal:content="x/(foo.bar.baz)y/z" Yup 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. 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. :) 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. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )