def handle(self): # When using run_once, we have a single process, so # we cannot loop in BaseHTTPRequestHandler.handle; we # must return and handle new connections if self.run_once: self.handle_one_request() else: SimpleHTTPRequestHandler.handle(self)
def handle(self): # When using run_once, we have a single process, so # we cannot loop in BaseHTTPRequestHandler.handle; we # must return and handle new connections if self.run_once: self.handle_one_request() else: SimpleHTTPRequestHandler.handle(self)
def handle(self): "Handle a request and, if anything has changed, rebuild the site." # overwrite the handle method in SimpleHTTPRequestHandler with this. # declare most_recent_time global; we'll be changing it later. global most_recent_time # figure out the most recent time edited in the source directory new_recent = most_recent() # only build the site if the new most recent is more recent than the # old one, i.e. if one or more of the files has been edited. if new_recent > most_recent_time: # update most_recent_time most_recent_time = new_recent # Build the site from the source directory print("Rebuilding your Cytoplasm site...") site.build() # Call SimpleHTTPRequestHandler.handle(), so it can do stuff there too. SimpleHTTPRequestHandler.handle(self)
def handle(self): #needed when wfile is used, or when self.close_connection is not used # #catch errors in SimpleHTTPRequestHandler.handle() after socket disappeared #due to loss of network connection self.log_message("handle entry on worker thread %d" % threading.current_thread().ident) try: SimpleHTTPRequestHandler.handle(self) except (socket.error, ) as err: self.log_message( "handle(): Exception: in SimpleHTTPRequestHandler.handle(): %s" % str(err.args)) except (TypeError, ) as err: self.log_message( "handle(): Exception: in SimpleHTTPRequestHandler.handle(): %s" % str(err)) self.log_message("handle done on worker thread %d" % threading.current_thread().ident)
def handle(self): try: SimpleHTTPRequestHandler.handle(self) except socket.error: pass