Login

Decorator

Author:
chachan
Posted:
April 19, 2013
Language:
Python
Version:
Not specified
Tags:
decorator
Score:
0 (after 0 ratings)

[Understanding Python Decorators in 12 Easy Steps!] (http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def decorator(func):
    def inner(*args, **kwargs):
        # Code in here
        return func(*args, **kwargs)
    return inner

# Use
@decorator
def view_function(request):
    pass

More like this

  1. group_required decorator by msanders 5 years, 11 months ago
  2. Decorator to execute a method only once by atodorov-otb 1 year, 7 months ago
  3. MultiFormWizard by flashingpumpkin 6 years, 2 months ago
  4. SelectDateWidget by silent1mezzo 4 years, 7 months ago
  5. Extended Form Wizard with ability to go backwards by mtsyganov 6 years, 3 months ago

Comments

Please login first before commenting.