diff --git a/pagure/flask_app.py b/pagure/flask_app.py index f83c266..377fe02 100644 --- a/pagure/flask_app.py +++ b/pagure/flask_app.py @@ -125,7 +125,21 @@ def create_app(config=None): return False return True - return {'user_can_clone_ssh': user_can_clone_ssh} + def get_git_url_ssh(): + """ Return the GIT SSH URL to be displayed in the UI based on the + content of the configuration file. + """ + git_url_ssh = pagure_config.get('GIT_URL_SSH') + if flask.g.authenticated and git_url_ssh: + try: + git_url_ssh = git_url_ssh.format( + username=flask.g.fas_user.username) + except (KeyError, IndexError): + pass + return git_url_ssh + + return {'user_can_clone_ssh': user_can_clone_ssh, + 'git_url_ssh': get_git_url_ssh()} auth = pagure_config.get('PAGURE_AUTH', None) if auth in ['fas', 'openid']: diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 86fc5f0..06099df 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -57,7 +57,6 @@ from pagure.lib import encoding_utils from pagure.ui import UI_NS from pagure.utils import ( __get_file_in_tree, - authenticated, login_required, is_true, stream_template, @@ -70,20 +69,6 @@ from pagure.decorators import ( _log = logging.getLogger(__name__) -def get_git_url_ssh(): - """ Return the GIT SSH URL to be displayed in the UI based on the - content of the configuration file. - """ - git_url_ssh = pagure_config.get('GIT_URL_SSH') - if authenticated() and git_url_ssh: - try: - git_url_ssh = git_url_ssh.format( - username=flask.g.fas_user.username) - except (KeyError, IndexError): - pass - return git_url_ssh - - def get_preferred_readme(tree): """ Establish some order about which README gets displayed if there are several in the repository. If none of the listed @@ -180,7 +165,6 @@ def view_repo(repo, username=None, namespace=None): branchname=branchname, last_commits=last_commits, tree=tree, - git_url_ssh=get_git_url_ssh(), ) @@ -276,7 +260,6 @@ def view_repo_branch(repo, branchname, username=None, namespace=None): safe=safe, readme=readme, diff_commits=diff_commits, - git_url_ssh=get_git_url_ssh(), ) """