Changeset 8393
- Timestamp:
- 08/15/08 16:08:11 (4 months ago)
- Files:
-
- django/trunk/django/template/__init__.py (modified) (1 diff)
- django/trunk/tests/regressiontests/templates/tests.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/template/__init__.py
r7580 r8393 486 486 if var == None: 487 487 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: 491 496 var = '"%s"' % constant.replace(r'\"', '"') 492 497 upto = match.end() django/trunk/tests/regressiontests/templates/tests.py
r8211 r8393 366 366 # Numbers as filter arguments should work 367 367 'filter-syntax19': ('{{ var|truncatewords:1 }}', {"var": "hello world"}, "hello ..."), 368 369 #filters should accept empty string constants 370 'filter-syntax20': ('{{ ""|default_if_none:"was none" }}', {}, ""), 368 371 369 372 ### COMMENT SYNTAX ######################################################## … … 771 774 'i18n15': ('{{ absent|default:_("Password") }}', {'LANGUAGE_CODE': 'de', 'absent': ""}, 'Passwort'), 772 775 'i18n16': ('{{ _("<") }}', {'LANGUAGE_CODE': 'de'}, '<'), 776 'i18n17': ('{{ _("") }}', {'LANGUAGE_CODE': 'de'}, ''), 773 777 774 778 # Escaping inside blocktrans works as if it was directly in the 775 779 # template. 776 'i18n1 7': ('{% load i18n %}{% blocktrans with anton|escape as berta %}{{ berta }}{% endblocktrans %}', {'anton': 'α & β'}, u'α & β'),777 'i18n1 8': ('{% load i18n %}{% blocktrans with anton|force_escape as berta %}{{ berta }}{% endblocktrans %}', {'anton': 'α & β'}, u'α & β'),780 'i18n18': ('{% load i18n %}{% blocktrans with anton|escape as berta %}{{ berta }}{% endblocktrans %}', {'anton': 'α & β'}, u'α & β'), 781 'i18n19': ('{% load i18n %}{% blocktrans with anton|force_escape as berta %}{{ berta }}{% endblocktrans %}', {'anton': 'α & β'}, u'α & β'), 778 782 779 783 ### HANDLING OF TEMPLATE_STRING_IF_INVALID ###################################
