Changeset 5420
- Timestamp:
- 06/03/07 00:35:06 (1 year ago)
- Files:
-
- django/branches/unicode/django/utils/functional.py (modified) (2 diffs)
- django/branches/unicode/django/utils/translation/__init__.py (modified) (1 diff)
- django/branches/unicode/tests/regressiontests/i18n (added)
- django/branches/unicode/tests/regressiontests/i18n/__init__.py (added)
- django/branches/unicode/tests/regressiontests/i18n/models.py (added)
- django/branches/unicode/tests/regressiontests/i18n/tests.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/unicode/django/utils/functional.py
r5344 r5420 33 33 for (k, v) in resultclass.__dict__.items(): 34 34 setattr(self, k, self.__promise__(resultclass, k, v)) 35 if unicode in resultclasses: 35 self._delegate_str = str in resultclasses 36 self._delegate_unicode = unicode in resultclasses 37 assert not (self._delegate_str and self._delegate_unicode), "Cannot call lazy() with both str and unicode return types." 38 if self._delegate_unicode: 36 39 self.__unicode__ = self.__unicode_cast 37 self._delegate_str = str in resultclasses38 40 39 41 def __promise__(self, klass, funcname, func): … … 63 65 return Promise.__str__(self) 64 66 67 def __mod__(self, rhs): 68 if self._delegate_str: 69 return str(self) % rhs 70 elif self._delegate_unicode: 71 return unicode(self) % rhs 72 else: 73 raise AssertionError('__mod__ not supported for non-string types') 74 65 75 def __wrapper__(*args, **kw): 66 76 # Creates the proxy object, instead of the actual value. django/branches/unicode/django/utils/translation/__init__.py
r5255 r5420 71 71 ungettext_lazy = lazy(ungettext, unicode) 72 72 ugettext_lazy = lazy(ugettext, unicode) 73 string_concat = lazy(string_concat, str,unicode)73 string_concat = lazy(string_concat, unicode) 74 74 75 75 def activate(language):
