Is it considered gauche to revive old topics such as this? After having
some difficulty debugging why an if statement was throwing a strange error,
I realized it was because they didn't support multi-line statements.
Here's what I was trying:
{% if request.xxx.family.get_selected.get_age < program
or request.xxx.family.get_selected.get_age > program.max_age %}
Fairly simple stuff. Keeping this on a single line gets unwieldy, yet the
logic isn't nearly convoluted enough that it should be de-facto moved
elsewhere. It seems a bit more pythonic to split to multiple lines.
On Monday, February 27, 2012 9:37:56 AM UTC-5, Ned Batchelder wrote:
>
> On 2/26/2012 12:12 AM, Yo-Yo Ma wrote:
> > After Ned's message, I'm -0, because while I'm not fond of multi-line
> > tags, I cannot offer a good alternative when it comes to multi-line
> > "with" tags.
> >
> > On Feb 25, 6:48 pm, Ned Batchelder<[email protected]> wrote:
> >> On 2/24/2012 11:55 PM, Yo-Yo Ma wrote:> I'm -1 on this for s specific
> reason; If you need multiple lines for a
> >>> tag, you're doing it wrong.
> >>>>>> import this
> >> This would be far more helpful feedback if you would take the examples
> >> of too-long tags presented in this thread, and show the "right" way to
> >> do it.
> >>
> >> --Ned.
> While I'm glad to see people being open to changing their minds, it
> worries me that none of the "one-line tag" aesthetes have spoken up to
> explain how they would deal with the unwieldy constructions that started
> this thread. In fact, so far two people have changed their minds when
> actually grappling to come up with an answer.
>
> What is the right way to do this:
>
> {% trans with
> varname=myobject.proprety1
> someothervar=myobject.some.other_property
> yetanothervar=myotherobject.with_a_painfully_long_method_name
> "Even with line-wrap, it's a pain to read on a single line."
> %}
>
> or
>
> {% blocktrans with
> originator=entry.originator|get_really_full_name:"mailto"
> link=entry.get_metadata.link
> task_id=entry.task.idprocess_name=entry.task.process_class|contenttype_name %}
>
> Powers-that-be declaring, "X is ugly and won't happen" is inevitable,
> but we should be able to extend the answer with "and Y is the way to do
> it better?"
>
> --Ned.
>
>
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.