Changeset 5489
- Timestamp:
- 06/17/07 21:23:24 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/unicode/django/utils/functional.py
r5420 r5489 65 65 return Promise.__str__(self) 66 66 67 def __cmp__(self, rhs): 68 if self._delegate_str: 69 s = str(self.__func(*self.__args, **self.__kw)) 70 elif self._delegate_unicode: 71 s = unicode(self.__func(*self.__args, **self.__kw)) 72 else: 73 s = self.__func(*self.__args, **self.__kw) 74 if isinstance(rhs, Promise): 75 return -cmp(rhs, s) 76 else: 77 return cmp(s, rhs) 78 67 79 def __mod__(self, rhs): 68 80 if self._delegate_str: django/branches/unicode/tests/regressiontests/i18n/tests.py
r5420 r5489 2 2 3 3 ur""" 4 >>> from django.utils.translation import ugettext_lazy, activate, deactivate 4 Format string interpolation should work with *_lazy objects. 5 6 >>> from django.utils.translation import ugettext_lazy, activate, deactivate, gettext_lazy 5 7 >>> s = ugettext_lazy('Add %(name)s') 6 8 >>> d = {'name': 'Ringo'} … … 15 17 >>> deactivate() 16 18 19 It should be possible to compare *_lazy objects. 20 21 >>> s1 = ugettext_lazy('Add %(name)s') 22 >>> s == s1 23 True 24 >>> s2 = gettext_lazy('Add %(name)s') 25 >>> s3 = gettext_lazy('Add %(name)s') 26 >>> s2 == s3 27 True 28 >>> s == s2 29 True 30 >>> s4 = ugettext_lazy('Some other string') 31 >>> s == s4 32 False 17 33 """
