def _create_collection(request, cidentifier, git_name, git_mail): """used by both new_idservice and new_manual """ exit,status = Collection.new(cidentifier, git_name, git_mail, settings.AGENT) collection = Collection.from_identifier(cidentifier) if exit: logger.error(exit) logger.error(status) messages.error(request, WEBUI_MESSAGES['ERROR'].format(status)) else: # update search index try: collection.post_json() except ConnectionError: logger.error('Could not post to Elasticsearch.') dvcs_tasks.gitstatus_update.apply_async( (cidentifier.path_abs(),), countdown=2 ) return collection