Fixed a subtle bug with the {% load %} tag: if a tag/filter was removed from template.registered_tags/filters, {% load %} would fail (since module-level code is only run on an initial import). {% load %} now reloads the module, which makes sure that the tag always works even when someone's been doing something screwy. This fixes #242 (and wouldn't had been found without it, so much thanks).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@390 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2005-08-02 18:47:46 +00:00
parent 72e32b31f2
commit ffc3edd79e
1 changed files with 3 additions and 1 deletions

View File

@ -225,7 +225,9 @@ class LoadNode(template.Node):
self.taglib = taglib
def load_taglib(taglib):
return __import__("django.templatetags.%s" % taglib.split('.')[-1], '', '', [''])
mod = __import__("django.templatetags.%s" % taglib.split('.')[-1], '', '', [''])
reload(mod)
return mod
load_taglib = staticmethod(load_taglib)
def render(self, context):