Fix too long lines, style and remove unused imports in soc.models modules.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Fri, 03 Apr 2009 17:32:15 +0000
changeset 2074 5c75312566d5
parent 2073 6eb9b4652c80
child 2075 c6bdfd560d91
Fix too long lines, style and remove unused imports in soc.models modules. Patch by: Pawel Solyga Reviewed by: to-be-reviewed
app/soc/models/base.py
app/soc/models/comment.py
app/soc/models/proposal_duplicates.py
app/soc/models/role.py
app/soc/models/seed_db.py
--- a/app/soc/models/base.py	Fri Apr 03 17:30:36 2009 +0000
+++ b/app/soc/models/base.py	Fri Apr 03 17:32:15 2009 +0000
@@ -60,8 +60,8 @@
     result = {}
 
     if not field_names:
-      props = self.properties()
-      field_names = [k for k, v in props.iteritems() if isinstance(v, self.DICT_TYPES)]
+      props = self.properties().iteritems()
+      field_names = [k for k, v in props if isinstance(v, self.DICT_TYPES)]
 
     for key in field_names:
       # Skip everything that is not valid
--- a/app/soc/models/comment.py	Fri Apr 03 17:30:36 2009 +0000
+++ b/app/soc/models/comment.py	Fri Apr 03 17:32:15 2009 +0000
@@ -24,7 +24,6 @@
 
 import soc.models.work
 import soc.models.user
-from soc.models import base
 import soc.models.linkable
 
 
--- a/app/soc/models/proposal_duplicates.py	Fri Apr 03 17:30:36 2009 +0000
+++ b/app/soc/models/proposal_duplicates.py	Fri Apr 03 17:32:15 2009 +0000
@@ -24,8 +24,6 @@
 
 from google.appengine.ext import db
 
-from django.utils.translation import ugettext
-
 import soc.models.linkable
 
 
--- a/app/soc/models/role.py	Fri Apr 03 17:30:36 2009 +0000
+++ b/app/soc/models/role.py	Fri Apr 03 17:32:15 2009 +0000
@@ -353,7 +353,7 @@
   def name(self):
     """Property as 'name' for use in common templates.
     """
-    return '%s %s' %(self.given_name, self.surname)
+    return '%s %s' % (self.given_name, self.surname)
 
   def document_name(self):
     """Property as 'document_name' used on for example award certificates.
--- a/app/soc/models/seed_db.py	Fri Apr 03 17:30:36 2009 +0000
+++ b/app/soc/models/seed_db.py	Fri Apr 03 17:32:15 2009 +0000
@@ -22,7 +22,6 @@
   ]
 
 
-import datetime
 import itertools
 import logging
 import random
@@ -54,6 +53,9 @@
 
 
 class Error(Exception):
+  """Base class for all exceptions raised by this module.
+  """
+  
   pass
 
 
@@ -124,7 +126,7 @@
   site.put()
 
 
-  account, current_user = ensureUser()
+  _, current_user = ensureUser()
 
 
   for i in range(15):
@@ -405,7 +407,7 @@
   """Returns the properties for a new org proposal,
   """
 
-  account, current_user = ensureUser()
+  _, current_user = ensureUser()
   status = request.GET.get('status', 'pre-accepted')
   gsoc2009 = Program.get_by_key_name('google/gsoc2009')
 
@@ -444,7 +446,7 @@
   """Returns the properties for a new org entity.
   """
 
-  account, current_user = ensureUser()
+  _, current_user = ensureUser()
   gsoc2009 = Program.get_by_key_name('google/gsoc2009')
 
   if not gsoc2009:
@@ -478,7 +480,7 @@
   """Returns the properties of a new student proposal.
   """
 
-  account, current_user = ensureUser()
+  _, current_user = ensureUser()
   org = Organization.get_by_key_name('google/gsoc2009/%d' % i)
 
   if not org:
@@ -511,7 +513,7 @@
   """Returns the properties of a new student proposal.
   """
 
-  account, current_user = ensureUser()
+  _, current_user = ensureUser()
   org = Organization.get_by_key_name('google/gsoc2009/%d' % i)
   mentor = Mentor.get_by_key_name('google/gsoc2009/org_%d/mentor' % i)
 
@@ -684,6 +686,9 @@
   # there no explicit ranker model anywhere, so make one for
   # our own convenience to delete all rankers
   class ranker(db.Model):
+    """ranker model used with ranklist module.
+    """
+    
     pass
 
   # TODO(dbentley): If there are more than 1000 instances of any model,