def get(self, name): session_id = get_session_id(session, request) dao = DomainPropertyDAO(session_id) domain_property = dao.get_domain_property_by_name(name=name) dao.close() resp = make_response(json_serialize(domain_property, session_id=session_id), 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 = DomainPropertyDAO(session_id) domain_properties = dao.get_domain_properties(constraint_id=constraint_id) dao.close() resp = make_response(json_serialize(domain_properties, session_id=session_id), httplib.OK) resp.contenttype = 'application/json' return resp
def delete(self, name): session_id = get_session_id(session, request) dao = DomainPropertyDAO(session_id) dao.delete_domain_property(name=name) dao.close() resp_dict = {'message': 'DomainProperty successfully deleted'} resp = make_response(json_serialize(resp_dict), httplib.OK) resp.headers['Content-type'] = 'application/json' return resp
def put(self, name): session_id = get_session_id(session, request) dao = DomainPropertyDAO(session_id) req = dao.from_json(request) dao.update_domain_property(req, name=name) dao.close() resp_dict = {'message': 'DomainProperty 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 = DomainPropertyDAO(session_id) new_domain_property = dao.from_json(request) dao.add_domain_property(new_domain_property) dao.close() resp_dict = {'message': 'DomainProperty successfully added'} 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 = DomainPropertyDAO(session_id) dao.delete_domain_property(name=name) dao.close() resp_dict = {'message': name + ' 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 = DomainPropertyDAO(session_id) req = dao.from_json(request) dao.update_domain_property(req, name=name) dao.close() resp_dict = {'message': 'DomainProperty successfully updated'} resp = make_response(json_serialize(resp_dict), OK) resp.headers['Content-type'] = 'application/json' return resp