# HG changeset patch # User Marcin Kuzminski # Date 2011-05-01 20:21:19 # Node ID e3deb588cf14ae140359bc5a5f2e3c968591b7d4 # Parent d87997ed6ef1ead8596a638ee14ad1abe8d7eaf1 fixed http/s validation for clone_uri, and missing return value. diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py --- a/rhodecode/model/forms.py +++ b/rhodecode/model/forms.py @@ -22,6 +22,7 @@ for SELECT use formencode.All(OneOf(list import os import re import logging +import traceback import formencode from formencode import All @@ -227,25 +228,29 @@ def ValidCloneUri(): from rhodecode.lib.utils import make_ui class _ValidCloneUri(formencode.validators.FancyValidator): + def to_python(self, value, state): if not value: pass elif value.startswith('https'): try: - httpsrepository(make_ui('db'), value).capabilities() - except: + httpsrepository(make_ui('db'), value).capabilities + except Exception, e: + log.error(traceback.format_exc()) raise formencode.Invalid(_('invalid clone url'), value, state) elif value.startswith('http'): try: - httprepository(make_ui('db'), value).capabilities() - except: + httprepository(make_ui('db'), value).capabilities + except Exception, e: + log.error(traceback.format_exc()) raise formencode.Invalid(_('invalid clone url'), value, state) else: raise formencode.Invalid(_('Invalid clone url, provide a ' 'valid clone http\s url'), value, state) + return value return _ValidCloneUri