Fix identions, too long lines, unused imports and some other mistakes.
Patch by: Pawel Solyga
Review by: to-be-reviewed
--- a/app/soc/logic/models/base.py Sun Oct 19 13:06:20 2008 +0000
+++ b/app/soc/logic/models/base.py Sun Oct 19 13:14:40 2008 +0000
@@ -30,7 +30,7 @@
from soc.logic import out_of_band
-class Logic():
+class Logic:
"""Base logic for entity classes.
The BaseLogic class functions specific to Entity classes by relying
--- a/app/soc/logic/site/sidebar.py Sun Oct 19 13:06:20 2008 +0000
+++ b/app/soc/logic/site/sidebar.py Sun Oct 19 13:14:40 2008 +0000
@@ -25,8 +25,6 @@
from google.appengine.api import users
-from django.utils import datastructures
-
from soc.logic import menu
from soc.logic.site import id_user
from soc.logic.site import map
@@ -154,7 +152,8 @@
path = request.path
if path:
- # TODO(tlarsen): scan through list and mark current request.path as "selected"
+ # TODO(tlarsen): scan through list and mark current request.path
+ # as "selected"
pass
return menu.Menu(items=menu_items)
--- a/app/soc/logic/validate.py Sun Oct 19 13:06:20 2008 +0000
+++ b/app/soc/logic/validate.py Sun Oct 19 13:14:40 2008 +0000
@@ -22,7 +22,6 @@
]
-import re
import feedparser
from google.appengine.api import urlfetch
--- a/app/soc/views/helper/access.py Sun Oct 19 13:06:20 2008 +0000
+++ b/app/soc/views/helper/access.py Sun Oct 19 13:14:40 2008 +0000
@@ -142,7 +142,8 @@
def checkIsHost(request, program):
- """Returns an alternate HTTP response if Google Account has no Host entity for the specified program.
+ """Returns an alternate HTTP response if Google Account has no Host entity
+ for the specified program.
Args:
request: A Django HTTP request
--- a/app/soc/views/helper/lists.py Sun Oct 19 13:06:20 2008 +0000
+++ b/app/soc/views/helper/lists.py Sun Oct 19 13:14:40 2008 +0000
@@ -40,15 +40,15 @@
def getPreferredListPagination(user=None):
- """Returns User's preferred list pagination limit.
-
- Args:
- user: User entity containing the list pagination preference;
- default is None, to use the current logged-in User
- """
- # TODO: eventually this limit should be a User profile preference
- # (stored in the site-wide User Model) preference
- return DEF_PAGINATION
+ """Returns User's preferred list pagination limit.
+
+ Args:
+ user: User entity containing the list pagination preference;
+ default is None, to use the current logged-in User
+ """
+ # TODO: eventually this limit should be a User profile preference
+ # (stored in the site-wide User Model) preference
+ return DEF_PAGINATION
def cleanListParameters(offset=None, limit=None):
--- a/app/soc/views/models/base.py Sun Oct 19 13:06:20 2008 +0000
+++ b/app/soc/views/models/base.py Sun Oct 19 13:14:40 2008 +0000
@@ -33,7 +33,6 @@
from soc.logic import dicts
from soc.logic import models
-from soc.logic import validate
from soc.views import simple
from soc.views import helper
from soc.views.helper import access
@@ -107,7 +106,7 @@
try:
entity = self._logic.getIfFields(**kwargs)
except soc.logic.out_of_band.ErrorResponse, error:
- template = soc._params['public_template']
+ template = _params['public_template']
return simple.errorResponse(request, error, template, context)
if not entity:
@@ -193,8 +192,8 @@
if not entity:
return http.HttpResponseRedirect('/')
- params=self._params['edit_params']
- #TODO(SRabbelier) Construct a suffix
+ params = self._params['edit_params']
+ # TODO(SRabbelier): Construct a suffix
suffix = None
# redirect to (possibly new) location of the entity
@@ -206,20 +205,20 @@
def editGet(self, request, entity, context):
"""Same as edit, but on GET
"""
- #TODO(SRabbelier) Construct a suffix
+ # TODO(SRabbelier): Construct a suffix
suffix = None
# Remove the params from the request, this is relevant only if
# someone bookmarked a POST page.
is_self_referrer = helper.requests.isReferrerSelf(request, suffix=suffix)
- if request.GET.get(DEF_SUBMIT_MSG_PARAM_NAME):
+ if request.GET.get(self.DEF_SUBMIT_MSG_PARAM_NAME):
if (not entity) or (not is_self_referrer):
return http.HttpResponseRedirect(request.path)
if entity:
# Note: no message will be displayed if parameter is not present
context['notice'] = helper.requests.getSingleIndexedParamValue(
- request, DEF_SUBMIT_MSG_PARAM_NAME,
+ request, self.DEF_SUBMIT_MSG_PARAM_NAME,
values=self._params['save_message'])
# populate form with the existing entity
@@ -297,7 +296,7 @@
entity = models.sponsor.logic.getIfFields(**kwargs)
except soc.logic.out_of_band.ErrorResponse, error:
template = self._templates['create']
- error.message = error.message + DEF_CREATE_NEW_ENTITY_MSG % {
+ error.message = error.message + self.DEF_CREATE_NEW_ENTITY_MSG % {
'entity_type_lower' : self._name,
'entity_type_upper' : self._Name,
'create' : self._redirects['create']
@@ -309,7 +308,8 @@
return http.HttpResponseRedirect('/')
if not self._logic.isDeletable(entity):
- # TODO: Update the notice area telling the user they can't delete the entity
+ # TODO: Update the notice area telling the user that they
+ # can't delete the entity
pass
self._logic.delete(entity)
--- a/app/soc/views/models/sponsor.py Sun Oct 19 13:06:20 2008 +0000
+++ b/app/soc/views/models/sponsor.py Sun Oct 19 13:14:40 2008 +0000
@@ -29,7 +29,7 @@
from django.utils.translation import ugettext_lazy
from soc.logic import dicts
-from soc.logic import validate
+from soc.logic import validate
from soc.views import helper
from soc.views.helper import widgets
from soc.views.models import base
--- a/app/soc/views/site/user/profile.py Sun Oct 19 13:06:20 2008 +0000
+++ b/app/soc/views/site/user/profile.py Sun Oct 19 13:14:40 2008 +0000
@@ -399,7 +399,7 @@
new_email = self.cleaned_data.get('id')
form_id = users.User(email=new_email)
if models.user.logic.getFromFields(email=form_id.email()):
- raise forms.ValidationError("This account is already in use.")
+ raise forms.ValidationError("This account is already in use.")
return form_id
--- a/app/soc/views/user/profile.py Sun Oct 19 13:06:20 2008 +0000
+++ b/app/soc/views/user/profile.py Sun Oct 19 13:14:40 2008 +0000
@@ -121,8 +121,8 @@
# try to fetch User entity corresponding to link_name if one exists
try:
- if link_name:
- link_name_user = id_user.getUserFromLinkNameOr404(link_name)
+ if link_name:
+ link_name_user = id_user.getUserFromLinkNameOr404(link_name)
except out_of_band.ErrorResponse, error:
# show custom 404 page when link name doesn't exist in Datastore
return simple.errorResponse(request, page, error, template, context)