本文整理匯總了Python中cairis.data.AssetDAO.AssetDAO.get_asset_model方法的典型用法代碼示例。如果您正苦於以下問題:Python AssetDAO.get_asset_model方法的具體用法?Python AssetDAO.get_asset_model怎麽用?Python AssetDAO.get_asset_model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cairis.data.AssetDAO.AssetDAO
的用法示例。
在下文中一共展示了AssetDAO.get_asset_model方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get
# 需要導入模塊: from cairis.data.AssetDAO import AssetDAO [as 別名]
# 或者: from cairis.data.AssetDAO.AssetDAO import get_asset_model [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 get_asset_model [as 別名]
def get(self, environment):
session_id = get_session_id(session, request)
with_concerns = request.args.get('with_concerns', True)
if with_concerns == '0' or with_concerns == 0:
with_concerns = False
model_generator = get_model_generator()
dao = AssetDAO(session_id)
dot_code = dao.get_asset_model(environment, with_concerns=with_concerns)
dao.close()
if not isinstance(dot_code, str):
raise ObjectNotFoundHTTPError('The model')
resp = make_response(model_generator.generate(dot_code), 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