Changes between Version 1 and Version 2 of Ticket #5701


Ignore:
Timestamp:
Nov 18, 2007, 11:45:34 PM (17 years ago)
Author:
Gary Wilson
Comment:

fixed description formatting.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5701

    • Property Triage Stage UnreviewedAccepted
  • Ticket #5701 – Description

    v1 v2  
    33Example:
    44{{{
     5#!python
    56def decorate(f):
    67   def wrap(*args, **kwargs):
     
    1415   return augend + addend
    1516}}}
    16 Introspecting add_to, undecorated, would have a __name__ of 'add_to'
    17 and __doc__ of 'Adds stuff'.
     17Introspecting add_to, undecorated, would have a `__name__` of 'add_to'
     18and `__doc__` of 'Adds stuff'.
    1819
    19 After decorating, add_to.__name__ becomes 'wrap' and __doc__ becomes None.
     20After decorating, `add_to.__name__` becomes 'wrap' and `__doc__` becomes None.
    2021
    2122================
    2223
    23 In Python 2.5+, there's functools.wraps, which takes care of the
     24In Python 2.5+, there's `functools.wraps`, which takes care of the
    2425problem of introspection on decorated functions by copying attributes
    2526from the wrapped function.
     
    2728http://docs.python.org/lib/module-functools.html
    2829
    29 Django already includes curry, which is roughly the same as
    30 functools.partial, so it's pretty easy to implement functools.wraps.
     30Django already includes `curry`, which is roughly the same as
     31`functools.partial`, so it's pretty easy to implement `functools.wraps`.
    3132
    32 The attached patch implements django.utils.functional.wraps, updates all Django decorators to use it, and includes tests to verify that the fixing-up works.
     33The attached patch implements `django.utils.functional.wraps`, updates all Django decorators to use it, and includes tests to verify that the fixing-up works.
Back to Top