Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #3558: [4558] broken in Python 2.3; this fixes that breakage. T…

…hanks for the heads-up, xian@mintchaos.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4562 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e7aab3a474bf4f26a84323bbfff92bf340087e2f 1 parent 16bd0aa
@jacobian jacobian authored
Showing with 6 additions and 10 deletions.
  1. +6 −6 django/template/__init__.py
  2. +0 −4 django/template/defaultfilters.py
View
12 django/template/__init__.py
@@ -814,7 +814,7 @@ def dec(func):
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 @@ def dec(func):
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 @@ def render(self, context):
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 @@ def render(self, context):
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
View
4 django/template/defaultfilters.py
@@ -35,10 +35,6 @@ def _dec(*args, **kwargs):
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)
Please sign in to comment.
Something went wrong with that request. Please try again.