#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)
Change History (12)
by , 17 years ago
| Attachment: | dj-context-reusable.patch added |
|---|
comment:1 by , 17 years ago
| milestone: | → 1.1 |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:3 by , 17 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 , 17 years ago
| Attachment: | 10079-reusable-context.2.diff added |
|---|
comment:4 by , 17 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 , 17 years ago
| Attachment: | 10079-reusable-context.diff added |
|---|
Actually update the diff this time.
comment:5 by , 17 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:6 by , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:7 by , 17 years ago
comment:8 by , 17 years ago
| Summary: | [trivial, patch] Make template.context usable outside of Django → Make template.context usable outside of Django |
|---|
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.