Opened 14 years ago
Closed 14 years ago
#15680 closed (wontfix)
templatetags submodules no longer work
Reported by: | EMiller | Owned by: | Julien Phalip |
---|---|---|---|
Component: | Template system | Version: | 1.3 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
We're migrating from 1.1 to 1.3 - we have a directory
myapp/ templatetags/ tagmodule/ __init__.py foo.py
This worked fine in 1.1 with {% load tagmodule.foo %} in the template. In 1.3 this breaks. In django.template.base.get_library loops through templatetag_modules pairing modules and libraries and calling import_library. On line 951 of base.py:
app_path, taglib = taglib_module.rsplit('.',1) app_module = import_module(app_path)
That rsplit left my "tagmodule" in the app_path, which then failed to import as it was paired with another path.
Reorganizing my templatetags under deadline, just wanted to mention it.
Change History (3)
comment:1 by , 14 years ago
Component: | Uncategorized → Template system |
---|
comment:2 by , 14 years ago
Owner: | changed from | to
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
On a second thought, I'm not sure we should allow this. If your concern is to break large templatetag libraries into multiple files, then you still can do it by doing "from foo import *
" in the main module's __init__.py
file. If you have a more compelling reason for allowing this behaviour, then please reopen with more details.
I confirm that this regression was introduced in [12944]. I'll try to work on a patch.