Update for merge and make additional interface improvements
This commit is contained in:
parent
543cba352b
commit
e7d6e60d97
10 changed files with 85 additions and 170 deletions
|
@ -10,8 +10,12 @@ from auth.auth_context import get_authenticated_user, get_validated_oauth_token
|
|||
DEFAULT_BATCH_SIZE = 1000
|
||||
|
||||
|
||||
def build_event_data(repo, extra_data=None, subpage=None):
|
||||
repo_string = '%s/%s' % (repo.namespace_name, repo.name)
|
||||
def build_repository_event_data(namespace_name, repo_name, extra_data=None, subpage=None):
|
||||
""" Builds the basic repository data for an event, including the repository's name, Docker URL
|
||||
and homepage. If extra_data is specified, it is appended to the dictionary before it is
|
||||
returned.
|
||||
"""
|
||||
repo_string = '%s/%s' % (namespace_name, repo_name)
|
||||
homepage = '%s://%s/repository/%s' % (app.config['PREFERRED_URL_SCHEME'],
|
||||
app.config['SERVER_HOSTNAME'],
|
||||
repo_string)
|
||||
|
@ -24,8 +28,8 @@ def build_event_data(repo, extra_data=None, subpage=None):
|
|||
|
||||
event_data = {
|
||||
'repository': repo_string,
|
||||
'namespace': repo.namespace_name,
|
||||
'name': repo.name,
|
||||
'namespace': namespace_name,
|
||||
'name': repo_name,
|
||||
'docker_url': '%s/%s' % (app.config['SERVER_HOSTNAME'], repo_string),
|
||||
'homepage': homepage,
|
||||
}
|
||||
|
@ -65,7 +69,8 @@ def notification_batch(batch_size=DEFAULT_BATCH_SIZE):
|
|||
with notification_queue.batch_insert(batch_size) as queue_put:
|
||||
def spawn_notification_batch(repo, event_name, extra_data=None, subpage=None, pathargs=None,
|
||||
performer_data=None):
|
||||
event_data = build_event_data(repo, extra_data=extra_data, subpage=subpage)
|
||||
event_data = build_repository_event_data(repo.namespace_name, repo.name,
|
||||
extra_data=extra_data, subpage=subpage)
|
||||
|
||||
notifications = model.notification.list_repo_notifications(repo.namespace_name,
|
||||
repo.name,
|
||||
|
|
Reference in a new issue