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
This commit is contained in:
parent
16bd0aa991
commit
e7aab3a474
|
@ -814,7 +814,7 @@ class Library(object):
|
||||||
raise InvalidTemplateLibrary, "Unsupported arguments to Library.tag: (%r, %r)", (name, compile_function)
|
raise InvalidTemplateLibrary, "Unsupported arguments to Library.tag: (%r, %r)", (name, compile_function)
|
||||||
|
|
||||||
def tag_function(self,func):
|
def tag_function(self,func):
|
||||||
self.tags[func.__name__] = func
|
self.tags[getattr(func, "_decorated_function", func).__name__] = func
|
||||||
return func
|
return func
|
||||||
|
|
||||||
def filter(self, name=None, filter_func=None):
|
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)
|
raise InvalidTemplateLibrary, "Unsupported arguments to Library.filter: (%r, %r)", (name, filter_func)
|
||||||
|
|
||||||
def filter_function(self, func):
|
def filter_function(self, func):
|
||||||
self.filters[func.__name__] = func
|
self.filters[getattr(func, "_decorated_function", func).__name__] = func
|
||||||
return func
|
return func
|
||||||
|
|
||||||
def simple_tag(self,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]
|
resolved_vars = [resolve_variable(var, context) for var in self.vars_to_resolve]
|
||||||
return func(*resolved_vars)
|
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__
|
compile_func.__doc__ = func.__doc__
|
||||||
self.tag(func.__name__, compile_func)
|
self.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
|
||||||
return func
|
return func
|
||||||
|
|
||||||
def inclusion_tag(self, file_name, context_class=Context, takes_context=False):
|
def inclusion_tag(self, file_name, context_class=Context, takes_context=False):
|
||||||
|
@ -888,9 +888,9 @@ class Library(object):
|
||||||
self.nodelist = t.nodelist
|
self.nodelist = t.nodelist
|
||||||
return self.nodelist.render(context_class(dict))
|
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__
|
compile_func.__doc__ = func.__doc__
|
||||||
self.tag(func.__name__, compile_func)
|
self.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
|
||||||
return func
|
return func
|
||||||
return dec
|
return dec
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,6 @@ def stringfilter(func):
|
||||||
args[0] = smart_string(args[0])
|
args[0] = smart_string(args[0])
|
||||||
return func(*args, **kwargs)
|
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
|
# Include a reference to the real function (used to check original
|
||||||
# arguments by the template parser).
|
# arguments by the template parser).
|
||||||
_dec._decorated_function = getattr(func, '_decorated_function', func)
|
_dec._decorated_function = getattr(func, '_decorated_function', func)
|
||||||
|
|
Loading…
Reference in New Issue