##// END OF EJS Templates
fixes issue #385 clone by ID url was loosing proxy prefix in URL
marcink -
r2099:e829e844 beta
parent child Browse files
Show More
@@ -26,6 +26,7 b''
26 import traceback
26 import traceback
27 import calendar
27 import calendar
28 import logging
28 import logging
29 import urllib
29 from time import mktime
30 from time import mktime
30 from datetime import timedelta, date
31 from datetime import timedelta, date
31 from urlparse import urlparse
32 from urlparse import urlparse
@@ -40,7 +41,7 b' from pylons.i18n.translation import _'
40 from beaker.cache import cache_region, region_invalidate
41 from beaker.cache import cache_region, region_invalidate
41
42
42 from rhodecode.model.db import Statistics, CacheInvalidation
43 from rhodecode.model.db import Statistics, CacheInvalidation
43 from rhodecode.lib import ALL_READMES, ALL_EXTS
44 from rhodecode.lib import ALL_READMES, ALL_EXTS, safe_unicode
44 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
45 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
45 from rhodecode.lib.base import BaseRepoController, render
46 from rhodecode.lib.base import BaseRepoController, render
46 from rhodecode.lib.utils import EmptyChangeset
47 from rhodecode.lib.utils import EmptyChangeset
@@ -91,34 +92,37 b' class SummaryController(BaseRepoControll'
91
92
92 uri_tmpl = config.get('clone_uri', default_clone_uri)
93 uri_tmpl = config.get('clone_uri', default_clone_uri)
93 uri_tmpl = uri_tmpl.replace('{', '%(').replace('}', ')s')
94 uri_tmpl = uri_tmpl.replace('{', '%(').replace('}', ')s')
94
95 decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
95 uri_dict = {
96 uri_dict = {
96 'user': username,
97 'user': username,
97 'pass': password,
98 'pass': password,
98 'scheme': parsed_url.scheme,
99 'scheme': parsed_url.scheme,
99 'netloc': parsed_url.netloc,
100 'netloc': parsed_url.netloc,
100 'path': parsed_url.path
101 'path': decoded_path
101 }
102 }
103
102 uri = uri_tmpl % uri_dict
104 uri = uri_tmpl % uri_dict
103 # generate another clone url by id
105 # generate another clone url by id
104 uri_dict.update({'path': '/_%s' % c.dbrepo.repo_id})
106 uri_dict.update(
107 {'path': decoded_path.replace(repo_name, '_%s' % c.dbrepo.repo_id)}
108 )
105 uri_id = uri_tmpl % uri_dict
109 uri_id = uri_tmpl % uri_dict
106
110
107 c.clone_repo_url = uri
111 c.clone_repo_url = uri
108 c.clone_repo_url_id = uri_id
112 c.clone_repo_url_id = uri_id
109 c.repo_tags = OrderedDict()
113 c.repo_tags = OrderedDict()
110 for name, hash in c.rhodecode_repo.tags.items()[:10]:
114 for name, hash_ in c.rhodecode_repo.tags.items()[:10]:
111 try:
115 try:
112 c.repo_tags[name] = c.rhodecode_repo.get_changeset(hash)
116 c.repo_tags[name] = c.rhodecode_repo.get_changeset(hash_)
113 except ChangesetError:
117 except ChangesetError:
114 c.repo_tags[name] = EmptyChangeset(hash)
118 c.repo_tags[name] = EmptyChangeset(hash_)
115
119
116 c.repo_branches = OrderedDict()
120 c.repo_branches = OrderedDict()
117 for name, hash in c.rhodecode_repo.branches.items()[:10]:
121 for name, hash_ in c.rhodecode_repo.branches.items()[:10]:
118 try:
122 try:
119 c.repo_branches[name] = c.rhodecode_repo.get_changeset(hash)
123 c.repo_branches[name] = c.rhodecode_repo.get_changeset(hash_)
120 except ChangesetError:
124 except ChangesetError:
121 c.repo_branches[name] = EmptyChangeset(hash)
125 c.repo_branches[name] = EmptyChangeset(hash_)
122
126
123 td = date.today() + timedelta(days=1)
127 td = date.today() + timedelta(days=1)
124 td_1m = td - timedelta(days=calendar.mdays[td.month])
128 td_1m = td - timedelta(days=calendar.mdays[td.month])
General Comments 0
You need to be logged in to leave comments. Login now