From 8fab3b6d34e96e07809bc9718a6c685363a02ad4 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 20 Nov 2014 12:04:53 -0500 Subject: [PATCH] Make sure to switch the context back to LogEntry and make sure to only include the performer if actually present --- data/model/legacy.py | 3 ++- endpoints/api/logs.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/data/model/legacy.py b/data/model/legacy.py index 02057583c..a5c779871 100644 --- a/data/model/legacy.py +++ b/data/model/legacy.py @@ -2053,7 +2053,8 @@ def list_logs(start_time, end_time, performer=None, repository=None, namespace=N .join(Performer, JOIN_LEFT_OUTER, on=(LogEntry.performer == Performer.id).alias('performer')) .switch(LogEntry) - .join(LogEntryKind)) + .join(LogEntryKind) + .switch(LogEntry)) if repository: joined = joined.where(LogEntry.repository == repository) diff --git a/endpoints/api/logs.py b/endpoints/api/logs.py index 2ce2bbb30..8585339e3 100644 --- a/endpoints/api/logs.py +++ b/endpoints/api/logs.py @@ -19,7 +19,7 @@ def log_view(log): 'datetime': format_date(log.datetime), } - if log.performer: + if log.performer and log.performer.username: view['performer'] = { 'kind': 'user', 'name': log.performer.username,