Re: [Zope-dev] TALES idea: tuple unpacking
Fred L. Drake, Jr. wrote: - Use a Python-like sequence unpacking syntax. This is probably most comfortable to template authors who are Python programmers first, and web guys (or gals!) second. -0 for feature creap - Use the namespace qualifiers to get an adapter to handle converting container lookup to a sequence indexing operation. This plays off the machinery being built anyway, so is quite attractive, and doesn't affect the basic syntax or implementation of TAL, but only of the TALES expression engine. This is very attractive because it pushes the support for this feature somewhere the application controls in as much detail as it wants. +1 'cos I like the way this leverages the stuf we added to TALES at the last UK sprint... cheers, Chris ___ 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 )
Re: [Zope-dev] TALES idea: tuple unpacking
Gilles Lenfant writes: > I'm interrested into adding some other wishes for the next ZPT versions. > Where could those wishes be posted ? This is the place. There's only very limited resources available at Zope Corp to make changes happen right now, so be prepared to help make changes if there's concensus that your proposal should be accepted. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation ___ 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 )
Re: [Zope-dev] TALES idea: tuple unpacking
Paul Winkler writes: > In this case, consider a trivial change to (or wrapper around) > listFilesByUser to make it return a sequence of dictionaries > like {'user': some_user, 'files': (file1, file2...)} This is exactly what the proposal I posted a couple of weeks ago was trying to avoid. While adding another layer of indirection around the actual call to listFilesByUser() isn't all that costly, these things add up, especially since so many temporary objects are getting created and thrown away. I know for Zope 3, we'd like to get away from having to write a view class simply to hook up helpers like this when something simpler would do. So far, two distinct approaches have been presented, with minor variations for each. I won't go into the variations, but the two approaches are: - Use a Python-like sequence unpacking syntax. This is probably most comfortable to template authors who are Python programmers first, and web guys (or gals!) second. - Use the namespace qualifiers to get an adapter to handle converting container lookup to a sequence indexing operation. This plays off the machinery being built anyway, so is quite attractive, and doesn't affect the basic syntax or implementation of TAL, but only of the TALES expression engine. This is very attractive because it pushes the support for this feature somewhere the application controls in as much detail as it wants. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation ___ 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 )
Re: [Zope-dev] TALES idea: tuple unpacking
Yes, this would be more comfortable, some of my templates would be cleaner with this feature. You may work this around like this... with someScript ending with... return foo, bar I'm interrested into adding some other wishes for the next ZPT versions. Where could those wishes be posted ? Cheers --Gilles ___ 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 )
Re: [Zope-dev] TALES idea: tuple unpacking
Say a method listFilesByUser returns a list of (user, [files]) it'd be nice to be able to:: tal:repeat="user,files here/listFilesByUser" or similar. Currently we would have to use a python: expression to manually unpack the tuple. Kinda yucky. yeah, or make listFilesByUser return {'username': user, 'files': files} and:: also not ideal. I think the format in your example works well. -- Jean Jordaan http://www.upfrontsystems.co.za ___ 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 )
Re: [Zope-dev] TALES idea: tuple unpacking
On Wed, Jul 23, 2003 at 03:59:58PM +1000, Richard Jones wrote: > Say a method listFilesByUser returns a list of (user, [files]) > it'd be nice to > be able to:: > >tal:repeat="user,files here/listFilesByUser" > > or similar. Currently we would have to use a python: expression to manually > unpack the tuple. Kinda yucky. > > Any comments? hmm... so you want to extend the language so you can write: user goes here file goes here I disagree... There's probably a million little things that "would be nice" in ZPT. Rather than feature-creep TAL/TALES, which are pretty simple currently, let's leave the heavy lifting to our favorite tried-and-true general-purpose language. In this case, consider a trivial change to (or wrapper around) listFilesByUser to make it return a sequence of dictionaries like {'user': some_user, 'files': (file1, file2...)} Then your zpt could look like: user goes here file goes here -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's TWINKLY-GIANT WOMAN! (random hero from isometric.spaceninja.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] TALES idea: tuple unpacking
During the Melbourne Zope3 Sprint, someone ran up against a situation where they'd have liked to have TALES perform a tuple unpacking like Python can. I've just run into a similar situation :) Say a method listFilesByUser returns a list of (user, [files]) it'd be nice to be able to:: tal:repeat="user,files here/listFilesByUser" or similar. Currently we would have to use a python: expression to manually unpack the tuple. Kinda yucky. Any comments? Richard pgp0.pgp Description: signature