def handle(self, sock, read_data, path, headers):
        "Sends back a static error page."
        assert self.type is not None
        try:
            # Get the correct file
            try:
                fh = open(os.path.join(self.balancer.static_dir, "%s.http" % self.type))
            except IOError:
                fh = open(os.path.join(os.path.dirname(__file__), "static", "%s.http" % self.type))
            # Send it, using sendfile if poss. (no fileno() means we're probably using mock sockets)
            try:
                self._sendfile(sock.fileno(), fh.fileno(), 0, os.fstat(fh.fileno()).st_size)
            except (TypeError, AttributeError):
                sock.sendall(fh.read())
            # Close the file and socket
            fh.close()
            sock.close()
        except socket.error, e:
            if e.errno != errno.EPIPE:
                raise
def handle ( self , sock , read_data , path , headers ) : assert self . type is not None try : try : fh = open ( os . path . join ( self . balancer . static_dir , "%s.http" % self . type ) ) except IOError : fh = open ( os . path . join ( os . path . dirname ( __file__ ) , "static" , "%s.http" % self . type ) ) try : self . _sendfile ( sock . fileno ( ) , fh . fileno ( ) , 0 , os . fstat ( fh . fileno ( ) ) . st_size ) except ( TypeError , AttributeError ) : sock . sendall ( fh . read ( ) ) fh . close ( ) sock . close ( ) except socket . error , e : if e . errno != errno . EPIPE : raise
Sends back a static error page.