|
Adventures in Python [0211.2000] I spent almost all day porting PHPLIB to Python, and I'm not even close to done. It's taking a lot longer than I expected, mostly because I decided to redesign it to be more Pythonic. I basically only worked on Sess today, but I'm just about done with it. Some of my changes: Instead of registering global variables, have a magical dictionary and only its contents get saved. This is more like ASP. I try to avoid the need to subclass. You just pass it a storage device (called a SessPool, of course) and then you can set any other attributes you like manually before calling start(). Thanks to cPickle, I didn't have to worry about rewriting the serialization stuff, but I did get caught on one thing - generating unique ID's. Python doesn't seem to have anything like PHP's uniqid function. So I made my own, and wrote the code to test it. Tomorrow, I get to actually implement SessPool, Auth, Perm, and User. I *think* these will all be fairly simple, but we'll see. I will probably wind up reimplementing much of the cgi module as well, to support cookies and the seperation of form and querystring values a la ASP. In the meantime, I've got a wrapper module called "Request" that just pulls in the stuff from cgi and a cookies module I found on the net. There will also be a "Response" module for setting cookies, headers, and writing output. This is also ASP-inspired. I don't plan to actually use this, but with that ASP mentality and Poor Man's Zope, python would actually stand up quite well to ASP. Actually, I may include something very much like PMZ for Zike customers that prefer ASP/PHP - style stripes to Zebra. All of this stuff I'm building is part of a collection of tools collectively known as ZikeBase. It's basically a framework for publishing relational databases on the web. This is fundamentally different from the real Zope, because Zope is for publishing objects, not databases. I would think that ZikeBase and Zope could do similar things, but they approach it from different angles. ZikeBase is "MS-Access for the web", whereas Zope is.. well, Zope. ZikeBase also has some content management features, mostly based around two classes: Content and Node. Content saves stuff like messages or blog entries, and Node lets you arrange stuff in various ways. There will also be a search engine to replace the crappy one I've made in Perl. Anyway... Off to bed... |