Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-30 Thread Jannis Leidel
> {% for color in patches %} > Bikeshed: {{ color }} > {% default %} > Person who writes the patch decides > {% endfor %} Yay, I decide! Err, decided.. :) There is a patch attached to ticket #6398 that implements "default". Cheers, Jannis

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-30 Thread Eric Holscher
{% for color in patches %} Bikeshed: {{ color }} {% default %} Person who writes the patch decides {% endfor %} I like empty/default or else. Use else if your main target is python people. Use empty or default if your targetting it to designers. It really doesn't matter which.. On Thu, Oct 30,

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-30 Thread Antoni Aloy
2008/10/30 Mike Panchenko <[EMAIL PROTECTED]>: > +1 for {% empty %} > > I also think this would be very useful > > On Thu, Oct 30, 2008 at 6:55 AM, dc <[EMAIL PROTECTED]> wrote: >> >> How about >> >> {% for item in items %} >> {% otherwise %} >> {% endfor %} >> +1 to the otherwise tag :) --

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-30 Thread Mike Panchenko
+1 for {% empty %} I also think this would be very useful On Thu, Oct 30, 2008 at 6:55 AM, dc <[EMAIL PROTECTED]> wrote: > > How about > > {% for item in items %} > {% otherwise %} > {% endfor %} > > form? > > And -1 for the {% else %}. > > > >

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-30 Thread dc
How about {% for item in items %} {% otherwise %} {% endfor %} form? And -1 for the {% else %}. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-29 Thread Steve Holden
Jacob Kaplan-Moss wrote: > I'm with Steve:: > > {% for %} ... {% default %} .. {% endfor %} > > ... seems best. > > Agreement is great, but my suggestion was actually {% for %} ... {% empty %} ... {% endfor %} I feel this says more than "default", which requires you to think about

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-29 Thread Jacob Kaplan-Moss
I'm with Steve:: {% for %} ... {% default %} .. {% endfor %} ... seems best. Jacob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-29 Thread Steve Holden
Calvin Spealman wrote: > On Wed, Oct 29, 2008 at 9:48 PM, Dave Smith <[EMAIL PROTECTED] > > wrote: > > I'm wondering who that's going to confuse. It's very clear that > the template language > isn't Python, so I'd think it'd make the most sense to use a >

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-29 Thread Calvin Spealman
On Wed, Oct 29, 2008 at 9:48 PM, Dave Smith <[EMAIL PROTECTED]> wrote: > I'm wondering who that's going to confuse. It's very clear that the > template language > isn't Python, so I'd think it'd make the most sense to use a keyword that > makes sense > within the context of the template language.

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-29 Thread Dave Smith
I'm wondering who that's going to confuse. It's very clear that the template language isn't Python, so I'd think it'd make the most sense to use a keyword that makes sense within the context of the template language. I'd think that either 'else' or 'ifnone' are the most memorable/readable.

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-29 Thread Ned Batchelder
Yes, you are right! --Ned. Calvin Spealman wrote: > The else clause executes unless a loop is broken (that is, with the > break or obviously by raising an exception), and executes after a loop > ends normally. > > >>> for i in "abc": > ... pass > ... else: > ... print "else" > else > >>> >

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-29 Thread Calvin Spealman
The else clause executes unless a loop is broken (that is, with the break or obviously by raising an exception), and executes after a loop ends normally. >>> for i in "abc":... pass ... else: ... print "else" else >>> On Wed, Oct 29, 2008 at 8:32 PM, Ned Batchelder <[EMAIL PROTECTED]>wrote:

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-29 Thread Ned Batchelder
But this does operate the same as the Python for/else, no? >>> for i in []: ... print "boo" ... else: ... print "foo" ... foo >>> --Ned. http://nedbatchelder.com Calvin Spealman wrote: > On Tue, Oct 28, 2008 at 8:18 PM, oggie rob <[EMAIL PROTECTED] >

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-29 Thread Ivan Sagalaev
Jannis Leidel wrote: > The proposed feature would allow this: > > {% for item in grocery_list %} > {{ item }} > {% default %} > Nothing to buy. > {% endfor %} As of coloring the bikeshed, I prefer {% empty %} over {% default %} and {% else %}.

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-28 Thread Calvin Spealman
On Tue, Oct 28, 2008 at 8:18 PM, oggie rob <[EMAIL PROTECTED]> wrote: > > > {% for item in grocery_list %} > > {{ item }} > > {% default %} > > Nothing to buy. > > {% endfor %} > > Please, though - use {% else %}. Its totally clear what its referring > to and else doesn't mean squat unless

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-28 Thread SmileyChris
Note, that this is actually a dupe of #3481. Regarding, {% else %}, see what Malcolm said about it - http://code.djangoproject.com/ticket/3481#comment:2 On Oct 29, 1:18 pm, oggie rob <[EMAIL PROTECTED]> wrote: > > {% for item in grocery_list %} > >   {{ item }} > > {% default %} > >   Nothing to

Re: Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-28 Thread oggie rob
> {% for item in grocery_list %} >   {{ item }} > {% default %} >   Nothing to buy. > {% endfor %} Please, though - use {% else %}. Its totally clear what its referring to and else doesn't mean squat unless you see what the if (and in this case, for) test is anyway, so I don't think this would

Proposal: Optional {% default %} clause for the {% for %} template tag

2008-10-28 Thread Jannis Leidel
Hi there, I propose a feature which we already discussed a bit before 1.0 in ticket #6398 [1]. It's about a small enhancement to the "for" template tag that would allow users to specify a default item to be shown in case the given iterable is empty. Currently that's also possible with this: {%