Ejemplo n.º 1
0
 def create(self, data):
     chooser = INameChooser(self.container)
     obj = self.factory(id=u"temporary")
     utils.applyChanges(obj.__of__(self.container), self.form_fields, data)
     oid = chooser.chooseName(obj.title, obj)
     obj.id = oid
     return obj
Ejemplo n.º 2
0
    def handle_save_action(self, *args, **data):
        if utils.applyChanges(self.context, self.form_fields,
                        data, self.adapters):
            notify(ObjectModifiedEvent(self.context))
            notify(plone.EditSavedEvent(self.context))
            self.status = _(u"Changes saved")
        else:
            notify(plone.EditCancelledEvent(self.context))
            self.status = _(u"No changes")

        url = getMultiAdapter((self.context, self.request),
                              name='absolute_url')()
        self.request.response.redirect(url)