#NEWLINE# def load_backend( path ) : #NEWLINE# #INDENT# i = path . rfind ( '.' ) #NEWLINE# ( module , attr ) = ( path [ : i ] , path [ ( i + 1 ) : ] ) #NEWLINE# try : #NEWLINE# #INDENT# mod = import_module ( module ) #NEWLINE# #UNINDENT# except ImportError as e : #NEWLINE# #INDENT# raise ImproperlyConfigured ( ( 'Error importing authentication backend %s: "%s"' % ( path , e ) ) ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# raise ImproperlyConfigured ( 'Error importing authentication backends. Is AUTHENTICATION_BACKENDS a correctly defined list or tuple?' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# cls = getattr ( mod , attr ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# raise ImproperlyConfigured ( ( 'Module "%s" does not define a "%s" authentication backend' % ( module , attr ) ) ) #NEWLINE# #UNINDENT# return cls ( )