##// END OF EJS Templates
Update LICENSE.md to include license information about Codemirror 3.15...
Update LICENSE.md to include license information about Codemirror 3.15 Add information to the LICENSE.md file to include the information provided in the codemirror-3.15/LICENSE file. Also, note that other license and copyright information also appears in .../public/js/mode/ sub-directories.

File last commit:

r2007:324ac367 beta
r4121:8c543e37 rhodecode-2.2.5-gpl
Show More
imports.py
27 lines | 781 B | text/x-python | PythonLexer
from rhodecode.lib.vcs.exceptions import VCSError
def import_class(class_path):
"""
Returns class from the given path.
For example, in order to get class located at
``vcs.backends.hg.MercurialRepository``:
try:
hgrepo = import_class('vcs.backends.hg.MercurialRepository')
except VCSError:
# hadle error
"""
splitted = class_path.split('.')
mod_path = '.'.join(splitted[:-1])
class_name = splitted[-1]
try:
class_mod = __import__(mod_path, {}, {}, [class_name])
except ImportError, err:
msg = "There was problem while trying to import backend class. "\
"Original error was:\n%s" % err
raise VCSError(msg)
cls = getattr(class_mod, class_name)
return cls