#NEWLINE# def load_class( path ) : #NEWLINE# #INDENT# '\n    Load class from path.\n    ' #NEWLINE# try : #NEWLINE# #INDENT# ( mod_name , klass_name ) = path . rsplit ( '.' , 1 ) #NEWLINE# mod = import_module ( mod_name ) #NEWLINE# #UNINDENT# except AttributeError as e : #NEWLINE# #INDENT# raise ImproperlyConfigured ( 'Error importing {0}: "{1}"' . format ( mod_name , e ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# klass = getattr ( mod , klass_name ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# raise ImproperlyConfigured ( 'Module "{0}" does not define a "{1}" class' . format ( mod_name , klass_name ) ) #NEWLINE# #UNINDENT# return klass