[SQLObject] Hooking into insert, update, delete, etc.
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Daniel E B. <da...@li...> - 2004-03-30 00:13:12
|
Hi all. I am new to SQLObject and I just read through the docs and started digging into the code some although my knowlege of meta classes and such needs work. My situation is I have 6 or so fields on the ends of all my data tables: createdOn, createdBy, modifiedOn, modifiedBy, owner and tag. What I did in the past was write wrapper functions for insert, update, delete, etc. that would get the info from the current session and would add additional where clauses using these fields and/or update these fields so that I would only be passing the sql that did what I wanted to do at the time and then the wrapper would automatically add stuff to the sql to handle these fields. My question is how can I use SQLObject to update/query using these fields but have it be transparent to the rest of my sql objects. Ideally I would like this functionality to be factored out into a base class which derives from SQLObject. I should then be able to use this as a base for the rest of my data objects and get the same sort of "transparency" that I had with my simple wrapper functions. I am not sure if that would work as there is no stand alone table that has these fields. I know that SQLObject uses properties, etc. but I was hoping I could get a nudge in the right direction before I dug too deeply into SQLObject code. Thanks for reading. Dan -- And if cynics ridicule freedom, ridicule community...if ``hard nosed realists'' say that profit is the only ideal...just ignore them, and use copyleft all the same. -- RMS |