#NEWLINE# def _path_from_module( self , module ) : #NEWLINE# #INDENT# "Attempt to determine app's filesystem path from its module." #NEWLINE# paths = list ( getattr ( module , '__path__' , [ ] ) ) #NEWLINE# if ( len ( paths ) != 1 ) : #NEWLINE# #INDENT# filename = getattr ( module , '__file__' , None ) #NEWLINE# if ( filename is not None ) : #NEWLINE# #INDENT# paths = [ os . path . dirname ( filename ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# paths = list ( set ( paths ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( paths ) > 1 ) : #NEWLINE# #INDENT# raise ImproperlyConfigured ( ( "The app module %r has multiple filesystem locations (%r); you must configure this app with an AppConfig subclass with a 'path' class attribute." % ( module , paths ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not paths ) : #NEWLINE# #INDENT# raise ImproperlyConfigured ( ( "The app module %r has no filesystem location, you must configure this app with an AppConfig subclass with a 'path' class attribute." % ( module , ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return upath ( paths [ 0 ] )