summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2007-02-23 23:05:16 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2007-02-23 23:05:16 +0000
commite7aab3a474bf4f26a84323bbfff92bf340087e2f (patch)
treed1f6b8cf53dee074cdccb3406c284e6a478cb2c9
parent16bd0aa99161c4f9646f1546e47b6ac5f9a1e3c2 (diff)
Fixed #3558: [4558] broken in Python 2.3; this fixes that breakage. Thanks for the heads-up, xian@mintchaos.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4562 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/template/__init__.py12
-rw-r--r--django/template/defaultfilters.py4
2 files changed, 6 insertions, 10 deletions
diff --git a/django/template/__init__.py b/django/template/__init__.py
index 6fd8a03250..90fd13e1ce 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -814,7 +814,7 @@ class Library(object):
raise InvalidTemplateLibrary, "Unsupported arguments to Library.tag: (%r, %r)", (name, compile_function)
def tag_function(self,func):
- self.tags[func.__name__] = func
+ self.tags[getattr(func, "_decorated_function", func).__name__] = func
return func
def filter(self, name=None, filter_func=None):
@@ -838,7 +838,7 @@ class Library(object):
raise InvalidTemplateLibrary, "Unsupported arguments to Library.filter: (%r, %r)", (name, filter_func)
def filter_function(self, func):
- self.filters[func.__name__] = func
+ self.filters[getattr(func, "_decorated_function", func).__name__] = func
return func
def simple_tag(self,func):
@@ -852,9 +852,9 @@ class Library(object):
resolved_vars = [resolve_variable(var, context) for var in self.vars_to_resolve]
return func(*resolved_vars)
- compile_func = curry(generic_tag_compiler, params, defaults, func.__name__, SimpleNode)
+ compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).__name__, SimpleNode)
compile_func.__doc__ = func.__doc__
- self.tag(func.__name__, compile_func)
+ self.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
return func
def inclusion_tag(self, file_name, context_class=Context, takes_context=False):
@@ -888,9 +888,9 @@ class Library(object):
self.nodelist = t.nodelist
return self.nodelist.render(context_class(dict))
- compile_func = curry(generic_tag_compiler, params, defaults, func.__name__, InclusionNode)
+ compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).__name__, InclusionNode)
compile_func.__doc__ = func.__doc__
- self.tag(func.__name__, compile_func)
+ self.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
return func
return dec
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index 9c72201984..b53375b42d 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -35,10 +35,6 @@ def stringfilter(func):
args[0] = smart_string(args[0])
return func(*args, **kwargs)
- # Make sure the internal name is the original function name because this
- # is the internal name of the filter if passed directly to Library().filter
- _dec.__name__ = func.__name__
-
# Include a reference to the real function (used to check original
# arguments by the template parser).
_dec._decorated_function = getattr(func, '_decorated_function', func)