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:
Charlton Austin 2017-07-10 14:45:23 -04:00
parent 897a091692
commit 131acde317
6 changed files with 73 additions and 70 deletions

View file

@ -108,12 +108,7 @@ def log_action(kind_name, user_or_organization_name, performer=None, repository=
performer = performer.id
if repository is not None:
if hasattr(repository, 'namespace_name') and hasattr(repository, 'repository_name'):
maybe_repo = data.model.repository.get_repository(repository.namespace_name,
repository.repository_name)
repository = maybe_repo.id if maybe_repo else None
elif hasattr(repository, 'id'):
repository = repository.id
repository = repository.id
kind = _get_log_entry_kind(kind_name)
metadata_json = json.dumps(metadata, default=_json_serialize)