def put(self, persona_name): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) persona_prop = dao.from_json(request, to_props=True) dao.update_persona_properties(persona_prop, name=persona_name) dao.close() resp_dict = {'message': 'The persona properties were successfully updated.'} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.contenttype = 'application/json' return resp
def put(self, persona_name): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) persona_prop = dao.from_json(request, to_props=True) dao.update_persona_properties(persona_prop, name=persona_name) dao.close() resp_dict = {'message': 'The persona properties were successfully updated.'} resp = make_response(json_serialize(resp_dict), OK) resp.contenttype = 'application/json' return resp
def put(self, name): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) req = dao.from_json(request) dao.update_persona(req, name=name) dao.close() resp_dict = {'message': 'Persona successfully updated'} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def post(self): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) new_persona = dao.from_json(request) persona_id = dao.add_persona(new_persona) dao.close() resp_dict = {'message': 'Persona successfully added', 'persona_id': persona_id} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.contenttype = 'application/json' return resp
def post(self): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) new_persona = dao.from_json(request) dao.add_persona(new_persona) dao.close() resp_dict = {'message': 'Persona successfully added'} resp = make_response(json_serialize(resp_dict), OK) resp.contenttype = 'application/json' return resp