Code

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#626 closed enhancement (fixed)

Move template modules to django.core.template package

Reported by: adrian Owned by: adrian
Component: Core (Other) Version: 1.0
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by adrian)

There are too many template-related modules lying around in django.core. We should create a django.core.template package and put the following modules in it:

  • django.core.defaultfilters
  • django.core.defaulttags
  • django.core.template (would be django.core.template.__init__ to retain identical interface)
  • django.core.template_loader
  • django.core.template_file

To maintain backwards compatibility, django.core.template_loader should still exist (at least until 1.0), because a lot of Django code does from django.core.template_loader import ....

We should probably do this before #582 and #625, because those tickets both add template-related modules to django.core.

Attachments (2)

626_import_error.patch (64.7 KB) - added by adrian 9 years ago.
Patch that causes circular-import problem.
626_working.patch (122.9 KB) - added by rjwittams 9 years ago.
working patch

Download all attachments as: .zip

Change History (9)

comment:1 Changed 9 years ago by adrian

  • Status changed from new to assigned

comment:2 Changed 9 years ago by adrian

  • Description modified (diff)

(Changed formatting in description.)

Changed 9 years ago by adrian

Patch that causes circular-import problem.

comment:3 Changed 9 years ago by adrian

I'm running into circular import problems in the implementation. See the attached patch, 626_import_error.patch. Any ideas?

Changed 9 years ago by rjwittams

working patch

comment:4 Changed 9 years ago by rjwittams

This patch works and includes some of the changes that were omitted from the previous patch.

comment:5 Changed 9 years ago by rjwittams

Svn diff utterly sucks. It does not include file moves or directory creations.
So to apply this, do from your trunk checkout:

mkdir django/core/template/
svn add django/core/template/
svn move django/core/template.py django/core/template/__init__.py
mkdir django/core/template/loaders/
touch django/core/template/loaders/__init__.py
svn add django/core/template/loaders/
svn move django/core/template_file.py django/core/template/loaders/filesystem.py
patch -p0 < /path/to/626_working.patch

I think that is it. Untested procedure. Little did I think we would be writing manual patch scripts on the verge of 2006....
bring on bazaar-ng ;-)

comment:6 Changed 9 years ago by adrian

Got it. Basically you avoided the issue by importing specific objects from django.core.template instead of doing "from django.core import template".

comment:7 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [867]) Fixed #626 -- Moved template modules to django.core.template package. django.core.template_loader is deprecated, in favor of django.core.template.loader.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.