#4356: Problem with Template library django.template.loader_tag - SVN Version
5311
-------------------------------+--------------------------------------
Reporter: anonymous | Owner: jacob
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 0.96
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by psmears):
* ui_ux: => 0
* type: => Uncategorized
* severity: => Normal
* easy: => 0
Comment:
I'm not sure that this isn't actually a bug. I believe it's been fixed in
more recent versions, but I can produce a similar error in 1.6 very
simply:
{{{
localhost:~% python
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django.template.loader_tags
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/django/template/loader_tags.py",
line 6, in <module>
from django.template.loader import get_template
File "/usr/lib/python2.7/site-packages/django/template/loader.py", line
188, in <module>
add_to_builtins('django.template.loader_tags')
File "/usr/lib/python2.7/site-packages/django/template/base.py", line
1331, in add_to_builtins
builtins.append(import_library(module))
File "/usr/lib/python2.7/site-packages/django/template/base.py", line
1273, in import_library
taglib_module)
django.template.base.InvalidTemplateLibrary: Template library
django.template.loader_tags does not have a variable named 'register'
>>>
}}}
For the benefit of anyone else searching for this error message, the best
workaround I've found is to import django.template.loader before
django.template.loader_tags:
{{{
localhost:~% python
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django.template.loader
>>> import django.template.loader_tags
>>>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/4356#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.d35f9647c21d9527506604ad68bea0dc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.