Ignore:
Timestamp:
7 Jul 2016, 06:18:06 (8 years ago)
Author:
Henrik Bettermann
Message:

Inform applicant how many emails were sent.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r14014 r14016  
    11761176        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    11771177        failed = ''
     1178        emails_sent = 0
    11781179        for referee in self.context.referees:
    11791180            if referee.email_sent:
     
    11931194            success = kofa_utils.inviteReferee(referee, self.context, url_info)
    11941195            if success:
     1196                emails_sent += 1
    11951197                self.context.writeLogMessage(
    11961198                    self, 'email sent: %s' % referee.email)
     
    11981200            else:
    11991201                failed += '%s ' % referee.email
    1200         return failed
     1202        return failed, emails_sent
    12011203
    12021204    @action(_('Finally Submit'), warning=WARNING)
     
    12181220        # Create mandates and send emails to referees
    12191221        if getattr(self.context, 'referees', None):
    1220             failed = self.informReferees()
     1222            failed, emails_sent = self.informReferees()
    12211223            if failed:
    12221224                self.flash(
     
    12251227                return
    12261228            msg = _('Form has been successfully submitted and '
    1227                     'all invitation emails were sent.')
     1229                    '${a} invitation emails were sent.',
     1230                    mapping = {'a':  emails_sent})
    12281231        IWorkflowInfo(self.context).fireTransition('submit')
    12291232        # application_date is used in export files for sorting.
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r14014 r14016  
    16771677        self.assertTrue(
    16781678            'Application submitted' in self.browser.contents)
     1679        self.assertTrue(
     1680            'Form has been successfully submitted and 2 '
     1681            'invitation emails were sent.' in self.browser.contents)
    16791682        logfile = os.path.join(
    16801683            self.app['datacenter'].storage, 'logs', 'applicants.log')
     
    16871690        self.assertTrue(referee1.email_sent)
    16881691        self.assertTrue(referee2.email_sent)
    1689         return
     1692        # If the form is being resubmitted, no more emails will be sent
     1693        IWorkflowState(self.applicant).setState('paid')
     1694        self.applicant.locked = False
     1695        self.browser.open(self.edit_path)
     1696        self.browser.getControl(name="confirm_passport").value = True
     1697        self.browser.getControl("Finally Submit").click()
     1698        self.assertTrue(
     1699            'Form has been successfully submitted and 0 '
     1700            'invitation emails were sent.' in self.browser.contents)
     1701        return
  • main/waeup.kofa/trunk/src/waeup/kofa/tests/test_smtp.py

    r11778 r14016  
    6161        myself = __file__
    6262        if myself.endswith('.pyc'):
    63             myself = myself[:-2]
     63            myself = myself[:-1]
    6464        print "WARNING: external mail tests are skipped!"
    6565        print "WARNING: edit %s to enable them." % myself
Note: See TracChangeset for help on using the changeset viewer.