Author: gwilson
Date: 2007-07-16 08:47:43 -0500 (Mon, 16 Jul 2007)
New Revision: 5719

Modified:
   django/trunk/django/db/models/__init__.py
Log:
Removed unused variable and changed comments about `permalink` decorator into a 
docstring.


Modified: django/trunk/django/db/models/__init__.py
===================================================================
--- django/trunk/django/db/models/__init__.py   2007-07-16 09:36:10 UTC (rev 
5718)
+++ django/trunk/django/db/models/__init__.py   2007-07-16 13:47:43 UTC (rev 
5719)
@@ -15,14 +15,18 @@
 # Admin stages.
 ADD, CHANGE, BOTH = 1, 2, 3
 
-# Decorator. Takes a function that returns a tuple in this format:
-#     (viewname, viewargs, viewkwargs)
-# Returns a function that calls urlresolvers.reverse() on that data, to return
-# the URL for those parameters.
 def permalink(func):
+    """
+    Decorator that calls urlresolvers.reverse() to return a URL using
+    parameters returned by the decorated function "func".
+
+    "func" should be a function that returns a tuple in one of the
+    following formats:
+        (viewname, viewargs)
+        (viewname, viewargs, viewkwargs)
+    """
     from django.core.urlresolvers import reverse
     def inner(*args, **kwargs):
         bits = func(*args, **kwargs)
-        viewname = bits[0]
         return reverse(bits[0], None, *bits[1:3])
     return inner


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to