Ticket #4292: 4292.diff
File 4292.diff, 2.5 KB (added by , 18 years ago) |
---|
-
django/contrib/contenttypes/models.py
1 1 from django.db import models 2 2 from django.utils.translation import ugettext_lazy as _ 3 from django.utils.encoding import smart_unicode 3 4 4 5 CONTENT_TYPE_CACHE = {} 5 6 class ContentTypeManager(models.Manager): … … 16 17 # The str() is needed around opts.verbose_name because it's a 17 18 # django.utils.functional.__proxy__ object. 18 19 ct, created = self.model._default_manager.get_or_create(app_label=key[0], 19 model=key[1], defaults={'name': s tr(opts.verbose_name)})20 model=key[1], defaults={'name': smart_unicode(opts.verbose_name)}) 20 21 CONTENT_TYPE_CACHE[key] = ct 21 22 return ct 22 23 -
django/utils/functional.py
32 32 self.__dispatch[resultclass] = {} 33 33 for (k, v) in resultclass.__dict__.items(): 34 34 setattr(self, k, self.__promise__(resultclass, k, v)) 35 if unicode in resultclasses: 36 setattr(self, '__unicode__', self.__unicode_cast) 35 37 36 38 def __promise__(self, klass, funcname, func): 37 39 # Builds a wrapper around some magic method and registers that magic … … 47 49 self.__dispatch[klass][funcname] = func 48 50 return __wrapper__ 49 51 52 def __unicode_cast(self): 53 return self.__func(*self.__args, **self.__kw) 54 50 55 def __wrapper__(*args, **kw): 51 56 # Creates the proxy object, instead of the actual value. 52 57 return __proxy__(args, kw) -
django/utils/translation/trans_real.py
510 510 """" 511 511 lazy variant of string concatenation, needed for translations that are 512 512 constructed from multiple parts. Handles lazy strings and non-strings by 513 first turning all arguments to strings, before joining them.513 first turning all arguments to unicode, before joining them. 514 514 """ 515 return ''.join([str(el) for el in strings])516 515 return u''.join([smart_unicode(el) for el in strings]) 516 No newline at end of file