Django

Code

Changeset 5719

Show
Ignore:
Timestamp:
07/16/07 08:47:43 (1 year ago)
Author:
gwilson
Message:

Removed unused variable and changed comments about permalink decorator into a docstring.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/db/models/__init__.py

    r5172 r5719  
    1616ADD, CHANGE, BOTH = 1, 2, 3 
    1717 
    18 # Decorator. Takes a function that returns a tuple in this format: 
    19 #     (viewname, viewargs, viewkwargs) 
    20 # Returns a function that calls urlresolvers.reverse() on that data, to return 
    21 # the URL for those parameters. 
    2218def permalink(func): 
     19    """ 
     20    Decorator that calls urlresolvers.reverse() to return a URL using 
     21    parameters returned by the decorated function "func". 
     22 
     23    "func" should be a function that returns a tuple in one of the 
     24    following formats: 
     25        (viewname, viewargs) 
     26        (viewname, viewargs, viewkwargs) 
     27    """ 
    2328    from django.core.urlresolvers import reverse 
    2429    def inner(*args, **kwargs): 
    2530        bits = func(*args, **kwargs) 
    26         viewname = bits[0] 
    2731        return reverse(bits[0], None, *bits[1:3]) 
    2832    return inner