def _render_file(file, request):
 file.restat(False)
 if (file.type is None):
  (file.type, file.encoding) = getTypeAndEncoding(file.basename(), file.contentTypes, file.contentEncodings, file.defaultType)
 if (not file.exists()):
  return file.childNotFound.render(request)
 if file.isdir():
  return file.redirect(request)
 request.setHeader('accept-ranges', 'bytes')
 try:
  fileForReading = file.openForReading()
 except IOError as e:
  import errno
  if (e[0] == errno.EACCES):
   return ForbiddenResource().render(request)
  else:
   raise
 producer = file.makeProducer(request, fileForReading)
 if (request.method == 'HEAD'):
  return ''
 producer.start()
 return NOT_DONE_YET

def _render_file ( file , request ) : file . restat ( False ) if ( file . type is None ) : ( file . type , file . encoding ) = getTypeAndEncoding ( file . basename ( ) , file . contentTypes , file . contentEncodings , file . defaultType ) if ( not file . exists ( ) ) : return file . childNotFound . render ( request ) if file . isdir ( ) : return file . redirect ( request ) request . setHeader ( 'accept-ranges' , 'bytes' ) try : fileForReading = file . openForReading ( ) except IOError as e : import errno if ( e [ 0 ] == errno . EACCES ) : return ForbiddenResource ( ) . render ( request ) else : raise producer = file . makeProducer ( request , fileForReading ) if ( request . method == 'HEAD' ) : return '' producer . start ( ) return NOT_DONE_YET
begin sending the contents of this l{file} to the given request .