def get(self): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) objts = dao.get_personas_summary() dao.close() resp = make_response(json_serialize(objts, session_id=session_id)) resp.headers['Content-Type'] = "application/json" return resp
def get(self, persona_name): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) persona_props = dao.get_persona_props(name=persona_name) dao.close() resp = make_response(json_serialize(asset_props, session_id=session_id)) resp.contenttype = 'application/json' return resp
def get(self): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) pTypes = dao.get_persona_types() dao.close() resp = make_response(json_serialize(pTypes, session_id=session_id), OK) resp.contenttype = 'application/json' return resp
def get(self): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) pTypes = dao.get_persona_types() dao.close() resp = make_response(json_serialize(pTypes, session_id=session_id), httplib.OK) resp.contenttype = 'application/json' return resp
def get(self): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) persona_names = dao.get_persona_names() dao.close() resp = make_response(json_serialize(persona_names, session_id=session_id), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def get(self, name): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) persona = dao.get_persona_by_name(name=name) dao.close() resp = make_response(json_serialize(persona, session_id=session_id), OK) resp.headers['Content-type'] = 'application/json' return resp
def get(self): session_id = get_session_id(session, request) constraint_id = request.args.get('constraint_id', -1) dao = PersonaDAO(session_id) personas = dao.get_personas(constraint_id=constraint_id) dao.close() resp = make_response(json_serialize(personas, session_id=session_id), OK) resp.contenttype = 'application/json' return resp
def get(self): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) persona_names = dao.get_persona_names() dao.close() resp = make_response( json_serialize(persona_names, session_id=session_id), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def delete(self, name): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) dao.delete_persona(name=name) dao.close() resp_dict = {'message': 'Persona successfully deleted'} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def get(self): session_id = get_session_id(session, request) constraint_id = request.args.get('constraint_id', -1) dao = PersonaDAO(session_id) personas = dao.get_personas(constraint_id=constraint_id) dao.close() resp = make_response(json_serialize(personas, session_id=session_id), 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) 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 get(self, persona, variable, characteristic): session_id = get_session_id(session, request) model_generator = get_model_generator() dao = PersonaDAO(session_id) if (variable == 'All' or variable == 'all'): variable = '' if (characteristic == 'All' or characteristic == 'all'): characteristic = '' char_names = dao.get_persona_characteristics(persona,variable,characteristic) dao.close() resp = make_response(json_serialize(char_names, session_id=session_id), OK) resp.headers['Content-type'] = 'application/json' return resp
def get(self, persona, variable, characteristic): session_id = get_session_id(session, request) model_generator = get_model_generator() dao = PersonaDAO(session_id) if variable == 'All': variable = '' if characteristic == 'All': characteristic = '' char_names = dao.get_persona_characteristics(persona,variable,characteristic) dao.close() resp = make_response(json_serialize(char_names, session_id=session_id), OK) resp.headers['Content-type'] = 'application/json' return resp
def get(self, persona): session_id = get_session_id(session, request) model_generator = get_model_generator() dao = PersonaDAO(session_id) dot_code = dao.get_persona_model(persona) dao.close() resp = make_response(model_generator.generate(dot_code, model_type='persona'), httplib.OK) accept_header = request.headers.get('Accept', 'image/svg+xml') if accept_header.find('text/plain') > -1: resp.headers['Content-type'] = 'text/plain' else: resp.headers['Content-type'] = 'image/svg+xml' return resp
def get(self, persona, variable, characteristic): session_id = get_session_id(session, request) model_generator = get_model_generator() dao = PersonaDAO(session_id) if (variable == 'All' or variable == 'all'): variable = '' if (characteristic == 'All' or characteristic == 'all'): characteristic = '' dot_code = dao.get_persona_model(persona,variable,characteristic) dao.close() resp = make_response(model_generator.generate(dot_code, model_type='persona', renderer='dot'), OK) accept_header = request.headers.get('Accept', 'image/svg+xml') if accept_header.find('text/plain') > -1: resp.headers['Content-type'] = 'text/plain' else: resp.headers['Content-type'] = 'image/svg+xml' return resp
def get(self, persona, variable, characteristic): session_id = get_session_id(session, request) model_generator = get_model_generator() dao = PersonaDAO(session_id) if variable == 'All': variable = '' if characteristic == 'All': characteristic = '' dot_code = dao.get_persona_model(persona,variable,characteristic) dao.close() resp = make_response(model_generator.generate(dot_code, model_type='persona', renderer='dot'), OK) accept_header = request.headers.get('Accept', 'image/svg+xml') if accept_header.find('text/plain') > -1: resp.headers['Content-type'] = 'text/plain' else: resp.headers['Content-type'] = 'image/svg+xml' 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 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
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 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 delete(self, name): session_id = get_session_id(session, request) dao = PersonaDAO(session_id) dao.delete_persona(name=name) dao.close() resp_dict = {'message': 'Persona successfully deleted'} resp = make_response(json_serialize(resp_dict), OK) resp.headers['Content-type'] = '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), OK) resp.headers['Content-type'] = 'application/json' return resp