#NEWLINE# def check_static_paths( self ) : #NEWLINE# #INDENT# 'Check Application config for incorrect static paths.' #NEWLINE# request = cherrypy . request #NEWLINE# for ( sn , app ) in cherrypy . tree . apps . items ( ) : #NEWLINE# #INDENT# if ( not isinstance ( app , cherrypy . Application ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# request . app = app #NEWLINE# for section in app . config : #NEWLINE# #INDENT# request . get_resource ( ( section + '/dummy.html' ) ) #NEWLINE# conf = request . config . get #NEWLINE# if conf ( 'tools.staticdir.on' , False ) : #NEWLINE# #INDENT# msg = '' #NEWLINE# root = conf ( 'tools.staticdir.root' ) #NEWLINE# dir = conf ( 'tools.staticdir.dir' ) #NEWLINE# if ( dir is None ) : #NEWLINE# #INDENT# msg = 'tools.staticdir.dir is not set.' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fulldir = '' #NEWLINE# if os . path . isabs ( dir ) : #NEWLINE# #INDENT# fulldir = dir #NEWLINE# if root : #NEWLINE# #INDENT# msg = 'dir is an absolute path, even though a root is provided.' #NEWLINE# testdir = os . path . join ( root , msg [ 1 : ] ) #NEWLINE# if os . path . exists ( testdir ) : #NEWLINE# #INDENT# msg += ( '\nIf you meant to serve the filesystem folder at %r, remove the leading slash from dir.' % testdir ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( not root ) : #NEWLINE# #INDENT# msg = 'dir is a relative path and no root provided.' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fulldir = os . path . join ( root , dir ) #NEWLINE# if ( not os . path . isabs ( fulldir ) ) : #NEWLINE# #INDENT# msg = ( '%r is not an absolute path.' % fulldir ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( fulldir and ( not os . path . exists ( fulldir ) ) ) : #NEWLINE# #INDENT# if msg : #NEWLINE# #INDENT# msg += '\n' #NEWLINE# #UNINDENT# msg += ( '%r (root + dir) is not an existing filesystem path.' % fulldir ) #NEWLINE# #UNINDENT# #UNINDENT# if msg : #NEWLINE# #INDENT# warnings . warn ( ( '%s\nsection: [%s]\nroot: %r\ndir: %r' % ( msg , section , root , dir ) ) )