示例#1
0
  def get(self, name):
    session_id = get_session_id(session, request)

    dao = TemplateRequirementDAO(session_id)
    found_tr = dao.get_template_requirement(name)
    dao.close()

    resp = make_response(json_serialize(found_tr, session_id=session_id))
    resp.headers['Content-Type'] = "application/json"
    return resp
示例#2
0
  def get(self):
    session_id = get_session_id(session, request)
    constraint_id = request.args.get('constraint_id', -1)

    dao = TemplateRequirementDAO(session_id)
    trs = dao.get_template_requirements(constraint_id=constraint_id)
    dao.close()

    resp = make_response(json_serialize(trs, session_id=session_id))
    resp.headers['Content-Type'] = "application/json"
    return resp
示例#3
0
  def delete(self, name):
    session_id = get_session_id(session, request)

    dao = TemplateRequirementDAO(session_id)
    dao.delete_template_requirement(name)
    dao.close()

    resp_dict = {'message': 'Template Requirement successfully deleted'}
    resp = make_response(json_serialize(resp_dict), httplib.OK)
    resp.contenttype = 'application/json'
    return resp
示例#4
0
  def post(self):
    session_id = get_session_id(session, request)

    dao = TemplateRequirementDAO(session_id)
    new_tr = dao.from_json(request)
    dao.add_template_requirement(new_tr)
    dao.close()

    resp_dict = {'message': 'Template Requirement successfully added'}
    resp = make_response(json_serialize(resp_dict, session_id=session_id), httplib.OK)
    resp.contenttype = 'application/json'
    return resp