Re: smart if tag

2009-12-09 Thread Luke Plant
On Wednesday 09 December 2009 12:43:04 Russell Keith-Magee wrote: > I've done another review, and it's looking pretty good. I have > three relatively minor comments: > > * There is what appears to be vestigial documentation around line > 346 of ref/templates/builtins.txt; it says evaluation or

Re: smart if tag

2009-12-09 Thread Russell Keith-Magee
On Wed, Dec 9, 2009 at 9:17 AM, Luke Plant wrote: > Hi all, > > I've now addressed everything in Russell's last e-mail, I think, so I > think I'm pretty much good to go, apart from: > > 1) my last change rewrote a lot of IfParser, which was the heart of > the patch. That means it probably needs lo

Re: smart if tag

2009-12-08 Thread Luke Plant
Hi all, I've now addressed everything in Russell's last e-mail, I think, so I think I'm pretty much good to go, apart from: 1) my last change rewrote a lot of IfParser, which was the heart of the patch. That means it probably needs looking at again! On the other hand, the new implementation is

Re: smart if tag

2009-12-06 Thread Alex Gaynor
The undcoumented scanner class in the regex module may interest you: http://code.activestate.com/recipes/457664/ Alex On Sun, Dec 6, 2009 at 3:32 AM, SmileyChris wrote: > Because that link intrigued me, I challenged myself to write my own > generic lexer & parser based on what I had read: > http

Re: smart if tag

2009-12-06 Thread SmileyChris
Because that link intrigued me, I challenged myself to write my own generic lexer & parser based on what I had read: http://gist.github.com/250128 On Dec 6, 2:07 pm, Luke Plant wrote: > On Saturday 05 December 2009 20:09:21 Luke Plant wrote: > > > I'm not likely to able to look at this before T

Re: smart if tag

2009-12-05 Thread Luke Plant
ntents == 'else': @@ -853,7 +831,7 @@ parser.delete_first_token() else: nodelist_false = NodeList() - return IfNode(boolvars, nodelist_true, nodelist_false, link_type) +return IfNode(var, nodelist_true, nodelist_false) do_if = register.tag("if",

Re: smart if tag

2009-12-05 Thread Luke Plant
First, thanks for your review Russell, I appreciate that you've been doing tons of work on lots of things! On Saturday 05 December 2009 15:39:03 Russell Keith-Magee wrote: > Here's the review I promised. First the minor points: > > * Line 814 of templates/defaulttags.py has a wierd UTF-8 chara

Re: smart if tag

2009-12-05 Thread Russell Keith-Magee
On Tue, Dec 1, 2009 at 9:55 AM, Russell Keith-Magee wrote: > On Tue, Dec 1, 2009 at 1:08 AM, Luke Plant wrote: >> Patch >> = >> >> Review would be welcome, especially as I'm ill at the moment. I'm only >> coding because the boredom of doing nothing is killing me... > > I'll try and take a loo

Re: smart if tag

2009-11-30 Thread Russell Keith-Magee
On Tue, Dec 1, 2009 at 1:08 AM, Luke Plant wrote: > On Monday 30 November 2009 11:18:13 Russell Keith-Magee wrote: > >> > 1) Handling non-existent variables >> > == > So, I'm *now* suggesting that we convert everything missing to None. Sounds good to me. > Behavio

Re: smart if tag

2009-11-30 Thread Luke Plant
On Monday 30 November 2009 20:27:32 SmileyChris wrote: > On Dec 1, 6:08 am, Luke Plant wrote: > > Given that the 'Null' stuff has now been removed, we could > > move back to your way to reduce the code a bit, but I'm not sure > > it is worth it. > > I'd say reduce the code again. I've removed Le

Re: smart if tag

2009-11-30 Thread SmileyChris
On Dec 1, 6:08 am, Luke Plant wrote: > Given that the 'Null' stuff has now been removed, we could > move back to your way to reduce the code a bit, but I'm not sure it is > worth it. I'd say reduce the code again. And I think you missed adding some files in your repo? -- You received this mes

Re: smart if tag

2009-11-30 Thread SmileyChris
On Dec 1, 6:08 am, Luke Plant wrote: > > I was with you right up until the equality comparisons (Null == > >  Null -> False etc). As noted by Alex, it conflicts with the answer > >  given by {% ifequal %}; it also differs with Python's behavior. > > Yeah, I hadn't thought of that. I don't think it

Re: smart if tag

2009-11-30 Thread Luke Plant
On Monday 30 November 2009 11:18:13 Russell Keith-Magee wrote: > > 1) Handling non-existent variables > > == ... > > To do this properly, I think the best approach would be something > > like "almost three valued logic", which would work as follows: > > > > 1) varia

Re: smart if tag

2009-11-30 Thread Russell Keith-Magee
, just needs a bit more work. I was with you right up until the equality comparisons (Null == Null -> False etc). As noted by Alex, it conflicts with the answer given by {% ifequal %}; it also differs with Python's behavior. > 2) TEMPLATE_STRING_IF_INVALID breaks everything >

Re: smart if tag

2009-11-29 Thread SmileyChris
On Nov 29, 6:40 am, Luke Plant wrote: > Hi all, > > I started work replacing Django's if with the "smart-if" template tag > by Chris Beaven (http://www.djangosnippets.org/snippets/1350/) Neat! I'm assuming you'll be posting this to your bitbucket soon? :) > 1) Handling non-existent variables > 2

Re: smart if tag

2009-11-28 Thread Alex Gaynor
eeds a bit more work. > Wouldn't that be a break from how {% ifequal %} works? Unless I'm mistaken if you have a nonexistant value there it becomes None, which is equal to None. > 2) TEMPLATE_STRING_IF_INVALID breaks everything > === &g

smart if tag

2009-11-28 Thread Luke Plant
Null. Any comments on this approach? I've started to implement this, and it works OK so far, just needs a bit more work. 2) TEMPLATE_STRING_IF_INVALID breaks everything === The smart 'if' tag allows for filters: {% if articles|length >= 5 %} To