本文整理汇总了Python中service_api.ServiceApi.get_version方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceApi.get_version方法的具体用法?Python ServiceApi.get_version怎么用?Python ServiceApi.get_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类service_api.ServiceApi
的用法示例。
在下文中一共展示了ServiceApi.get_version方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: session_info
# 需要导入模块: from service_api import ServiceApi [as 别名]
# 或者: from service_api.ServiceApi import get_version [as 别名]
def session_info():
# get version info from service gateway
remote_version = ServiceApi.get_version()
ion_ux_version = get_versions()
# ion ux must be first
version = [{ 'lib': 'ux-release', 'version': ion_ux_version }]
# coi services should be second
version.append({'lib':'coi-services-release', 'version': remote_version.pop('coi-services-release', 'unknown')})
# sort the rest by alpha
for k,v in sorted(remote_version.iteritems()):
version.append({'lib':k, 'version': v})
# trim off "-release" and "-dev"
for ver in version:
ver['lib'] = ver['lib'].replace("-release", "")
ver['version'] = ver['version'].replace("-dev", "")
session_values = {'user_id': None, 'roles': None, 'is_registered': False, 'is_logged_in': False, 'ui_mode': UI_MODE, 'version': version }
if session.has_key('user_id'):
roles = ServiceApi.get_roles_by_actor_id(session['actor_id'])
session_values.update({'name': session['name'],
'user_id': session['user_id'],
'actor_id': session['actor_id'],
'roles': roles,
'is_registered': session['is_registered'],
'is_logged_in': True,
'ui_theme_dark': session['ui_theme_dark']})
return jsonify(data=session_values)