Hi James,

James Bennett schrieb:
> On 8/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> The committer russelm said: Template variable evalution should follow Python 
>> norms.
>
> As I understand it, the distinction is between the string 'False' and
> the boolean False.
>
> In other words, if you pop open a Python shell and do this:
>
>>>> 'False' is False
> False
>
> You find that they're not the same -- 'False' is a non-empty string of
> characters and in boolean comparisons evaluates True. False (without
> quotes) is a constant which always evaluates False.
>

I would agree if you take 'False' as a real string which shouldn't evaluate to 
False, but I had the following templatetag called:

{% mytag "some string" False %}

Which now resolved in an error:

Traceback (most recent call last):
File "/usr/local/lib/python2.4/site-packages/django/template/__init__.py" in 
render_node
  702. result = node.render(context)
File "/usr/local/lib/python2.4/site-packages/django/template/__init__.py" in 
render
  830. resolved_vars = [resolve_variable(var, context) for var in 
self.vars_to_resolve]
File "/usr/local/lib/python2.4/site-packages/django/template/__init__.py" in 
resolve_variable
  653. raise VariableDoesNotExist, "Failed lookup for key [%s] in %r" % 
(bits[0], current) # missing attribute

  VariableDoesNotExist at /ais/quittung/user/list/
  Failed lookup for key [False] in 

As I read the code the ' or " signs are remove later in the code and return the 
resulting string. So 'False' would return the String False and False could not 
be resolved and won't return String False.

I thing that it is a bug. And the changeset should be re-reverted to fix this. 
In the other way with context_processors defining global variables False and 
True variables this can be solved :)

Regards,
Dirk
-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to