Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#13124 closed (fixed)

function 'find_template_loader' doesn't work with PyPy 1.2

Reported by: avostryakov Owned by: nobody
Component: Template system Version: 1.2-beta
Severity: Keywords: find template, pypy
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I tested django template system under PyPy 1.2. Basically it works except one small line of code in function 'find_template_loader; (<root project's directory>/django/template/loader.py):

'if hasattr(loader, 'iter'):'

I suggest to replace this line with:

'if isinstance(loader, tuple):'

The patch is attached. I think it'll be better because a new code doesn't use a little tricky feature of python. Class 'string' doesn't have 'iter' attribute but can be iterated.

Attachments (1)

find_template_loader_patch.diff (417 bytes ) - added by avostryakov 15 years ago.

Download all attachments as: .zip

Change History (4)

by avostryakov, 15 years ago

comment:1 by Russell Keith-Magee, 15 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

The test should be extended to also allow for lists, but otherwise a reasonable suggestion.

comment:2 by Russell Keith-Magee, 15 years ago

Resolution: fixed
Status: newclosed

(In [12805]) Fixed #13123 -- Cleaned up template loader for PyPy compatibility. Thanks to avostryakov for the report.

comment:3 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top