Fix indentation for DB queries.

This commit is contained in:
Jake Moshenko 2016-08-26 14:47:59 -04:00
parent 1d8b72235a
commit 0815f6b6c4
2 changed files with 18 additions and 14 deletions

View file

@ -192,7 +192,8 @@ def _get_repo_tag_image(tag_name, include_storage, modifier):
query = Image.select().join(RepositoryTag)
if include_storage:
query = (Image.select(Image, ImageStorage)
query = (Image
.select(Image, ImageStorage)
.join(ImageStorage)
.switch(Image)
.join(RepositoryTag))
@ -213,7 +214,8 @@ def get_repo_tag_image(repo, tag_name, include_storage=False):
def get_tag_image(namespace_name, repository_name, tag_name, include_storage=False):
def modifier(query):
return (query.switch(RepositoryTag)
return (query
.switch(RepositoryTag)
.join(Repository)
.join(Namespace)
.where(Namespace.username == namespace_name, Repository.name == repository_name))

View file

@ -183,7 +183,8 @@ class TestGarbageCollection(unittest.TestCase):
model.repository.purge_repository(repo.namespace_user.username, repo.name)
# Change the time machine expiration on the namespace.
(database.User.update(removed_tag_expiration_s=1000000000)
(database.User
.update(removed_tag_expiration_s=1000000000)
.where(database.User.username == ADMIN_ACCESS_USER)
.execute())
@ -200,7 +201,8 @@ class TestGarbageCollection(unittest.TestCase):
self.assertIsNone(model.repository.find_repository_with_garbage(1000000000))
# Change the time machine expiration on the namespace.
(database.User.update(removed_tag_expiration_s=0)
(database.User
.update(removed_tag_expiration_s=0)
.where(database.User.username == ADMIN_ACCESS_USER)
.execute())