def edit(self, objid): """View method for edit. Enforce permissions, load the record, and call `add_edit`.""" def action(): obj = self.init_object(objid, 'edit') return self.add_edit(flask.request.method, obj) return requires_permissions(self.permissions['edit'])(action)()
def delete(self, objid): def action(): self.init_object(objid, 'delete') try: self.orm_cls.delete(objid) except sa.exc.IntegrityError: return self.on_delete_failure() return self.on_delete_success() return requires_permissions(self.permissions['delete'])(action)()
def delete(self, objid): """View method for delete. Enforce permissions, load the record, run ORM delete. If delete succeeds, return result of `on_delete_success`. If delete fails, return result of `on_delete_failure`. """ def action(): self.init_object(objid, 'delete') try: self.orm_cls.delete(objid) except sa.exc.IntegrityError: return self.on_delete_failure() return self.on_delete_success() return requires_permissions(self.permissions['delete'])(action)()
def list(self): return requires_permissions(self.permissions['list'])(self.render_grid)()
def edit(self, objid): def action(): obj = self.init_object(objid, 'edit') return self.add_edit(flask.request.method, obj) return requires_permissions(self.permissions['edit'])(action)()
def add(self): return requires_permissions(self.permissions['add'])(self.add_edit)(flask.request.method)
def list(self): """View method for list. Enforce permissions, then render grid via `render_grid`.""" return requires_permissions(self.permissions['list'])(self.render_grid)()
def add(self): """View method for add. Enforce permissions and call `add_edit`.""" return requires_permissions(self.permissions['add'])(self.add_edit)(flask.request.method)