Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #7017 -- Minor typo fix in a comment. Thanks FranRuiz.

Also promoted the comment to a docstring and removed some extra spaces.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7422 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ea87c0df5c0f2f1e7db6bbb2fc61141cec62e4f5 1 parent 52945a9
Malcolm Tredinnick authored April 15, 2008

Showing 1 changed file with 8 additions and 5 deletions. Show diff stats Hide diff stats

  1. 13  django/contrib/contenttypes/generic.py
13  django/contrib/contenttypes/generic.py
@@ -35,15 +35,18 @@ def contribute_to_class(self, cls, name):
35 35
         setattr(cls, name, self)
36 36
 
37 37
     def instance_pre_init(self, signal, sender, args, kwargs):
38  
-        # Handle initalizing an object with the generic FK instaed of
39  
-        # content-type/object-id fields.
  38
+        """
  39
+        Handles initializing an object with the generic FK instaed of
  40
+        content-type/object-id fields.
  41
+        """
40 42
         if self.name in kwargs:
41 43
             value = kwargs.pop(self.name)
42 44
             kwargs[self.ct_field] = self.get_content_type(obj=value)
43 45
             kwargs[self.fk_field] = value._get_pk_val()
44 46
 
45 47
     def get_content_type(self, obj=None, id=None):
46  
-        # Convenience function using get_model avoids a circular import when using this model
  48
+        # Convenience function using get_model avoids a circular import when
  49
+        # using this model
47 50
         ContentType = get_model("contenttypes", "contenttype")
48 51
         if obj:
49 52
             return ContentType.objects.get_for_model(obj)
@@ -61,10 +64,10 @@ def __get__(self, instance, instance_type=None):
61 64
             return getattr(instance, self.cache_attr)
62 65
         except AttributeError:
63 66
             rel_obj = None
64  
-            
  67
+
65 68
             # Make sure to use ContentType.objects.get_for_id() to ensure that
66 69
             # lookups are cached (see ticket #5570). This takes more code than
67  
-            # the naive ``getattr(instance, self.ct_field)``, but has better 
  70
+            # the naive ``getattr(instance, self.ct_field)``, but has better
68 71
             # performance when dealing with GFKs in loops and such.
69 72
             f = self.model._meta.get_field(self.ct_field)
70 73
             ct_id = getattr(instance, f.get_attname(), None)

0 notes on commit ea87c0d

Please sign in to comment.
Something went wrong with that request. Please try again.