Ticket #5560: lazy_unicode.patch

File lazy_unicode.patch, 1022 bytes (added by leosoto <leo.soto@…>, 17 years ago)

Simple patch, works ok on CPython.

  • django/utils/functional.py

     
    5353            self._delegate_unicode = unicode in resultclasses
    5454            assert not (self._delegate_str and self._delegate_unicode), "Cannot call lazy() with both str and unicode return types."
    5555            if self._delegate_unicode:
    56                 self.__unicode__ = self.__unicode_cast
     56                # Assigning the __unicode__ method to the __proxy__ class,
     57                # for Jython compatibility (where __unicode__ lives on object)
     58                #
     59                # As each call to lazy() makes a new __proxy__ class,
     60                # this don't interfere with other lazy objects
     61                __proxy__.__unicode__ = __proxy__.__unicode_cast
    5762
    5863        def __promise__(self, klass, funcname, func):
    5964            # Builds a wrapper around some magic method and registers that magic
Back to Top