[SQLObject] Re: Using SQLObjects without database actions.
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Chris G. <ch...@il...> - 2004-03-07 19:03:32
|
"Peter Gebauer" <pe...@fs...> wrote in message news:20040307163700.GA1776@coke... > Many times I want to use SQLObjects as regular data structures, fill them > with data and manipulate that data, but without having to save the data to > the backend. The best thing would be to have a switch in the SQLObject > telling it when and when not to be database consious. > > Or, maybe a small add-on that will make a non-database conscious object of > an SQLObject and populate an SQLObject from a non-database concsious object. > > Has anybody written anything like this already? Well, what I did was add .acquireLock() and .releaseLock() functions to the SQLObject subclass I made which would adjust and check the "locked" and "locktimeout" variables. Then I added a function to SQLObject.py called .values() which returns a dictionary of all the table attributes (it gets the attributes the same way that .__repr__() does). It's not a very general purpose solution though. I like the idea of having a kind of "update object" which looks like an SQLObject, and can be shoved back into the database when it's finished being updated. It would be especially handy if it was picklable, so that it could be used as a Webware session variable. Hmmm... Ian? What do you think? :) |