Django

Code

Show
Ignore:
Timestamp:
08/15/08 16:08:11 (4 months ago)
Author:
gwilson
Message:

Fixed #5270 -- Allow template tags and filters to accept an emtpy string, patch from jdunck.

Files:

Legend:

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

    r7580 r8393  
    486486            if var == None: 
    487487                var, constant, i18n_constant = match.group("var", "constant", "i18n_constant") 
    488                 if i18n_constant: 
    489                     var = '"%s"' %  _(i18n_constant.replace(r'\"', '"')) 
    490                 elif constant: 
     488                if i18n_constant is not None: 
     489                    # Don't pass the empty string to gettext, because the empty 
     490                    # string translates to meta information. 
     491                    if i18n_constant == "": 
     492                        var = '""' 
     493                    else: 
     494                        var = '"%s"' %  _(i18n_constant.replace(r'\"', '"')) 
     495                elif constant is not None: 
    491496                    var = '"%s"' % constant.replace(r'\"', '"') 
    492497                upto = match.end()