Ignore:
Timestamp:
4 Nov 2020, 22:25:27 (4 years ago)
Author:
Henrik Bettermann
Message:

Configure Cc and Bcc properly.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

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

    r16299 r16300  
    350350        entries.sort()
    351351        deleted = []
    352         emails_tobesent = ''
     352        emails_tobesent = []
    353353        for entry in entries:
    354354            if 'remove' in form:
     
    356356                deleted.append(entry)
    357357            if 'send_email' in form and self.context[entry].email:
    358                 emails_tobesent += '%s,' % encode_address(
     358                emails_tobesent.append((
    359359                    self.context[entry].email,
    360                     self.context[entry].student_id)
     360                    self.context[entry].student_id))
    361361        if 'send_email' in form and not len(emails_tobesent):
    362362            self.flash(_('No email address found.'), type="warning")
    363363            return
    364364        if len(emails_tobesent):
    365             args = {'bcc_to': emails_tobesent.strip(',')}
     365            args = {'bcc_to': emails_tobesent}
    366366            self.redirect(self.url(self.context) +
    367367                '/send_bulk_email?%s' % urlencode(args))
     
    570570                self.config.name,
    571571                data['body'],data['subject'],
    572                 data['bcc_to'])
     572                eval(data['bcc_to'])
     573                )
    573574        if success:
    574575            self.flash(_('Your message has been sent.'))
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r16299 r16300  
    476476        ctrl.getControl(value='K1000001').selected = True
    477477        self.browser.getControl("Send bulk", index=0).click()
    478         self.assertTrue('K1000000 <aa@aa.ng>,K1000001 <uli@uni.ng>'
     478        self.assertTrue("[('aa@aa.ng', u'K1000000'), ('uli@uni.ng', u'K1000001')]"
    479479            in self.browser.contents)
    480480        self.browser.getControl(name="form.subject").value = 'Test'
     
    483483        self.assertTrue('Your message has been sent' in self.browser.contents)
    484484        self.assertMatches(
    485         u'Sending email from no-reply@waeup.org to contact@waeup.org:\n'
     485        u'Sending email from no-reply@waeup.org to contact@waeup.org, aa@aa.ng, uli@uni.ng:\n'
    486486        u'Message:\n'
    487487        u'msg: MIME-Version: 1.0\n'
     
    490490        u'msg: From: Manager <no-reply@waeup.org>\n'
    491491        u'msg: To: Manager <contact@waeup.org>\n'
    492         u'msg: Bcc: K1000000 <aa@aa.ng>,K1000001 <uli@uni.ng>\n'
     492        u'msg: Bcc: K0000000 <aa@aa.ng>\n'
     493        u'msg: Bcc: K0000001 <uli@uni.ng>\n'
    493494        u'msg: Reply-To: Manager <contact@waeup.org>\n'
    494495        u'msg: Subject: Test\n'
Note: See TracChangeset for help on using the changeset viewer.