# HG changeset patch # User Sverre Rabbelier # Date 1232407523 0 # Node ID ddd102e821070de716a79f15648191ec0c7b3530 # Parent 98996e11b604432c09feefde0a6770313c255dee Fixed whitespace damage Patch by: Sverre Rabbelier diff -r 98996e11b604 -r ddd102e82107 app/soc/logic/helper/notifications.py --- a/app/soc/logic/helper/notifications.py Mon Jan 19 16:23:37 2009 +0000 +++ b/app/soc/logic/helper/notifications.py Mon Jan 19 23:25:23 2009 +0000 @@ -46,6 +46,7 @@ DEF_WELCOME_MSG_FMT = ugettext_lazy("Welcome to Melange %(name)s,") + def sendInviteNotification(entity): """Sends out an invite notification to the user the request is for. @@ -103,6 +104,7 @@ notification_logic.updateOrCreateFromFields(fields, notification_logic.getKeyFieldsFromDict(fields)) + def sendNewNotificationMessage(notification_entity): """Sends an email to a user about a new notification @@ -140,6 +142,7 @@ mail_dispatcher.sendMailFromTemplate('soc/mail/new_notification.html', messageProperties) + def sendWelcomeMessage(user_entity): """Sends out a welcome message to a user. diff -r 98996e11b604 -r ddd102e82107 app/soc/logic/models/request.py --- a/app/soc/logic/models/request.py Mon Jan 19 16:23:37 2009 +0000 +++ b/app/soc/logic/models/request.py Mon Jan 19 23:25:23 2009 +0000 @@ -62,8 +62,8 @@ def _onCreate(self, entity): """Sends out a message notifying users about the new invite/request. """ - - if entity.group_accepted: + + if entity.group_accepted: # this is an invite notifications.sendInviteNotification(entity) elif entity.user_accepted: diff -r 98996e11b604 -r ddd102e82107 app/soc/views/models/club_app.py --- a/app/soc/views/models/club_app.py Mon Jan 19 16:23:37 2009 +0000 +++ b/app/soc/views/models/club_app.py Mon Jan 19 23:25:23 2009 +0000 @@ -50,7 +50,7 @@ Params: params: a dict with params for this View - """ + """ rights = {} rights['create'] = [access.checkIsUser] @@ -75,16 +75,16 @@ ), 'clean_backup_admin_link_id': cleaning.clean_existing_user('backup_admin_link_id'), } - + patterns = [(r'^%(url_name)s/(?Preview)$', 'soc.views.models.%(module_name)s.showReviewOverview', 'Review %(name_plural)s'), (r'^%(url_name)s/(?Preview)/%(lnp)s$', 'soc.views.models.%(module_name)s.review', 'Review %(name_short)s')] - + new_params['extra_django_patterns'] = patterns - + new_params['name'] = "Club Application" new_params['name_plural'] = "Club Applications" new_params['name_short'] = "Club App" @@ -93,7 +93,7 @@ new_params['sidebar_additional'] = [ ('/%(url_name)s/review' % new_params, 'Review %(name_plural)s' % new_params, 'review')] - + new_params['review_template'] = 'soc/club_app/review.html' params = dicts.merge(params, new_params) @@ -146,37 +146,36 @@ if not entity: fields['applicant'] = user_logic.logic.getForCurrentAccount() - + # the application has either been created or edited so # the review status needs to be set accordingly fields['reviewed'] = False fields['accepted'] = False - + def _public(self, request, entity, context): """See base._public(). """ - + context['entity_type_url'] = self._params['url_name'] - def review(self, request, access_type, page_name=None, params=None, **kwargs): """Handles the view containing the review of an application. - - accepted (true or false) in the GET data will mark - the application accordingly. - - + + accepted (true or false) in the GET data will mark + the application accordingly. + + For params see base.View.public(). """ - + params = dicts.merge(params, self._params) - + try: access.checkAccess(access_type, request, rights=params['rights']) except out_of_band.Error, error: return helper.responses.errorResponse(error, request) - + # create default template context for use with any templates context = helper.responses.getUniversalContext(request) context['page_name'] = page_name @@ -188,15 +187,15 @@ except out_of_band.Error, error: return helper.responses.errorResponse( error, request, template=params['error_public'], context=context) - + get_dict = request.GET - + # check to see if we can make a decision for this application if 'accepted' in get_dict.keys(): accepted_value = get_dict['accepted'] - + fields = {'reviewed' : False} - + if accepted_value == 'true': # the application has been accepted fields['accepted'] = True @@ -205,17 +204,17 @@ # the application has been denied fields['accepted'] = False fields['reviewed'] = True - - if fields['reviewed']: + + if fields['reviewed']: # the application has either been denied or accepted # mark it as reviewed and update accordingly application = self._logic.getFromFields(link_id=kwargs['link_id']) self._logic.updateModelProperties(application, fields) - - return self.showReviewOverview(request, access_type, + + return self.showReviewOverview(request, access_type, page_name=page_name, params=params, **kwargs) - # the application has nog been reviewed so show the information + # the application has not been reviewed so show the information # using the appropriate review template params['public_template'] = params['review_template'] @@ -243,7 +242,7 @@ request, ur_params, filter, 0) # only select the requests that haven't been turned into a group yet - filter = {'accepted' : True, + filter = {'accepted' : True, 'application_completed' : False} uh_params = params.copy() @@ -257,18 +256,18 @@ #only select the requests the have been denied filter = {'reviewed' : True, 'accepted' : False} - + den_params = params.copy() den_params['list_description'] = ugettext_lazy('A list of all applications ' 'that have been denied') den_params ['list_action'] = (redirects.getReviewRedirect, params) - + den_list = helper.lists.getListContent( request, den_params, filter, 0) - + # fill contents with all the needed lists contents = [ur_list, uh_list, den_list] - + # call the _list method from base to display the list return self._list(request, params, contents, page_name)