Opened 10 years ago

Closed 10 years ago

Last modified 9 months ago

#4356 closed Uncategorized (invalid)

Problem with Template library django.template.loader_tag - SVN Version 5311

Reported by: anonymous Owned by: Jacob
Component: Uncategorized Version: 0.96
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Malcolm Tredinnick)

Traceback (most recent call last):
File "/home/meli/Projet/atelier_rouelibre/django/core/handlers/base.py" in get_response
  68. callback, callback_args, callback_kwargs = resolver.resolve(request.path)
File "/home/meli/Projet/atelier_rouelibre/django/core/urlresolvers.py" in resolve
  1
69. for pattern in self.urlconf_module.urlpatterns:
File "/home/meli/Projet/atelier_rouelibre/django/core/urlresolvers.py" in _get_urlconf_module
  186. self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
File "/home/meli/Projet/atelier_rouelibre/../atelier_rouelibre/urls.py" in
  2. from atelier_rouelibre.views import index
File "/home/meli/Projet/atelier_rouelibre/../atelier_rouelibre/views.py" in
  2. from django.template import Context, loader
File "/home/meli/Projet/atelier_rouelibre/../atelier_rouelibre/django/template/loader.py" in
  118. add_to_builtins('django.template.loader_tags')
File "/home/meli/Projet/atelier_rouelibre/../atelier_rouelibre/django/template/__init__.py" in add_to_builtins
  933. builtins.append(get_library(module_name))
File "/home/meli/Projet/atelier_rouelibre/../atelier_rouelibre/django/template/__init__.py" in get_library
  922. mod = __import__(module_name, {}, {}, [''])
File "/home/meli/Projet/atelier_rouelibre/django/template/loader_tags.py" in
  3. from django.template.loader import get_template, get_template_from_string, find_template_source
File "/home/meli/Projet/atelier_rouelibre/../atelier_rouelibre/django/template/loader.py" in
  118. add_to_builtins('django.template.loader_tags')
File "/home/meli/Projet/atelier_rouelibre/../atelier_rouelibre/django/template/__init__.py" in add_to_builtins
  933. builtins.append(get_library(module_name))
File "/home/meli/Projet/atelier_rouelibre/../atelier_rouelibre/django/template/__init__.py" in get_library
  929. raise InvalidTemplateLibrary, "Template library %s does not have a variable named 'register'" % module_name

  InvalidTemplateLibrary at /
  Template library django.template.loader_tags does not have a variable named 'register'

Change History (9)

comment:1 Changed 10 years ago by Malcolm Tredinnick

Description: modified (diff)

(Fixed description formatting)

What were you doing to trigger this traceback? The loader_tags.py module definitely does have a variable named register in it, so there is something else going on here.

Can you run "svn status" and check that no files in your source tree are changed from the versions in trunk?

comment:2 Changed 10 years ago by melindia777@…

Everything is in sync...

I didn't do nothing ! I swear ... not my fault ;)

Seriously, I updated with svn and then, this traceback.
Just began this project.

comment:3 Changed 10 years ago by Malcolm Tredinnick

Then we have a problem, because I cannot replicate this at all. :-(

What checkout version are you using? Run "svn info" in, say, the root directory of your source and see what it says for "Revision". I really cannot think of anything we've done to cause this, though.

One thing to do is to try backing up a few revisions and see if you can work out where things start to go wrong. So if, for example, you are at revision 5319, go back to 5200 and see if the problem reoccurs (svn update -r 5200). If it doesn't happen then, move forwards halfway. Rinse, wash, repeat. If we at least know what checkin causes the problem, if might give us some clues.

comment:4 Changed 10 years ago by Melindia <melindia777@…>

We figure it out. Yé !
We used a symlink django-­>django.svn/django in our project folder. It was working until now. We did proper system install and it works...

Do you know if we can use the symlink trick ? It was handy!

Thanks for your very nice answer !

comment:5 Changed 10 years ago by Simon G. <dev@…>

Resolution: invalid
Status: newclosed

Hmm.. did you have another version of django installed? maybe in your site-packages library?

comment:6 Changed 10 years ago by Pashka R. <pashka.reznikov@…>

Version: SVN0.96

I have 0.95 installed in the system but I want to use 0.96.... so I've setup .htaccess:

SetHandler python-program
PythonPath "['/webhomes/exclaim/public_html/kids2', '/webhomes/exclaim/public_html/kids2/..'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
PythonDebug On

all works (http://kids.dn.ua/info/project.html [ru]) except of / (http://kids.dn.ua/) ... I've got the same error.....

has someone any idea about how can I fix this? Thnx

wbr Pashka R.

comment:7 Changed 10 years ago by Pashka R. <pashka.reznikov@…>

....and.... I have symlink /webhomes/exclaim/public_html/kids2/django --> /path/to/django0.96...

wbr Pashka R.

comment:8 Changed 10 years ago by Malcolm Tredinnick

Please don't use the Trac system for support requests. We have mailing lists for that.

comment:9 Changed 9 months ago by psmears

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

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
>>> 
Note: See TracTickets for help on using tickets.
Back to Top