def save(_handler, artigo_id, **artigo_properties): cmd = facade.update_artigo_cmd(artigo_id, **artigo_properties) try: cmd() except CommandExecutionException: context = {'errors': cmd.errors, 'artigo': cmd.form} return TemplateResponse(context, 'artigos/admin/form.html') _handler.redirect(router.to_path(admin))
def update(artigo_id, **artigo_properties): cmd = facade.update_artigo_cmd(artigo_id, **artigo_properties) return _save_or_update_json_response(cmd)