#5243: Bug in {% load %}
------------------------------------------------+---------------------------
Reporter: Bjørn Stabell <[EMAIL PROTECTED]> | Owner:
adrian
Status: new | Component:
Template system
Version: SVN | Resolution:
Keywords: load | Stage:
Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
------------------------------------------------+---------------------------
Changes (by adrian):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> According to {% load %} you can load templatetags that are in
> subdirectories, e.g. {% load news.blah %}. This didn't work for me; I
> kept getting errors.
>
> Applying the below patch seems to work. I don't know why
> {{{taglib.split('.')[-1])}}} was done in the first place? It's been like
> this for as far back as I could trace the revisions in on this Trac. A
> related ticket might be #372.
>
> Index: django/template/defaulttags.py
> ===================================================================
> --- django/template/defaulttags.py (revision 8271)
> +++ django/template/defaulttags.py (working copy)
> @@ -792,7 +792,7 @@
> for taglib in bits[1:]:
> # add the library to the parser
> try:
> - lib = get_library("django.templatetags.%s" %
> taglib.split('.')[-1])
> + lib = get_library("django.templatetags.%s" % taglib)
> parser.add_library(lib)
> except InvalidTemplateLibrary, e:
> raise TemplateSyntaxError, "'%s' is not a valid tag library:
> %s" % (taglib, e)
New description:
According to {% load %} you can load templatetags that are in
subdirectories, e.g. {% load news.blah %}. This didn't work for me; I
kept getting errors.
Applying the below patch seems to work. I don't know why
{{{taglib.split('.')[-1])}}} was done in the first place? It's been like
this for as far back as I could trace the revisions in on this Trac. A
related ticket might be #372.
{{{
Index: django/template/defaulttags.py
===================================================================
--- django/template/defaulttags.py (revision 8271)
+++ django/template/defaulttags.py (working copy)
@@ -792,7 +792,7 @@
for taglib in bits[1:]:
# add the library to the parser
try:
- lib = get_library("django.templatetags.%s" %
taglib.split('.')[-1])
+ lib = get_library("django.templatetags.%s" % taglib)
parser.add_library(lib)
except InvalidTemplateLibrary, e:
raise TemplateSyntaxError, "'%s' is not a valid tag library:
%s" % (taglib, e)
}}}
Comment:
Fixed formatting in description.
--
Ticket URL: <http://code.djangoproject.com/ticket/5243#comment:1>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---