def put(self, name):
    session_id = get_session_id(session, request)

    dao = DocumentReferenceDAO(session_id)
    upd_dr = dao.from_json(request)
    dao.update_document_reference(upd_dr, name)
    dao.close()

    resp_dict = {'message': 'Document Reference successfully updated'}
    resp = make_response(json_serialize(resp_dict), OK)
    resp.contenttype = 'application/json'
    return resp
Esempio n. 2
0
    def put(self, name):
        session_id = get_session_id(session, request)

        dao = DocumentReferenceDAO(session_id)
        upd_dr = dao.from_json(request)
        dao.update_document_reference(upd_dr, name)
        dao.close()

        resp_dict = {'message': upd_dr.name() + ' 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 = DocumentReferenceDAO(session_id)
    new_dr = dao.from_json(request)
    dao.add_document_reference(new_dr)
    dao.close()

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