Merge pull request #3314 from quay/joseph.schorr/QUAY-1268/remove-sitemap

Remove unusable sitemap endpoint
This commit is contained in:
Joseph Schorr 2018-12-19 13:27:51 -05:00 committed by GitHub
commit a898d31016
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 29 deletions

View file

@ -655,17 +655,6 @@ def confirm_email_authorization_for_repo(code):
return found return found
def list_popular_public_repos(action_count_threshold, time_span, repo_kind='image'):
cutoff = datetime.now() - time_span
return (Repository.select(Namespace.username, Repository.name)
.join(Namespace, on=(Repository.namespace_user == Namespace.id)).switch(Repository)
.join(RepositoryActionCount).where(RepositoryActionCount.date >= cutoff,
Repository.visibility == get_public_repo_visibility(),
Repository.kind == Repository.kind.get_id(repo_kind))
.group_by(RepositoryActionCount.repository, Repository.name, Namespace.username)
.having(fn.Sum(RepositoryActionCount.count) >= action_count_threshold).tuples())
def is_empty(namespace_name, repository_name): def is_empty(namespace_name, repository_name):
""" Returns if the repository referenced by the given namespace and name is empty. If the repo """ Returns if the repository referenced by the given namespace and name is empty. If the repo
doesn't exist, returns True. doesn't exist, returns True.

View file

@ -46,9 +46,3 @@ def test_search_pagination(query, authed_username, initialized_db):
next_repos = get_filtered_matching_repositories(query, filter_username=authed_username, offset=1) next_repos = get_filtered_matching_repositories(query, filter_username=authed_username, offset=1)
assert repositories[0].id != next_repos[0].id assert repositories[0].id != next_repos[0].id
assert repositories[1].id == next_repos[0].id assert repositories[1].id == next_repos[0].id
def test_popular_repo_list(initialized_db):
onlypublic = model.repository.list_popular_public_repos(0, timedelta(weeks=1))
assert len(onlypublic) == 1
assert onlypublic[0] == ('public', 'publicrepo')

View file

@ -332,15 +332,6 @@ def robots():
return robots_txt return robots_txt
@web.route('/sitemap.xml', methods=['GET'])
def sitemap():
popular_repo_tuples = model.repository.list_popular_public_repos(50, timedelta(weeks=1))
xml = make_response(render_template('sitemap.xml', public_repos=popular_repo_tuples,
baseurl=get_app_url()))
xml.headers['Content-Type'] = 'application/xml'
return xml
@web.route('/buildlogs/<build_uuid>', methods=['GET']) @web.route('/buildlogs/<build_uuid>', methods=['GET'])
@route_show_if(features.BUILD_SUPPORT) @route_show_if(features.BUILD_SUPPORT)
@process_auth_or_cookie @process_auth_or_cookie

View file

@ -228,9 +228,6 @@ class WebEndpointTestCase(EndpointTestCase):
def test_robots(self): def test_robots(self):
self.getResponse('web.robots') self.getResponse('web.robots')
def test_sitemap(self):
self.getResponse('web.sitemap')
def test_repo_view(self): def test_repo_view(self):
self.getResponse('web.repository', path='devtable/simple') self.getResponse('web.repository', path='devtable/simple')