コード例 #1
0
ファイル: massmessage.py プロジェクト: rowanthorpe/adhocracy
 def create(self, subject, body, recipients, sender_email, sender_name,
            instance, include_footer):
     send_message(subject, body, c.user, recipients,
                  sender_email=sender_email,
                  sender_name=sender_name,
                  instance=instance,
                  include_footer=include_footer)
     return ret_success(
         message=_("Message sent to %d users.") % len(recipients))
コード例 #2
0
 def create(self, subject, body, recipients, sender_email, sender_name,
            instance, include_footer):
     send_message(subject,
                  body,
                  c.user,
                  recipients,
                  sender_email=sender_email,
                  sender_name=sender_name,
                  instance=instance,
                  include_footer=include_footer)
     return ret_success(message=_("Message sent to %d users.") %
                        len(recipients))
コード例 #3
0
ファイル: message.py プロジェクト: alkadis/vcv
class MessageController(BaseController):
    def new(self, id, format='html', errors={}):
        c.page_user = get_entity_or_abort(model.User, id)
        require.user.message(c.page_user)
        html = render("/message/new.html", overlay=format == u'overlay')
        return htmlfill.render(html,
                               defaults=request.params,
                               errors=errors,
                               force_defaults=False)

    def create(self, id, format='html'):
        c.page_user = get_entity_or_abort(model.User, id)
        require.user.message(c.page_user)
        try:
            self.form_result = MessageCreateForm().to_python(request.params)
        except Invalid, i:
            return self.new(id, errors=i.unpack_errors())

        body = self.form_result.get('body')
        subject = self.form_result.get('subject')

        send_message(subject,
                     body,
                     c.user, [c.page_user],
                     instance=c.instance,
                     massmessage=False)

        h.flash(_("Your message has been sent. Thanks."), 'success')
        redirect(h.entity_url(c.page_user, instance=c.instance))
コード例 #4
0
    def create_proposal(self, proposal_id):
        c.proposal = get_entity_or_abort(Proposal, proposal_id)
        require.proposal.message(c.proposal)

        recipients = set()
        if self.form_result.get(u'supporters'):
            recipients.update(democracy.supporters(c.proposal.rate_poll))
        if self.form_result.get(u'opponents'):
            recipients.update(democracy.opponents(c.proposal.rate_poll))
        if self.form_result.get(u'creators'):
            recipients.update(c.proposal.get_creators())

        send_message(self.form_result.get('subject'),
                     self.form_result.get('body'),
                     c.user,
                     recipients,
                     instance=c.instance)
        h.flash(_("Message sent to %d users.") % len(recipients), 'success')
        redirect(h.entity_url(c.proposal))
コード例 #5
0
ファイル: massmessage.py プロジェクト: rowanthorpe/adhocracy
    def create_proposal(self, proposal_id):
        c.proposal = get_entity_or_abort(Proposal, proposal_id)
        require.proposal.message(c.proposal)

        recipients = set()
        if self.form_result.get(u'supporters'):
            recipients.update(democracy.supporters(c.proposal.rate_poll))
        if self.form_result.get(u'opponents'):
            recipients.update(democracy.opponents(c.proposal.rate_poll))
        if self.form_result.get(u'creators'):
            recipients.update(c.proposal.get_creators())

        send_message(self.form_result.get('subject'),
                     self.form_result.get('body'),
                     c.user,
                     recipients,
                     instance=c.instance)
        h.flash(_("Message sent to %d users.") % len(recipients), 'success')
        redirect(h.entity_url(c.proposal))