From 03198210c398e1c12b1b7cda80e2d66ca4e25f35 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Mon, 2 Dec 2013 14:08:10 -0500 Subject: [PATCH] Re-add the removed pull_username code. --- endpoints/index.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/endpoints/index.py b/endpoints/index.py index 8b4e90b84..c89a8b287 100644 --- a/endpoints/index.py +++ b/endpoints/index.py @@ -173,8 +173,6 @@ def create_repository(namespace, repository): 'namespace': namespace } - description = '' - if get_authenticated_user(): mixpanel.track(get_authenticated_user().username, 'push_repo', extra_params) @@ -184,9 +182,8 @@ def create_repository(namespace, repository): metadata['token'] = get_validated_token().friendly_name metadata['token_code'] = get_validated_token().code - model.log_action('push_repo', namespace, performer = get_authenticated_user(), ip = request.remote_addr, - metadata = metadata, - repository = repo) + model.log_action('push_repo', namespace, performer=get_authenticated_user(), + ip=request.remote_addr, metadata=metadata, repository=repo) return response @@ -268,20 +265,26 @@ def get_repository_images(namespace, repository): 'namespace': namespace, } if get_authenticated_user(): - metadata['username']= get_authenticated_user().username + metadata['username'] = get_authenticated_user().username elif get_validated_token(): metadata['token'] = get_validated_token().friendly_name metadata['token_code'] = get_validated_token().code else: metadata['public'] = True + pull_username = 'anonymous' + if get_authenticated_user(): + pull_username = get_authenticated_user().username + extra_params = { 'repository': '%s/%s' % (namespace, repository), } mixpanel.track(pull_username, 'pull_repo', extra_params) - model.log_action('pull_repo', namespace, performer = get_authenticated_user(), ip = request.remote_addr, - metadata = metadata, repository = repo) + model.log_action('pull_repo', namespace, + performer=get_authenticated_user(), + ip=request.remote_addr, metadata=metadata, + repository=repo) return resp abort(403)