def __call__(self): while fcgi.isFCGI(): try: req = Request(fcgi.Accept()) self.balancer.Add(req) except: logging.exception("bad accepted request")
def run(self): """Block waiting for new request.""" while fcgi.isFCGI(): req = fcgi.FCGI() self.FCGICallback(req)
independent of everything but standard Python.) """ for c, e in codes: s = s.replace(c, e) return s # Start FCGI Adapter if os.name != 'posix': print "This adapter is only available on UNIX" sys.exit(1) fcgi._startup() if not fcgi.isFCGI(): print "No FCGI Environment Available" print "This module cannot be run from the command line" sys.exit(1) if not webwareDir: webwareDir = os.path.dirname(os.path.dirname(os.getcwd())) sys.path.insert(1, webwareDir) webKitDir = os.path.join(webwareDir, 'WebKit') os.chdir(webKitDir) host, port = open(os.path.join(webKitDir, 'adapter.address')).read().split(':', 1) port = int(port) fcgiloop = FCGIAdapter(webKitDir) fcgiloop.run()
def run(self): """Block waiting for new request""" while fcgi.isFCGI(): req = fcgi.FCGI() self.FCGICallback(req)
] def HTMLEncode(s, codes=HTMLCodes): """ Returns the HTML encoded version of the given string. This is useful to display a plain ASCII text string on a web page. (We could get this from WebUtils, but we're keeping CGIAdapter independent of everything but standard Python.) """ for code in codes: s = string.replace(s, code[0], code[1]) return s if os.name != 'posix': print "This adapter is only available on UNIX" sys.exit(1) fcgi._startup() if not fcgi.isFCGI(): print "No FCGI Environment Available" print "This module cannot be run from the command line" sys.exit(1) addrfile = os.path.join(WebKitDir, _AddressFile) (host, port) = string.split(open(addrfile).read(), ':') port = int(port) os.chdir(WebKitDir) sys.path.append(os.path.abspath(os.path.join(WebKitDir, ".."))) from Adapter import Adapter class FCGIAdapter(Adapter):