Changeset - 13879d044762
[Not reviewed]
default
0 1 0
domruf - 9 years ago 2017-05-10 20:13:24
dominikruf@gmail.com
validators: wrap hgsubversion import with try/except block like in settings.py

Found by pylint.
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/model/validators.py
Show inline comments
 
@@ -31,13 +31,13 @@ from formencode.validators import (
 
)
 
from kallithea.lib.compat import OrderedSet
 
from kallithea.lib import ipaddr
 
from kallithea.lib.utils import repo_name_slug
 
from kallithea.lib.utils2 import str2bool, aslist
 
from kallithea.model.db import RepoGroup, Repository, UserGroup, User
 
from kallithea.lib.exceptions import LdapImportError
 
from kallithea.lib.exceptions import LdapImportError, HgsubversionImportError
 
from kallithea.config.routing import ADMIN_PREFIX
 
from kallithea.lib.auth import HasRepoGroupPermissionLevel, HasPermissionAny
 

	
 
# silence warnings and pylint
 
UnicodeString, OneOf, Int, Number, Regex, Email, Bool, StringBoolean, Set, \
 
    NotEmpty, IPAddress, CIDR, String, FancyValidator
 
@@ -417,13 +417,17 @@ def ValidCloneUri():
 
            from kallithea.lib.vcs.backends.hg.repository import MercurialRepository
 
            if url.startswith('http') or url.startswith('ssh'):
 
                # initially check if it's at least the proper URL
 
                # or does it pass basic auth
 
                MercurialRepository._check_url(url, ui)
 
            elif url.startswith('svn+http'):
 
                from hgsubversion.svnrepo import svnremoterepo
 
                try:
 
                    from hgsubversion.svnrepo import svnremoterepo
 
                except ImportError:
 
                    raise HgsubversionImportError(_('Unable to activate hgsubversion support. '
 
                          'The "hgsubversion" library is missing'))
 
                svnremoterepo(ui, url).svn.uuid
 
            elif url.startswith('git+http'):
 
                raise NotImplementedError()
 
            else:
 
                raise Exception('clone from URI %s not allowed' % (url,))
 

	
0 comments (0 inline, 0 general)