# HG changeset patch # User Todd Larsen # Date 1227255232 0 # Node ID b74bf6bf1ccf9359269f77e1691d28ef33068b8c # Parent 8d5adb2b8d48f8136ea7e221d4d282aab95affcf Make editSelf() work by adding 'inheritance_line' to the list of excluded fields in the UserForm. Also, fix a few too-long lines and add some missing parentheses (the style guide says do not rely on operator precedence). Patch by: Todd Larsen diff -r 8d5adb2b8d48 -r b74bf6bf1ccf app/soc/views/models/user.py --- a/app/soc/views/models/user.py Fri Nov 21 07:36:44 2008 +0000 +++ b/app/soc/views/models/user.py Fri Nov 21 08:13:52 2008 +0000 @@ -70,14 +70,14 @@ properties = {'link_id': link_id} user = soc.logic.models.user.logic.getForFields(properties, unique=True) - link_id_user = soc.logic.models.user.logic.getForFields(properties, unique=True) - + link_id_user = soc.logic.models.user.logic.getForFields(properties, + unique=True) key_name = self.data.get('key_name') if key_name: key_name_user = user_logic.logic.getFromKeyName(key_name) - if link_id_user and key_name_user and \ - link_id_user.account != key_name_user.account: + if (link_id_user and key_name_user + and (link_id_user.account != key_name_user.account)): raise forms.ValidationError("This link ID is already in use.") return link_id @@ -117,7 +117,8 @@ model = soc.models.user.User #: list of model fields which will *not* be gathered by the form - exclude = ['account', 'former_accounts', 'is_developer'] + exclude = ['account', 'former_accounts', 'is_developer', + 'inheritance_line'] def clean_link_id(self): link_id = self.cleaned_data.get('link_id') @@ -231,9 +232,11 @@ if soc.logic.models.user.logic.isFormerAccount(account): msg = DEF_USER_ACCOUNT_INVALID_MSG error = out_of_band.ErrorResponse(msg) - return simple.errorResponse(request, page_name, error, template, context) + return simple.errorResponse(request, page_name, error, template, + context) - user = soc.logic.models.user.logic.updateOrCreateFromFields(properties, {'link_id': new_link_id}) + user = soc.logic.models.user.logic.updateOrCreateFromFields( + properties, {'link_id': new_link_id}) # redirect to /user/profile?s=0 # (causes 'Profile saved' message to be displayed)