Opened 6 years ago

Closed 6 years ago

#19169 closed Uncategorized (invalid)

tag_function() uses name of decorated function wich in python 3.3 in lower case but python 3.2 in same case as function name

Reported by: alex_po Owned by: nobody
Component: Template system Version: master
Severity: Normal Keywords: tag
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I got an error: Invalid block tag: 'addtoblock', expected 'endblock'. While i have properly installed sekizai. When i tried to debug i found that tag_function() (django/template/ line 1064) uses a name of decorated function for adding a template tag in tags dict. But sekizai uses name for decorated function with CamelCase for instance Addtoblock. In result the tag name is 'Addtoblock'.
The stranges are that in python 3.2 the name of decorated function is such as a name of class but in python 3.3 the name of decorated function is in lowercase. In result all works well for python 3.3 (template tag is 'addtoblock') but there is error (invalid block tag. template tag is 'Addtoblock') for python 3.2.

Change History (1)

comment:1 Changed 6 years ago by Łukasz Rekucki

Resolution: invalid
Status: newclosed

Django uses __name__ of whatever callable you give it. It looks like django-classy-tags is hacking on a non-public API by injecting _decorated_function in a metaclass. This works for me both on 3.2 and 3.3, with the django-classy-tags at this revision: Make sure you have the same version of that library on both of your python versions.

Either way, this isn't a bug in Django itself.

Note: See TracTickets for help on using tickets.
Back to Top