Django

Code

Ticket #5960 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

AutoEscaping change breaks python 2.3.5 compatability due to use of decode function on unicode objects

Reported by: Free Neuron <freeneuron+django@gmail.com> Assigned to: nobody
Milestone: Component: Core framework
Version: SVN Keywords: decode, unicode, escape
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

http://code.djangoproject.com/browser/django/trunk/django/utils/safestring.py?rev=6671

File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/django/utils/safestring.py", line 92, in SafeUnicode?

decode = curry(_proxy_method, method = unicode.decode)

AttributeError?: type object 'unicode' has no attribute 'decode'

Under python 2.3.5 u"a".decode("rot13") throws, under 2.4 it succeeds.

Attachments

Change History

11/16/07 02:58:35 changed by Free Neuron <freeneuron+django@gmail.com>

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

Python 2.3.5 (#1, Aug 19 2006, 21:31:42) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type "help", "copyright", "credits" or "license" for more information.

u"asdf".decode("rot13")

Traceback (most recent call last):

File "<stdin>", line 1, in ?

AttributeError?: 'unicode' object has no attribute 'decode'

(in reply to: ↑ description ) 11/16/07 16:52:39 changed by anonymous

Confirmed same behavior, SVN, RHEL 4, Python 2.3.4 Fixed by reverting to 0.96.1

11/16/07 19:30:18 changed by mtredinnick

What do I have to do to trigger this problem in Django? It's not immediately clear how we're getting to that code path, so a short example of how to repeat the bug is necessary.

11/16/07 19:30:27 changed by mtredinnick

  • stage changed from Unreviewed to Accepted.

11/17/07 06:43:20 changed by mtredinnick

Ignore comment 3. I worked it out (things fail just trying to start up when you run the tests).

11/17/07 06:58:06 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [6685]) Fixed #5960 -- Fixed some Python 2.3 incompatibilities.


Add/Change #5960 (AutoEscaping change breaks python 2.3.5 compatability due to use of decode function on unicode objects)




Change Properties
Action