def handleAdd(self): data, errors = self.extractData() if errors: self.flash('Es sind Fehler aufgetreten') return obj = self.createAndAdd(data) if obj is not None: # mark only as finished if we get the new object self._finishedAdd = True grok.notify(AfterSaveEvent(obj, self.request))
def createAndAdd(self, data): obj = self.create(data) grok.notify(zope.lifecycleevent.ObjectCreatedEvent(obj)) self.add(obj) return obj