예제 #1
0
    def applyChanges(self, data):
        content = self.getContent()
        content.update(data)
        content = utils.prepare_data(content)

        chef_tool = queryUtility(IChefTool)
        if chef_tool:
            chef_tool.edit_databag_item(self.parent, self.item_name, content)
            return content

        return None
예제 #2
0
    def createAndAdd(self, data):
        chef_tool = queryUtility(IChefTool)
        if not chef_tool:
            return None

        data = utils.prepare_data(data)
        self.item_name = data.get("id")

        try:
            return chef_tool.create_databag_item(self.parent, self.item_name, data)
        except ChefError as e:
            api.portal.show_message(e.message, request=self.request, type="error")