From ffc3edd79ee4abc7a22ea07f0660322f50306334 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 2 Aug 2005 18:47:46 +0000 Subject: [PATCH] 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 --- django/core/defaulttags.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django/core/defaulttags.py b/django/core/defaulttags.py index 738a7d34b5..e5620f7743 100644 --- a/django/core/defaulttags.py +++ b/django/core/defaulttags.py @@ -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):