def serve_fileobj(fileobj, content_type=None, disposition=None, name=None, debug=False):
 response = cherrypy.serving.response
 try:
  st = os.fstat(fileobj.fileno())
 except AttributeError:
  if debug:
   cherrypy.log('os has no fstat attribute', 'TOOLS.STATIC')
  content_length = None
 else:
  response.headers['Last-Modified'] = httputil.HTTPDate(st.st_mtime)
  cptools.validate_since()
  content_length = st.st_size
 if (content_type is not None):
  response.headers['Content-Type'] = content_type
 if debug:
  cherrypy.log(('Content-Type: %r' % content_type), 'TOOLS.STATIC')
 cd = None
 if (disposition is not None):
  if (name is None):
   cd = disposition
  else:
   cd = ('%s; filename="%s"' % (disposition, name))
  response.headers['Content-Disposition'] = cd
 if debug:
  cherrypy.log(('Content-Disposition: %r' % cd), 'TOOLS.STATIC')
 return _serve_fileobj(fileobj, content_type, content_length, debug=debug)

def serve_fileobj ( fileobj , content_type = None , disposition = None , name = None , debug = False ) : response = cherrypy . serving . response try : st = os . fstat ( fileobj . fileno ( ) ) except AttributeError : if debug : cherrypy . log ( 'os has no fstat attribute' , 'TOOLS.STATIC' ) content_length = None else : response . headers [ 'Last-Modified' ] = httputil . HTTPDate ( st . st_mtime ) cptools . validate_since ( ) content_length = st . st_size if ( content_type is not None ) : response . headers [ 'Content-Type' ] = content_type if debug : cherrypy . log ( ( 'Content-Type: %r' % content_type ) , 'TOOLS.STATIC' ) cd = None if ( disposition is not None ) : if ( name is None ) : cd = disposition else : cd = ( '%s; filename="%s"' % ( disposition , name ) ) response . headers [ 'Content-Disposition' ] = cd if debug : cherrypy . log ( ( 'Content-Disposition: %r' % cd ) , 'TOOLS.STATIC' ) return _serve_fileobj ( fileobj , content_type , content_length , debug = debug )
set status .