From c98d7db8c36507f67cb4b8854fff66213667cdf9 Mon Sep 17 00:00:00 2001 From: Pawel Solyga Date: Wed, 27 May 2009 01:47:38 +0200 Subject: [PATCH] Style and pylint fixes in Melange modules. --- app/soc/logic/helper/notifications.py | 3 ++- app/soc/logic/mail_dispatcher.py | 1 + app/soc/views/models/student.py | 4 +++- app/soc/views/models/student_project.py | 5 ++++- app/soc/views/models/student_proposal.py | 15 +++++++++++---- app/soc/views/models/user_self.py | 2 ++ 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/soc/logic/helper/notifications.py b/app/soc/logic/helper/notifications.py index 1af922bd..dd4dfc80 100644 --- a/app/soc/logic/helper/notifications.py +++ b/app/soc/logic/helper/notifications.py @@ -191,6 +191,7 @@ def sendNotification(to_user, from_user, message_properties, subject, template): 'scope_path': to_user.link_id } + # pylint: disable-msg=W0612 import soc.logic.models.notification key_name = model_logic.notification.logic.getKeyNameFromFields(fields) @@ -204,7 +205,7 @@ def sendNewNotificationMessage(notification_entity): Args: notification_entity: Notification about which the message should be sent """ - + # pylint: disable-msg=W0612 import soc.views.models.notification # create the url to show this notification diff --git a/app/soc/logic/mail_dispatcher.py b/app/soc/logic/mail_dispatcher.py index 33dd4322..7cfd7522 100644 --- a/app/soc/logic/mail_dispatcher.py +++ b/app/soc/logic/mail_dispatcher.py @@ -157,6 +157,7 @@ def getDefaultMailSender(): # and the GAE admin API is case sensitive user_entity = user_logic.logic.getForAccount(account) + # pylint: disable-msg=E1103 name = user_entity.name if user_entity else account.nickname() return (name, account.email()) diff --git a/app/soc/views/models/student.py b/app/soc/views/models/student.py index a4a02e86..e01fe6d1 100644 --- a/app/soc/views/models/student.py +++ b/app/soc/views/models/student.py @@ -155,7 +155,8 @@ class View(role.View): user_entity = user_logic.logic.getForCurrentAccount() params['create_form'] = params['user_create_form'] - + + # pylint: disable-msg=E1103 return self.create(request, access_type='unspecified', page_name=page_name, params=params, link_id=user_entity.link_id, **kwargs) @@ -171,6 +172,7 @@ class View(role.View): user_entity = user_logic.logic.getForCurrentAccount() + # pylint: disable-msg=E1103 fields = {'link_id': user_entity.link_id, 'scope_path': kwargs['scope_path']} diff --git a/app/soc/views/models/student_project.py b/app/soc/views/models/student_project.py index 9fd2386f..3d42dc16 100644 --- a/app/soc/views/models/student_project.py +++ b/app/soc/views/models/student_project.py @@ -75,7 +75,7 @@ class View(base.View): ('checkStudentProjectHasStatus', [['accepted', 'mid_term_passed']])] rights['manage_overview'] = [('checkHasActiveRoleForScope', org_admin_logic)] - # TODO lack of better name here! + # TODO: lack of better name here! rights['st_edit'] = ['checkIsMyStudentProject', ('checkStudentProjectHasStatus', [['accepted', 'mid_term_passed', 'passed']]) @@ -244,6 +244,7 @@ class View(base.View): mentor = mentor_logic.logic.getForFields(fields, unique=True) additional_mentors = entity.additional_mentors + # pylint: disable-msg=E1103 if additional_mentors and mentor.key() in additional_mentors: # remove the mentor from the additional mentors list additional_mentors.remove(mentor.key()) @@ -411,6 +412,7 @@ class View(base.View): additional_mentors = entity.additional_mentors + # pylint: disable-msg=E1103 if additional_mentors and mentor.key() in additional_mentors: # remove the mentor that is now becoming the primary mentor additional_mentors.remove(mentor.key()) @@ -453,6 +455,7 @@ class View(base.View): mentor = mentor_logic.logic.getForFields(fields, unique=True) # add this mentor to the additional mentors + # pylint: disable-msg=E1103 if not entity.additional_mentors: additional_mentors = [mentor.key()] else: diff --git a/app/soc/views/models/student_proposal.py b/app/soc/views/models/student_proposal.py index 9b2dada9..d5271ae4 100644 --- a/app/soc/views/models/student_proposal.py +++ b/app/soc/views/models/student_proposal.py @@ -147,7 +147,8 @@ class View(base.View): new_params['edit_template'] = 'soc/student_proposal/edit.html' new_params['review_template'] = 'soc/student_proposal/review.html' - new_params['review_after_deadline_template'] = 'soc/student_proposal/review_after_deadline.html' + new_params['review_after_deadline_template'] = \ + 'soc/student_proposal/review_after_deadline.html' params = dicts.merge(params, new_params) @@ -355,7 +356,7 @@ class View(base.View): if comment: # create a new public review containing the comment user_entity = user_logic.logic.getForCurrentAccount() - + # pylint: disable-msg=E1103 if user_entity.key() == entity.scope.user.key(): # student is posting reviewer = entity.scope @@ -401,6 +402,7 @@ class View(base.View): user_entity = user_logic.logic.getForCurrentAccount() # create the fields that should be in the ReviewFollower entity + # pylint: disable-msg=E1103 fields = {'link_id': user_entity.link_id, 'scope': entity, 'scope_path': entity.key().id_or_name(), @@ -446,6 +448,7 @@ class View(base.View): user_entity = user_logic.logic.getForCurrentAccount() # check if the current user is the student + # pylint: disable-msg=E1103 if user_entity.key() == student_entity.user.key(): # show the proposal edit link context['edit_link'] = redirects.getEditRedirect(entity, params) @@ -487,6 +490,7 @@ class View(base.View): if org_entity: # organization found use special form and also seed this form params['create_form'] = params['student_create_form'] + # pylint: disable-msg=E1103 kwargs['organization'] = org_entity.link_id kwargs['content'] = org_entity.contrib_template @@ -805,6 +809,7 @@ class View(base.View): user_entity = user_logic.logic.getForCurrentAccount() # create the fields that should be in the ReviewFollower entity + # pylint: disable-msg=E1103 fields = {'link_id': user_entity.link_id, 'scope': entity, 'scope_path': entity.key().id_or_name(), @@ -875,8 +880,9 @@ class View(base.View): return responses.respond(request, template, context=context) - def reviewAfterDeadline(self,request, context, params, entity,**kwargs): - """View that shows the review view after the accepted students announced deadline. + def reviewAfterDeadline(self, request, context, params, entity, **kwargs): + """View that shows the review view after the accepted students + announced deadline. For Args see base.View.public(). """ @@ -989,6 +995,7 @@ class View(base.View): follower_entity = review_follower_logic.getForFields(fields, unique=True) if follower_entity: + # pylint: disable-msg=E1103 context['is_subscribed_public'] = follower_entity.subscribed_public context['is_subscribed_private'] = follower_entity.subscribed_private diff --git a/app/soc/views/models/user_self.py b/app/soc/views/models/user_self.py index c10f50cb..5d5b5a99 100644 --- a/app/soc/views/models/user_self.py +++ b/app/soc/views/models/user_self.py @@ -150,6 +150,7 @@ class View(base.View): # set the link_id to the current user's link_id user_entity = user_logic.getForCurrentAccount() + # pylint: disable-msg=E1103 link_id = user_entity.link_id return self.edit(request, access_type, page_name=page_name, @@ -235,6 +236,7 @@ class View(base.View): user = user_logic.getForCurrentAccount() # only select the roles for the current user + # pylint: disable-msg=E1103 filter = { 'link_id': user.link_id, 'status': ['active', 'inactive'] -- 2.11.4.GIT