Пример #1
0
 def idCheck(self, container, id):
     """ return True if the the id can be used or False if a view allready are in the way
     """
     if id in container:
         return False
     if queryMultiAdapter((container, utils.getRequest()), name=id):
         return False
     return True
Пример #2
0
 def _json_properties(self, factory):
     request = utils.getRequest()
     widgets = form.setUpEditWidgets(factory.form_fields, form_prefix=self.properties_prefix,
                                     request=request, context=self)
     properties = dict()
     for widget in widgets:
         properties.update({widget.name:widget._getCurrentValue()})
     return properties
Пример #3
0
 def _apply_properties(self, data, factory):
     request = utils.getRequest()
     fake = copy.copy(request)
     fake.form = data
     widgets = form.setUpWidgets(factory.form_fields, form_prefix=self.properties_prefix,
                                 request=fake, context=self)
     results = dict()
     form.getWidgetsData(widgets, self.properties_prefix, results)
     formlib.apply_data_event(self, factory.form_fields, results,
                              adapters=None, update=False)
def vocabulary_propose(context):
    index = 0
    terms = list()
    for field in grok.AutoFields(interfaces.IMail):
        if IList.providedBy(field.field):
            continue
        name = '(Mail) %s' % field.field.title
        index += 1
        value = 'placeholder_field_%s' % index
        terms.append(vocabulary.SimpleTerm(value=value,
                                           token=field.field.getName(),
                                           title=name))
    terms.append(vocabulary.SimpleTerm(value=datetime.now().strftime('%Y-%m-%d%T%H:%M:%S'),
                                       token='datetime_now',
                                       title=translate(_('Date Time'), context=utils.getRequest())))
    terms.append(vocabulary.SimpleTerm(value=datetime.now().strftime('%Y-%m-%d'),
                                       token='date_now',
                                       title=translate(_('Date'), context=utils.getRequest())))
    terms.append(vocabulary.SimpleTerm(value=datetime.now().strftime('%H:%M:%S'),
                                       token='time_now',
                                       title=translate(_('Time'), context=utils.getRequest())))
    return vocabulary.SimpleVocabulary(terms)
Пример #5
0
 def send(self, message, subject, toaddr=list(), fraddr = None):
     if not isinstance(toaddr, (list,tuple,)):
         toaddr = [toaddr]
     if fraddr is None:
         fraddr = self.fraddr
     request = utils.getRequest()
     msg = MIMEText(translate(message, context=request), 'plain', 'utf-8')
     msg['Subject'] = translate(subject, context=request)
     msg['From'] = fraddr
     msg['To'] = ', '.join(toaddr)
     
     self.connect()
     self._v_connection.sendmail(fraddr, toaddr, msg.as_string())
 def __init__(self, message, ruleitem):
     msg = 'Error in ruleitem "%s": %s' % (ruleitem.title, translate(message, context=utils.getRequest()))
     super(RuleItemException, self).__init__(msg)
     self.message = message
     self.ruleitem = ruleitem
Пример #7
0
 def _calendar(self):
     return utils.getRequest().locale.dates.calendars['gregorian']
 def box_edit(self):
     return grok.url(utils.getRequest(), self.context, 'wireit_edit_raptus_mailcone_pythoncode')
 def _translate(self, msg):
     return translate(msg, context=utils.getRequest())
Пример #10
0
 def box_edit(self):
     return '%s/wireit_edit' % grok.url(utils.getRequest(), self.context)
Пример #11
0
 def box_delete(self):
     return '%s/wireit_delete' % grok.url(utils.getRequest(), self.context)
Пример #12
0
 def translate(self, msg):
     txt = translate(msg, context=utils.getRequest())
     return saxutils.escape(txt)
 def box_edit(self):
     return grok.url(utils.getRequest(), self.context, 'wireit_edit_raptus_mailcone_missing_email')