Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#10079 closed (fixed)

Make template.context usable outside of Django

Reported by: Kenneth Arnold Owned by: Gary Wilson
Component: Template system Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I needed a data structure exactly like Django's Context object for a project. Unfortunately, the whole module imports settings even though it's only needed in one place. The trivial attached patch moves the import to where it's actually needed.

Attachments (3)

dj-context-reusable.patch (770 bytes ) - added by Kenneth Arnold 16 years ago.
10079-reusable-context.2.diff (874 bytes ) - added by mcroydon 16 years ago.
10079-reusable-context.diff (681 bytes ) - added by mcroydon 16 years ago.
Actually update the diff this time.

Download all attachments as: .zip

Change History (12)

by Kenneth Arnold, 16 years ago

Attachment: dj-context-reusable.patch added

comment:1 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:2 by mcroydon, 16 years ago

Triage Stage: AcceptedReady for checkin

This is a pretty trivial patch that applies cleanly and doesn't cause any test breakage. I'm going to call this ready for checkin but please scold me if you should.

comment:3 by Alex Gaynor, 16 years ago

Is there any reason to move all the imports inside the function, I think we only need to move the settings import as the issue is not having all of Django on disk, it's using it in the context of a django project.

by mcroydon, 16 years ago

comment:4 by mcroydon, 16 years ago

No reason other than they were only being used inside that function and I was trying to reduce imports to fit the use case. Django should already be on his pythonpath if he's importing Context from it thought. Updated patch moves the other imports back to the top.

by mcroydon, 16 years ago

Attachment: 10079-reusable-context.diff added

Actually update the diff this time.

comment:5 by Gary Wilson, 16 years ago

Owner: changed from nobody to Gary Wilson
Status: newassigned

comment:6 by Gary Wilson, 16 years ago

Resolution: fixed
Status: assignedclosed

(In [10209]) Fixed #10079 -- Moved settings import inside the function that uses it so that the module can be imported without needing settings, thanks kcarnold and mcroydon.

comment:7 by Gary Wilson, 16 years ago

(In [10210]) [1.0.X]: Fixed #10079 -- Moved settings import inside the function that uses it so that the module can be imported without needing settings, thanks kcarnold and mcroydon.

Backport of r10209 from trunk.

comment:8 by Gary Wilson, 16 years ago

Summary: [trivial, patch] Make template.context usable outside of DjangoMake template.context usable outside of Django

comment:9 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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