Ignore:
Timestamp:
20 Dec 2011, 09:18:02 (13 years ago)
Author:
Henrik Bettermann
Message:

Harmonize sendMail method (work in progress).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r7358 r7402  
    219219        fullname = self.request.principal.title
    220220        try:
    221             email_from = self.request.principal.email
     221            email = self.request.principal.email
    222222        except AttributeError:
    223             email_from = self.config.email_admin
     223            email = self.config.email_admin
    224224        username = self.request.principal.id
    225225        usertype = getattr(self.request.principal,
    226226                           'user_type', 'system').title()
    227         body = data['body']
    228         email_to = self.config.email_admin
    229         subject = self.config.email_subject
    230227        sirp_utils = getUtility(ISIRPUtils)
    231         success = sirp_utils.sendMail(fullname,username,usertype,
    232                   self.config.name,body,email_from,email_to,subject)
     228        success = sirp_utils.sendMail(
     229                fullname,email,
     230                self.config.name_admin,self.config.email_admin,
     231                username,usertype,self.config.name,
     232                data['body'],self.config.email_subject)
    233233        if success:
    234234            self.flash('Your message has been sent.')
     
    246246    @grok.action('Send now')
    247247    def send(self, *args, **data):
    248         email_from = data['email_from']
    249         fullname = data['fullname']
    250         body = data['body']
    251         username = u'None'
    252         email_to = self.config.email_admin
    253         subject = self.config.email_subject
    254         usertype = u'Anonymous'
    255248        sirp_utils = getUtility(ISIRPUtils)
    256         success = sirp_utils.sendMail(fullname,username,usertype,
    257                   self.config.name,body,email_from,email_to,subject)
     249        success = sirp_utils.sendMail(
     250                data['fullname'],data['email_from'],
     251                self.config.name_admin,self.config.email_admin,
     252                u'None',u'Anonymous',self.config.name,
     253                data['body'],self.config.email_subject)
    258254        if success:
    259255            self.flash('Your message has been sent.')
     
    467463    @grok.action('Send message now')
    468464    def send(self, *args, **data):
    469         fullname = self.request.principal.title
    470465        try:
    471             email_from = self.request.principal.email
     466            email = self.request.principal.email
    472467        except AttributeError:
    473             email_from = self.config.email_admin
    474         username = self.request.principal.id
     468            email = self.config.email_admin
    475469        usertype = getattr(self.request.principal,
    476470                           'user_type', 'system').title()
    477         body = data['body']
    478         email_to = self.context.email
    479         subject = self.config.email_subject
    480471        sirp_utils = getUtility(ISIRPUtils)
    481         success = sirp_utils.sendMail(fullname,username,usertype,
    482                   self.config.name,body,email_from,email_to,subject)
     472        success = sirp_utils.sendMail(
     473                self.request.principal.title,email,
     474                self.context.title,self.context.email,
     475                self.request.principal.id,usertype,self.config.name,
     476                data['body'],self.config.email_subject)
    483477        if success:
    484478            self.flash('Your message has been sent.')
Note: See TracChangeset for help on using the changeset viewer.