예제 #1
0
 def handle_edit_action(self, action, data):
     """"Save" button handler.
     """
     if not email_addresses_validator(data.get('receivers')):
         self.status = _(u'error_invalid_addresses',
                         default=u'At least one of the defined addresses '
                         'are not valid.')
     else:
         # call the super handle_edit_action, but the method is
         # wrapped in a @form.action(), so we need to extract it...
         super_action = FieldsetsEditForm.handle_edit_action
         super_action_method = super_action.success_handler
         return super_action_method(self, action, data)
예제 #2
0
from ftw.publisher.mailreport import _
from datetime import timedelta
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm


# annotation key of the date, when the last notification was triggered
LAST_NOTIFICATIONS_KEY = 'ftw.publisher.mailreport-last-notification'


INTERVAL_CONFIG = (
    # stored value, label i18n key, datetime dict
    ('hourly', _(u'interval_hourly'), timedelta(hours=1)),
    ('daily', _(u'interval_daily'), timedelta(days=1)),
    ('weekly', _(u'interval_weekly'), timedelta(days=7)))


INTERVAL_VOCABULARY = SimpleVocabulary(
    [SimpleTerm(key, title=_(label))
     for key, label, td
     in INTERVAL_CONFIG])
 def get_subject(self):
     return self.context.translate(
         _(u'mail_subject',
           default=u'Publisher report: ${site}',
           mapping=dict(site=self.context.getProperty('title'))))