Performer will sometimes by None

This commit is contained in:
Joseph Schorr 2013-12-02 13:50:51 -05:00
parent b77dabd586
commit a77aeaaef9

View file

@ -1692,17 +1692,21 @@ def delete_org_robot(orgname, robot_shortname):
@api_login_required
def org_logs_api(orgname):
def log_view(log):
return {
view = {
'kind': log.kind.name,
'metadata': json.loads(log.metadata_json),
'ip': log.ip,
'performer': {
'username': log.performer.username,
'is_robot': log.performer.robot,
},
'ip': log.ip,
'datetime': log.datetime,
}
if log.performer:
view['performer'] = {
'username': log.performer.username,
'is_robot': log.performer.robot,
}
return view
permission = AdministerOrganizationPermission(orgname)
if permission.can():
logs = model.list_logs(orgname)