本文整理汇总了Python中bkr.server.model.LabController.record_activity方法的典型用法代码示例。如果您正苦于以下问题:Python LabController.record_activity方法的具体用法?Python LabController.record_activity怎么用?Python LabController.record_activity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bkr.server.model.LabController
的用法示例。
在下文中一共展示了LabController.record_activity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_labcontroller_helper
# 需要导入模块: from bkr.server.model import LabController [as 别名]
# 或者: from bkr.server.model.LabController import record_activity [as 别名]
def _create_labcontroller_helper(data):
with convert_internal_errors():
if LabController.query.filter_by(fqdn=data['fqdn']).count():
raise Conflict409('Lab Controller %s already exists' % data['fqdn'])
user = find_user_or_create(data['user_name'])
user = update_user(
user=user,
display_name=data['fqdn'],
email_address=data.get('email_address', user.email_address),
password=data.get('password', user.password)
)
labcontroller = LabController(fqdn=data['fqdn'], disabled=False)
labcontroller.record_activity(
user=identity.current.user, service=u'HTTP',
action=u'Changed', field=u'FQDN', old=u'', new=data['fqdn'])
labcontroller.user = user
labcontroller.record_activity(
user=identity.current.user, service=u'HTTP',
action=u'Changed', field=u'User', old=u'', new=user.user_name)
# For backwards compatibility
labcontroller.record_activity(
user=identity.current.user, service=u'HTTP',
action=u'Changed', field=u'Disabled', old=u'', new=unicode(labcontroller.disabled))
session.add(labcontroller)
# flush it so we return an id, otherwise we'll end up back in here from
# the edit form
session.flush()
response = jsonify(labcontroller.__json__())
response.status_code = 201
return response