Remove unused imports, add missing blank lines, fix too long lines, fix docstring parameters to match the ones in method declaration, rename to short variable names in soc.logic.models.base module.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Wed, 04 Mar 2009 17:24:19 +0000
changeset 1626 fe455c93cbf6
parent 1625 cd7174032b56
child 1627 425dccf4f652
Remove unused imports, add missing blank lines, fix too long lines, fix docstring parameters to match the ones in method declaration, rename to short variable names in soc.logic.models.base module. Patch by: Pawel Solyga Reviewed by: to-be-reviewed
app/soc/logic/models/base.py
--- a/app/soc/logic/models/base.py	Wed Mar 04 17:22:22 2009 +0000
+++ b/app/soc/logic/models/base.py	Wed Mar 04 17:24:19 2009 +0000
@@ -25,8 +25,6 @@
   ]
 
 
-import itertools
-
 from google.appengine.ext import db
 
 from django.utils.translation import ugettext
@@ -42,6 +40,7 @@
 
   pass
 
+
 class InvalidArgumentError(Error):
   """Raised when an invalid argument is passed to a method.
 
@@ -50,6 +49,7 @@
 
   pass
 
+
 class NoEntityError(InvalidArgumentError):
   """Raised when no entity is passed to a method that requires one.
   """
@@ -291,19 +291,19 @@
     if len(orderset) != len(order):
       raise InvalidArgumentError
 
-    q = db.Query(self._model)
+    query = db.Query(self._model)
 
     for key, value in filter.iteritems():
       if isinstance(value, list):
         op = '%s IN' % key
-        q.filter(op, value)
+        query.filter(op, value)
       else:
-        q.filter(key, value)
+        query.filter(key, value)
 
     for key in order:
-      q.order(key)
+      query.order(key)
 
-    result = q.fetch(limit, offset)
+    result = query.fetch(limit, offset)
 
     if unique:
       return result[0] if result else None
@@ -314,8 +314,8 @@
     """Update existing entity using supplied properties.
 
     Args:
-      model: a model entity
-      model_properties: keyword arguments that correspond to entity
+      entity: a model entity
+      entity_properties: keyword arguments that correspond to entity
         properties and their values
       silent: iff True does not call _onUpdate method
 
@@ -437,8 +437,9 @@
     taken when a field is created.
 
     Args:
+      entity_properties: keyword arguments that correspond to entity
+        properties and their values
       name: the name of the field to be created
-      value: the value
     """
 
     if not entity_properties or (name not in entity_properties):
@@ -453,8 +454,9 @@
 
     Args:
       entity: the unaltered entity
+      entity_properties: keyword arguments that correspond to entity
+        properties and their values
       name: the name of the field to be changed
-      value: the new value
     """
 
     if not entity: