本文整理匯總了Python中cairis.data.AssetDAO.AssetDAO.close方法的典型用法代碼示例。如果您正苦於以下問題:Python AssetDAO.close方法的具體用法?Python AssetDAO.close怎麽用?Python AssetDAO.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cairis.data.AssetDAO.AssetDAO
的用法示例。
在下文中一共展示了AssetDAO.close方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get
# 需要導入模塊: from cairis.data.AssetDAO import AssetDAO [as 別名]
# 或者: from cairis.data.AssetDAO.AssetDAO import close [as 別名]
def get(self, environment, asset):
session_id = get_session_id(session, request)
hide_concerns = request.args.get("hide_concerns", "1")
if hide_concerns == "0" or hide_concerns == 0:
hide_concerns = False
else:
hide_concerns = True
if asset == "all":
asset = ""
model_generator = get_model_generator()
dao = AssetDAO(session_id)
dot_code = dao.get_asset_model(environment, asset, hide_concerns=hide_concerns)
dao.close()
if not isinstance(dot_code, str):
raise ObjectNotFoundHTTPError("The model")
resp = make_response(model_generator.generate(dot_code, renderer="dot"), 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
示例2: get
# 需要導入模塊: from cairis.data.AssetDAO import AssetDAO [as 別名]
# 或者: from cairis.data.AssetDAO.AssetDAO import close [as 別名]
def get(self, asset_name):
session_id = get_session_id(session, request)
dao = AssetDAO(session_id)
asset_props = dao.get_asset_props(name=asset_name)
dao.close()
resp = make_response(json_serialize(asset_props, session_id=session_id))
resp.contenttype = 'application/json'
return resp
示例3: delete
# 需要導入模塊: from cairis.data.AssetDAO import AssetDAO [as 別名]
# 或者: from cairis.data.AssetDAO.AssetDAO import close [as 別名]
def delete(self, name):
session_id = request.args.get('session_id', None)
dao = AssetDAO(session_id)
dao.delete_asset(name=name)
dao.close()
resp_dict = {'message': 'Asset successfully deleted'}
resp = make_response(json_serialize(resp_dict), httplib.OK)
resp.contenttype = 'application/json'
return resp
示例4: post
# 需要導入模塊: from cairis.data.AssetDAO import AssetDAO [as 別名]
# 或者: from cairis.data.AssetDAO.AssetDAO import close [as 別名]
def post(self):
session_id = get_session_id(session, request)
dao = AssetDAO(session_id)
asset = dao.from_json(request)
new_id = dao.add_asset(asset)
dao.close()
resp_dict = {'asset_id': new_id}
resp = make_response(json_serialize(resp_dict), httplib.OK)
resp.contenttype = 'application/json'
return resp
示例5: post
# 需要導入模塊: from cairis.data.AssetDAO import AssetDAO [as 別名]
# 或者: from cairis.data.AssetDAO.AssetDAO import close [as 別名]
def post(self):
session_id = get_session_id(session, request)
dao = AssetDAO(session_id)
asset = dao.from_json(request)
assetName = dao.add_asset(asset)
dao.close()
resp_dict = {'message': assetName + ' created'}
resp = make_response(json_serialize(resp_dict), OK)
resp.contenttype = 'application/json'
return resp
示例6: put
# 需要導入模塊: from cairis.data.AssetDAO import AssetDAO [as 別名]
# 或者: from cairis.data.AssetDAO.AssetDAO import close [as 別名]
def put(self, asset_name):
session_id = get_session_id(session, request)
dao = AssetDAO(session_id)
asset_prop = dao.from_json(request, to_props=True)
dao.update_asset_properties(asset_prop, name=asset_name)
dao.close()
resp_dict = {'message': 'The asset properties were successfully updated.'}
resp = make_response(json_serialize(resp_dict), httplib.OK)
resp.contenttype = 'application/json'
return resp
示例7: delete
# 需要導入模塊: from cairis.data.AssetDAO import AssetDAO [as 別名]
# 或者: from cairis.data.AssetDAO.AssetDAO import close [as 別名]
def delete(self, name):
session_id = get_session_id(session, request)
environment_name = request.args.get("environment", "")
dao = AssetDAO(session_id)
dao.delete_asset_type(name=name, environment_name=environment_name)
dao.close()
resp_dict = {"message": "Asset type successfully deleted"}
resp = make_response(json_serialize(resp_dict), httplib.OK)
resp.headers["Content-type"] = "application/json"
return resp