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