Пример #1
0
    def __init__(self):
        super(LDAPAuthentication, self).__init__()
        config = dict()
        self._config = get_config()

        fields = dict([(i.lower(), i) for i in ILDAPAuthentication])
        for key, value in self._config.iteritems():
            if not key.lower() in fields.keys():
                continue
            if not value:
                value = ILDAPAuthentication[fields[key]].default
            config[fields[key]] = value
        applyData(self, grok.Fields(ILDAPAuthentication), config)
        self.adapterName = "mailcone-authentication-ldap"
Пример #2
0
 def applyChanges(self, data):
     content = self.context
     changes = form.applyData(content, self.form_fields, data, self.adapters)
     # ``changes`` is a dictionary; if empty, there were no changes
     if changes:
         content.reindexObject()
     return changes
Пример #3
0
 def applyChanges(self, data):
     content = self.context
     changes = form.applyData(content, self.form_fields, data,
                              self.adapters)
     # ``changes`` is a dictionary; if empty, there were no changes
     if changes:
         content.reindexObject()
     return changes
Пример #4
0
 def handle_rename_action(self, action, data):
     context = aq_inner(self.context)
     oldid = context.getId()
     oldtranslatedids = self.handler.get_translated_ids(oldid)
     descriptions = applyData(context, self.form_fields, data, self.adapters)
     statusmessage = IStatusMessage(self.request)
     if descriptions:
         statusmessage.addStatusMessage(_p(u'Changes saved.'), u'success');
     else:
         statusmessage.addStatusMessage(_p(u'No changes made.'));
     self.request.RESPONSE.redirect(context.absolute_url())
Пример #5
0
    def POST(self):
        validate_proper_contenttype(self.request)
        order_data = parse_json(self.body)
        order_data = self.coerce_order_data(order_data)

        item_list = []
        for item_data in order_data['item_list']:
            item_data = self.coerce_item_data(item_data)

            item = Item()
            applyData(item, grok.Fields(IItem), item_data)
            item_list.append(item)

        order_data['item_list'] = item_list

        order = Order()
        applyData(order, grok.Fields(IOrder), order_data)

        self.context.add(order)

        self.response.setHeader('Location', self.url(order))
        self.response.setStatus('201')
        return ''
Пример #6
0
 def applyChanges(self, data):
     return form.applyData(self.getContent(), self.form_fields, data,
                           self.adapters)
Пример #7
0
 def applyChanges(self, data):
     return form.applyData(self.getContent(), self.form_fields, data,
                           self.adapters)