Sunday, November 18th, 2012

Source release for my object database code

I have decided to release what I currently have on the Django Object Database for people can see the code thus far and perhaps provide some assistance on it, if they choose.

Currently, much of the code is there for the sole purpose of testing various features. The automatic admin form generation code for objects stored in the Database current works, and a Person object is there to demonstrate it. Currently there is a lot of hardcoded information, and you will need to set a specific to make the management interface work. This code is not for any production use, currently it is merely a toy I am working on, with the possibility of it turning into something great in the future.

You should also be-able to switch over the backend database to ZODB, if you choose. I have not yet tested it with a ZODB, so it may or may not work as intended. Currently the displaying of a directory tree is done by detecting if the object is a dict, by seeing if it has the special method __getitem__ or iteritems(). Thus making it possible to create custom directory listings of objects or other interesting data. You should also be-able to feed it any dict you want, and it should visualize it for you. You may not be-able to view the objects, but you will be-able to browse around the dict, as long as the above methods are available.

This code is far from optimized or even for that matter done correctly. Feel free to fork it and use it as you please. I will be adding an LGPL license file shortly.

There is currently an odd bug when saving objects, this could be either due to using Shelve, or something I messed up on. I will be looking into it more deeply soon to see what's going on. Basically, if you create a second Person object in the database, it is a link to the other Person object already created, essentially overwriting what was once in it. I suspect it is something to do with the model I made to handle the pickling process. I may just scrap the idea of using Shelve and just go with ZODB, as it is most likely a more stable and established solution for this.

The code can be found on my bitbucket account.

Python Powered | © 2012-2014 Kevin Veroneau