Mercurial > kallithea
changeset 1652:8384eaabeb19 beta
configurable clone url
- posibility to specify ssh:// manually as alternative clone url.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 03 Nov 2011 03:00:53 +0200 |
parents | 96ae22a4e963 |
children | b1e1dffd595c |
files | development.ini docs/changelog.rst production.ini rhodecode/config/deployment.ini_tmpl rhodecode/controllers/summary.py |
diffstat | 5 files changed, 45 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/development.ini Thu Nov 03 02:52:38 2011 +0200 +++ b/development.ini Thu Nov 03 03:00:53 2011 +0200 @@ -56,6 +56,15 @@ container_auth_enabled = false proxypass_auth_enabled = false +## overwrite schema of clone url +# available vars: +# scheme - http/https +# user - current user +# pass - password +# netloc - network location +# path - usually repo_name +# clone_uri = {scheme}://{user}{pass}{netloc}{path} + #################################### ### CELERY CONFIG #### ####################################
--- a/docs/changelog.rst Thu Nov 03 02:52:38 2011 +0200 +++ b/docs/changelog.rst Thu Nov 03 03:00:53 2011 +0200 @@ -16,7 +16,9 @@ - #215 rst and markdown README files support - #252 pass-through user identity - hover top menu - +- configurable clone url posibility to specify ssh:// manually as + alternative clone url. + fixes -----
--- a/production.ini Thu Nov 03 02:52:38 2011 +0200 +++ b/production.ini Thu Nov 03 03:00:53 2011 +0200 @@ -56,6 +56,14 @@ container_auth_enabled = false proxypass_auth_enabled = false +## available vars +## scheme - http/https +## user - current user +## pass - password +## netloc - network location +## path - usually repo_name +clone_uri = {scheme}://{user}{pass}{netloc}{path} + #################################### ### CELERY CONFIG #### ####################################
--- a/rhodecode/config/deployment.ini_tmpl Thu Nov 03 02:52:38 2011 +0200 +++ b/rhodecode/config/deployment.ini_tmpl Thu Nov 03 03:00:53 2011 +0200 @@ -56,6 +56,15 @@ container_auth_enabled = false proxypass_auth_enabled = false +## overwrite schema of clone url +# available vars: +# scheme - http/https +# user - current user +# pass - password +# netloc - network location +# path - usually repo_name +# clone_uri = {scheme}://{user}{pass}{netloc}{path} + #################################### ### CELERY CONFIG #### ####################################
--- a/rhodecode/controllers/summary.py Thu Nov 03 02:52:38 2011 +0200 +++ b/rhodecode/controllers/summary.py Thu Nov 03 03:00:53 2011 +0200 @@ -29,11 +29,12 @@ from time import mktime from datetime import timedelta, date from itertools import product +from urlparse import urlparse from vcs.exceptions import ChangesetError, EmptyRepositoryError, \ NodeDoesNotExistError -from pylons import tmpl_context as c, request, url +from pylons import tmpl_context as c, request, url, config from pylons.i18n.translation import _ from beaker.cache import cache_region, region_invalidate @@ -79,25 +80,26 @@ items_per_page=10, url=url_generator) if self.rhodecode_user.username == 'default': - #for default(anonymous) user we don't need to pass credentials + # for default(anonymous) user we don't need to pass credentials username = '' password = '' else: username = str(self.rhodecode_user.username) password = '@' - if e.get('wsgi.url_scheme') == 'https': - split_s = 'https://' - else: - split_s = 'http://' - - qualified_uri = [split_s] + [url.current(qualified=True)\ - .split(split_s)[-1]] - uri = u'%(proto)s%(user)s%(pass)s%(rest)s' \ - % {'user': username, - 'pass': password, - 'proto': qualified_uri[0], - 'rest': qualified_uri[1]} + parsed_url = urlparse(url.current(qualified=True)) + + default_clone_uri = '{scheme}://{user}{pass}{netloc}{path}' + + uri_tmpl = config.get('clone_uri',default_clone_uri) + uri_tmpl = uri_tmpl.replace('{','%(').replace('}',')s') + + uri = uri_tmpl % {'user': username, + 'pass': password, + 'scheme': parsed_url.scheme, + 'netloc':parsed_url.netloc, + 'path':parsed_url.path} + c.clone_repo_url = uri c.repo_tags = OrderedDict() for name, hash in c.rhodecode_repo.tags.items()[:10]: