def staticfile(filename, root=None, match='', content_types=None, debug=False):
 request = cherrypy.serving.request
 if (request.method not in ('GET', 'HEAD')):
  if debug:
   cherrypy.log('request.method not GET or HEAD', 'TOOLS.STATICFILE')
  return False
 if (match and (not re.search(match, request.path_info))):
  if debug:
   cherrypy.log(('request.path_info %r does not match pattern %r' % (request.path_info, match)), 'TOOLS.STATICFILE')
  return False
 if (not os.path.isabs(filename)):
  if (not root):
   msg = ("Static tool requires an absolute filename (got '%s')." % filename)
   if debug:
    cherrypy.log(msg, 'TOOLS.STATICFILE')
   raise ValueError(msg)
  filename = os.path.join(root, filename)
 return _attempt(filename, content_types, debug=debug)

def staticfile ( filename , root = None , match = '' , content_types = None , debug = False ) : request = cherrypy . serving . request if ( request . method not in ( 'GET' , 'HEAD' ) ) : if debug : cherrypy . log ( 'request.method not GET or HEAD' , 'TOOLS.STATICFILE' ) return False if ( match and ( not re . search ( match , request . path_info ) ) ) : if debug : cherrypy . log ( ( 'request.path_info %r does not match pattern %r' % ( request . path_info , match ) ) , 'TOOLS.STATICFILE' ) return False if ( not os . path . isabs ( filename ) ) : if ( not root ) : msg = ( "Static tool requires an absolute filename (got '%s')." % filename ) if debug : cherrypy . log ( msg , 'TOOLS.STATICFILE' ) raise ValueError ( msg ) filename = os . path . join ( root , filename ) return _attempt ( filename , content_types , debug = debug )
serve a static resource from the given filename .