#24586: @register.inclusion_tag fails to work on decorated function
-------------------------------------+-------------------------------------
     Reporter:  cjerdonek            |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Template system      |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
  template,inclusion_tag,custom      |  Unreviewed
  tag,decorator                      |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by prestontimmons):

 I can see how this would be confusing, but I'm not sure it's a Django
 problem.

 The key to fixing your example is making sure your decorator uses
 `functools.wraps`. This will carry through the `__name__` attribute from
 the original `my_tag` function. Otherwise, that piece of information is
 lost and the tag will be registered with whatever the name is of the inner
 function in your decorator.

--
Ticket URL: <https://code.djangoproject.com/ticket/24586#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.de937ba100ae6ac19c68bf6c8396e2c7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to