Django

Code

Changeset 5048

Show
Ignore:
Timestamp:
04/20/07 23:13:52 (2 years ago)
Author:
mtredinnick
Message:

Fixed #4098 -- fixed a syntax error when reporting errors in "with" template
tag. Thanks cephelo@gmail.com.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/template/defaulttags.py

    r4909 r5048  
    991991    Add a value to the context (inside of this block) for caching and easy 
    992992    access. 
    993      
     993 
    994994    For example:: 
    995995 
     
    10001000    bits = list(token.split_contents()) 
    10011001    if len(bits) != 4 or bits[2] != "as": 
    1002         raise TemplateSyntaxError, "%r expected format is 'value as name'" % tagname 
     1002        raise TemplateSyntaxError, "%r expected format is 'value as name'" % bits[0] 
    10031003    var = parser.compile_filter(bits[1]) 
    10041004    name = bits[3] 
  • django/trunk/tests/regressiontests/templates/tests.py

    r4901 r5048  
    655655            'with02': ('{{ key }}{% with dict.key as key %}{{ key }}-{{ dict.key }}-{{ key }}{% endwith %}{{ key }}', {'dict': {'key':50}}, ('50-50-50', 'INVALID50-50-50INVALID')), 
    656656 
     657            'with-error01': ('{% with dict.key xx key %}{{ key }}{% endwith %}', {'dict': {'key':50}}, template.TemplateSyntaxError), 
     658            'with-error02': ('{% with dict.key as %}{{ key }}{% endwith %}', {'dict': {'key':50}}, template.TemplateSyntaxError), 
     659 
    657660            ### NOW TAG ######################################################## 
    658661            # Simple case