本文整理汇总了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