Changeset 5344
- Timestamp:
- 05/26/07 01:39:10 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/unicode/django/utils/functional.py
r5314 r5344 34 34 setattr(self, k, self.__promise__(resultclass, k, v)) 35 35 if unicode in resultclasses: 36 setattr(self, '__unicode__', self.__unicode_cast) 36 self.__unicode__ = self.__unicode_cast 37 self._delegate_str = str in resultclasses 37 38 38 39 def __promise__(self, klass, funcname, func): … … 52 53 def __unicode_cast(self): 53 54 return self.__func(*self.__args, **self.__kw) 55 56 def __str__(self): 57 # As __str__ is always a method on the type (class), it is looked 58 # up (and found) there first. So we can't just assign to it on a 59 # per-instance basis in __init__. 60 if self._delegate_str: 61 return str(self.__func(*self.__args, **self.__kw)) 62 else: 63 return Promise.__str__(self) 54 64 55 65 def __wrapper__(*args, **kw):
