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
--- 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: