refactor(data+endpoints): code review changes
this puts the view logic on the object and adds a parameter for logging [TESTING->locally with docker compose] Issue: https://coreosdev.atlassian.net/browse/QUAY-632 - [ ] It works! - [ ] Comments provide sufficient explanations for the next contributor - [ ] Tests cover changes and corner cases - [ ] Follows Quay syntax patterns and format
This commit is contained in:
parent
897a091692
commit
131acde317
6 changed files with 73 additions and 70 deletions
|
@ -353,7 +353,7 @@ def request_error(exception=None, **kwargs):
|
|||
raise InvalidRequest(message, data)
|
||||
|
||||
|
||||
def log_action(kind, user_or_orgname, metadata=None, repo=None):
|
||||
def log_action(kind, user_or_orgname, metadata=None, repo=None, repo_name=None):
|
||||
if not metadata:
|
||||
metadata = {}
|
||||
|
||||
|
@ -364,8 +364,14 @@ def log_action(kind, user_or_orgname, metadata=None, repo=None):
|
|||
metadata['oauth_token_application'] = oauth_token.application.name
|
||||
|
||||
performer = get_authenticated_user()
|
||||
|
||||
if repo_name:
|
||||
repository = model.repository.get_repository(user_or_orgname, repo_name)
|
||||
else:
|
||||
repository = repo
|
||||
|
||||
model.log.log_action(kind, user_or_orgname, performer=performer, ip=request.remote_addr,
|
||||
metadata=metadata, repository=repo)
|
||||
metadata=metadata, repository=repository)
|
||||
|
||||
|
||||
def define_json_response(schema_name):
|
||||
|
|
Reference in a new issue