From: Conan C.A. <co...@wa...> - 2003-02-26 22:42:13
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 In answer to Scott Chapman's question about standalone mode, I agree we need it to run in full standalone mode. It is important to me that spyce runs by itself for development purposes. When I'm developing, I don't want to have to get apache, mod_python, etc. up and running. I just want to bring up spyce to test files. I modified the spyceWWW.py file to allow real web server use. It's not fast enough for production, obviously, but it works well for development. Just replace the spyceHTTPhandler class with the following: class spyceHTTPhandler(CGIHTTPServer.CGIHTTPRequestHandler): def is_spy(self): path = self.path.split('?')[0] if len(path) > 4 and path[-4:].lower() == '.spy': return 1 return 0 def do_spy(self): try: # parse path path = self.path i=string.find(path, '?') if i!=-1: path = path[:i] path = os.path.normpath(path) while path and (path[0]=='/' or path[0:2]=='..'): if path[0]=='/': path=path[1:] if path[0:2]=='..': path=path[2:] path = os.path.join(self.server.documentRoot, path) self.log_request() # process spyce request = spyceHTTPRequest(self, self.server.documentRoot) response = spyceHTTPResponse(self) result = spyce.spyceFileHandler(request, response, path) response.close() except IOError: pass def do_GET(self): '''Switches .spy requests to spyce and all others to the CGIHTTPReqeuestHandler class''' if self.is_spy(): self.do_spy() else: CGIHTTPServer.CGIHTTPRequestHandler.do_GET(self) def do_POST(self): '''Switches .spy requests to spyce and all others to the CGIHTTPReqeuestHandler class''' if self.is_spy(): self.do_spy() else: CGIHTTPServer.CGIHTTPRequestHandler.do_POST(self) - ------- Conan C. Albrecht, Ph.D. Brigham Young University co...@wa... http://warp.byu.edu/ PGP Key: http://warp.byu.edu/conanATwarp_byu_edu.gpg See http://warp.byu.edu/PGPInfo.html -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (Darwin) iD8DBQE+XULT/nGkM0MjAawRAkNEAJ9yoP+1ZEtydP5TJ3PxXmXFxBSZoQCfaT4T cGU8Lra37xtgLnb1ZXQb9HI= =EgnD -----END PGP SIGNATURE----- |