# HG changeset patch # User Pawel Solyga # Date 1233141761 0 # Node ID 43fdf6739e8d800379cea626f4813bf9792e9138 # Parent 9633a6a5e5f92ce90926aa9786d7ed75b17bf3e5 Style fixes in soc.logic.cleaning module. Patch by: Pawel Solyga Reviewed by: to-be-reviewed diff -r 9633a6a5e5f9 -r 43fdf6739e8d app/soc/logic/cleaning.py --- a/app/soc/logic/cleaning.py Wed Jan 28 11:21:58 2009 +0000 +++ b/app/soc/logic/cleaning.py Wed Jan 28 11:22:41 2009 +0000 @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Generic cleaning methods +"""Generic cleaning methods. """ __authors__ = [ @@ -50,7 +50,8 @@ if not validate.isLinkIdFormatValid(link_id): raise forms.ValidationError("This link ID is in wrong format.") - user_entity = user_logic.logic.getForFields({'link_id' : link_id}, unique=True) + user_entity = user_logic.logic.getForFields({'link_id': link_id}, + unique=True) if not user_entity: # user does not exist @@ -71,7 +72,8 @@ if not validate.isLinkIdFormatValid(link_id): raise forms.ValidationError("This link ID is in wrong format.") - user_entity = user_logic.logic.getForFields({'link_id' : link_id}, unique=True) + user_entity = user_logic.logic.getForFields({'link_id': link_id}, + unique=True) if user_entity: # user exists already @@ -80,6 +82,7 @@ return link_id return wrapped + def clean_users_not_same(field_name): """Check if the field_name field is a valid user and is not equal to the current user. @@ -94,7 +97,7 @@ if user_entity.key() == current_user_entity.key(): # users are equal - raise forms.ValidationError("You cannot enter yourself here") + raise forms.ValidationError("You cannot enter yourself here.") return user_entity return wrapped @@ -124,7 +127,7 @@ # get the user account for this email and check if it's in use user_account = users.User(email_adress) - fields = {'account' : user_account} + fields = {'account': user_account} user_entity = user_logic.logic.getForFields(fields, unique=True) if user_entity or user_logic.logic.isFormerAccount(user_account): @@ -146,6 +149,7 @@ return feed_url + def clean_url(field_name): """Clean method for cleaning a field belonging to a LinkProperty. """ @@ -190,12 +194,13 @@ # get the user having the given account fields = {'account': user_account} - user_from_account_entity = user_logic.logic.getForFields(fields, unique=True) + user_from_account_entity = user_logic.logic.getForFields(fields, + unique=True) # if there is a user with the given account or it's a former account if user_from_account_entity or user_logic.logic.isFormerAccount(user_account): # raise an error because this email address can't be used - raise forms.ValidationError("There is already a user with this email adress.") + raise forms.ValidationError("There is already a user with this email adress.") return cleaned_data return wrapper