Merge branch 'master' of ssh://bitbucket.org/yackob03/quay

Conflicts:
	static/js/app.js
This commit is contained in:
yackob03 2013-10-02 00:48:48 -04:00
commit 20765b7e37
10 changed files with 316 additions and 71 deletions

View file

@ -96,9 +96,11 @@ def get_token(code):
return AccessToken.get(AccessToken.code == code)
def get_visible_repositories(username=None):
def get_visible_repositories(username=None, include_public=True, limit=None, sort=False):
query = Repository.select().distinct().join(Visibility)
or_clauses = [(Visibility.name == 'public')]
or_clauses = []
if include_public:
or_clauses.append((Visibility.name == 'public'));
if username:
with_perms = query.switch(Repository).join(RepositoryPermission,
@ -106,8 +108,15 @@ def get_visible_repositories(username=None):
query = with_perms.join(User)
or_clauses.append(User.username == username)
return query.where(reduce(operator.or_, or_clauses))
if sort:
with_images = query.switch(Repository).join(Image, JOIN_LEFT_OUTER)
query = with_images.order_by(Image.created.desc())
query = query.where(reduce(operator.or_, or_clauses))
if limit:
query = query.limit(limit)
return query
def get_matching_repositories(repo_term, username=None):
namespace_term = repo_term