Ticket #5885: template_simple_tag_i18n_fix.diff
File template_simple_tag_i18n_fix.diff, 968 bytes (added by , 17 years ago) |
---|
-
django/template/__init__.py
127 127 self.params = params 128 128 129 129 def __str__(self): 130 return self.msg % self.params 131 130 try: 131 return self.msg % self.params 132 except UnicodeDecodeError: 133 return self.msg % (self.params[0],str(self.params[1])) 134 132 135 class InvalidTemplateLibrary(Exception): 133 136 pass 134 137 … … 692 695 if var[0] in "\"'" and var[0] == var[-1]: 693 696 self.literal = var[1:-1] 694 697 698 elif var[0:2] == "_(" and var[-1] == ")": 699 self.literal = _(re.match("\_\(['\"]([^'\"]+)['\"]\)",var).group(1)) 700 695 701 else: 696 702 # Otherwise we'll set self.lookups so that resolve() knows we're 697 703 # dealing with a bonafide variable