Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Jacob Kaplan-Moss authored February 23, 2007
12  django/template/__init__.py
@@ -814,7 +814,7 @@ def dec(func):
814 814
             raise InvalidTemplateLibrary, "Unsupported arguments to Library.tag: (%r, %r)", (name, compile_function)
815 815
 
816 816
     def tag_function(self,func):
817  
-        self.tags[func.__name__] = func
  817
+        self.tags[getattr(func, "_decorated_function", func).__name__] = func
818 818
         return func
819 819
 
820 820
     def filter(self, name=None, filter_func=None):
@@ -838,7 +838,7 @@ def dec(func):
838 838
             raise InvalidTemplateLibrary, "Unsupported arguments to Library.filter: (%r, %r)", (name, filter_func)
839 839
 
840 840
     def filter_function(self, func):
841  
-        self.filters[func.__name__] = func
  841
+        self.filters[getattr(func, "_decorated_function", func).__name__] = func
842 842
         return func
843 843
 
844 844
     def simple_tag(self,func):
@@ -852,9 +852,9 @@ def render(self, context):
852 852
                 resolved_vars = [resolve_variable(var, context) for var in self.vars_to_resolve]
853 853
                 return func(*resolved_vars)
854 854
 
855  
-        compile_func = curry(generic_tag_compiler, params, defaults, func.__name__, SimpleNode)
  855
+        compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).__name__, SimpleNode)
856 856
         compile_func.__doc__ = func.__doc__
857  
-        self.tag(func.__name__, compile_func)
  857
+        self.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
858 858
         return func
859 859
 
860 860
     def inclusion_tag(self, file_name, context_class=Context, takes_context=False):
@@ -888,9 +888,9 @@ def render(self, context):
888 888
                         self.nodelist = t.nodelist
889 889
                     return self.nodelist.render(context_class(dict))
890 890
 
891  
-            compile_func = curry(generic_tag_compiler, params, defaults, func.__name__, InclusionNode)
  891
+            compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).__name__, InclusionNode)
892 892
             compile_func.__doc__ = func.__doc__
893  
-            self.tag(func.__name__, compile_func)
  893
+            self.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
894 894
             return func
895 895
         return dec
896 896
 
4  django/template/defaultfilters.py
@@ -35,10 +35,6 @@ def _dec(*args, **kwargs):
35 35
             args[0] = smart_string(args[0])
36 36
         return func(*args, **kwargs)
37 37
         
38  
-    # Make sure the internal name is the original function name because this
39  
-    # is the internal name of the filter if passed directly to Library().filter
40  
-    _dec.__name__ = func.__name__
41  
-    
42 38
     # Include a reference to the real function (used to check original
43 39
     # arguments by the template parser).
44 40
     _dec._decorated_function = getattr(func, '_decorated_function', func)

0 notes on commit e7aab3a

Please sign in to comment.
Something went wrong with that request. Please try again.