Show More
@@ -22,6 +22,7 b' for SELECT use formencode.All(OneOf(list' | |||||
22 | import os |
|
22 | import os | |
23 | import re |
|
23 | import re | |
24 | import logging |
|
24 | import logging | |
|
25 | import traceback | |||
25 |
|
26 | |||
26 | import formencode |
|
27 | import formencode | |
27 | from formencode import All |
|
28 | from formencode import All | |
@@ -227,25 +228,29 b' def ValidCloneUri():' | |||||
227 | from rhodecode.lib.utils import make_ui |
|
228 | from rhodecode.lib.utils import make_ui | |
228 |
|
229 | |||
229 | class _ValidCloneUri(formencode.validators.FancyValidator): |
|
230 | class _ValidCloneUri(formencode.validators.FancyValidator): | |
|
231 | ||||
230 | def to_python(self, value, state): |
|
232 | def to_python(self, value, state): | |
231 | if not value: |
|
233 | if not value: | |
232 | pass |
|
234 | pass | |
233 | elif value.startswith('https'): |
|
235 | elif value.startswith('https'): | |
234 | try: |
|
236 | try: | |
235 |
httpsrepository(make_ui('db'), value).capabilities |
|
237 | httpsrepository(make_ui('db'), value).capabilities | |
236 | except: |
|
238 | except Exception, e: | |
|
239 | log.error(traceback.format_exc()) | |||
237 | raise formencode.Invalid(_('invalid clone url'), value, |
|
240 | raise formencode.Invalid(_('invalid clone url'), value, | |
238 | state) |
|
241 | state) | |
239 | elif value.startswith('http'): |
|
242 | elif value.startswith('http'): | |
240 | try: |
|
243 | try: | |
241 |
httprepository(make_ui('db'), value).capabilities |
|
244 | httprepository(make_ui('db'), value).capabilities | |
242 | except: |
|
245 | except Exception, e: | |
|
246 | log.error(traceback.format_exc()) | |||
243 | raise formencode.Invalid(_('invalid clone url'), value, |
|
247 | raise formencode.Invalid(_('invalid clone url'), value, | |
244 | state) |
|
248 | state) | |
245 | else: |
|
249 | else: | |
246 | raise formencode.Invalid(_('Invalid clone url, provide a ' |
|
250 | raise formencode.Invalid(_('Invalid clone url, provide a ' | |
247 | 'valid clone http\s url'), value, |
|
251 | 'valid clone http\s url'), value, | |
248 | state) |
|
252 | state) | |
|
253 | return value | |||
249 |
|
254 | |||
250 | return _ValidCloneUri |
|
255 | return _ValidCloneUri | |
251 |
|
256 |
General Comments 0
You need to be logged in to leave comments.
Login now