I created a unified diff patch for ZopeHTTPServer which incorporates the improved exception handling. It is diffed against 1.9.0b2. You'll need to go into the ZopeHTTPServer directory to apply it. The other thing is: Upgrading. It looks like from the install program that if you do install over the old installation that it won't nuke your Data.bbb, which is good, but raises some other questions: 1) Generally, can you merge or otherwise transfer data from Data.bbb to another? I suspect the answer is going to be something like "loop over the keys". 2) How do you safely back up the database wrt things like locking and transactions? I also suspect a similar answer to #1... I'm not a previous Bobo user, as you can probably tell... -- Andy Dustman You should always say "spam" and "eggs" ComStar Communications Corp. instead of "foo" and "bar" (706) 549-7689 | PGP KeyID=0xC72F3F1D in Python examples. (Mark Lutz) --- ZopeHTTPServer.py.orig Fri Dec 11 16:14:29 1998 +++ ZopeHTTPServer.py Fri Dec 11 20:35:35 1998 @@ -349,24 +349,21 @@ def handle_request(self): """Handle one request, possibly blocking.""" - request, client_address = self.get_request() - if self.verify_request(request, client_address): - try: + request, client_address = None, None + try: + request, client_address = self.get_request() + if self.verify_request(request, client_address): self.process_request(request, client_address) - except SystemExit: - self.handle_error(request, client_address) - sys.exit(0) - except: - self.handle_error(request, client_address) + except SystemExit: + self.handle_error(request, client_address) + sys.exit(0) + except: + self.handle_error(request, client_address) class ThreadingHTTPServer(SocketServer.ThreadingMixIn, - BaseHTTPServer.HTTPServer): + NonThreadingHTTPServer): "A threading HTTPServer with some socket tweaks" - def server_bind(self): - self.socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) - return BaseHTTPServer.HTTPServer.server_bind(self) - def try_to_become_nobody(): # from CGIHTTPServer
Andy Dustman wrote:
I created a unified diff patch for ZopeHTTPServer which incorporates the improved exception handling. It is diffed against 1.9.0b2. You'll need to go into the ZopeHTTPServer directory to apply it.
The other thing is: Upgrading. It looks like from the install program that if you do install over the old installation that it won't nuke your Data.bbb, which is good, but raises some other questions:
1) Generally, can you merge or otherwise transfer data from Data.bbb to another? I suspect the answer is going to be something like "loop over the keys".
Yes. At the Python level, BoboPOS has an API for exporting and importing objects. (Read the source if you're interested. The thing FKA BoboPOS3 actually has a documented API for this. :) If you are using the Zope framework, there is a web interface for exporting and importing objects. As it's name implies, it is a temporary interface until a nice interface can be designed. You can export an object by invoking it's 'manage_exportHack' method. For example, to export folder a/b, you can go to the URL: a/b/manage_exportHack This created a file named 'export.bbe' in the var directory. To import this file into another site, copy the file to the other sites var directory and then invoke the method, 'manage_importHack' on a folder object that you want to import into. For example, to import into the folder x/y/z, simply visit x/y/z/manage_importHack.
2) How do you safely back up the database wrt things like locking and transactions? I also suspect a similar answer to #1...
You can simply back up the file. Because of the way the file is written, it is highly unlikely for a backup file created directly to have a problem. Alternatively, you could export the entire site and backup the export file. Jim -- Jim Fulton mailto:jim@digicool.com Technical Director (888) 344-4332 Python Powered! Digital Creations http://www.digicool.com http://www.python.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (2)
-
Andy Dustman -
Jim Fulton