dmiller wrote:
> I also have some ideas about cleaning up the UnitOfWork/
> ScopedRegistry/ObjectStore mechanism. I had some problems figuring
> out which one was to be used for which task. Particularly confusing
> was the objectstore.uow which is actually a scoped registry. I think
> we could reduce it to ObjectStore and UnitOfWork (in most cases
> UnitOfWork would be totally encapsulated by ObjectStore)--the patch I
> submitted the other day starts to address these issues. This is
> getting off topic so I'll start another thread for that when I get
> around to it.
Its trickier than it seems it should be, isnt it ? I have loaded up your
objectstore/util patch, a little skeptically, but upon seeing it I
immediately liked it (and with ScopedRegistry, I said doh!, much easier
than what I had...), and it might be the way to work out the concept of
associating objects with a unit of work, but still having some layer of
indirection between those two, in case an object wants to be associated
with "whatever the thread-local UOW is", etc. I am calling the
"ObjectStore" a "Session", continuing with the hibernate-like naming
scheme and also to distinguish the "objectstore" module (I already have
had some grief having a "mapper" module and a "mapper" function).
as for the assocaiting objects with the session, still working out how i
want to get the "using()" idea to work, since it looks like id need
*another* layer of thread-local stuff going on and its seeming like it
shouldnt have to be that complicated. ill keep you posted.
regarding thread local in general, if you follow a strict pattern then
they are safe. like to have a different unit of work for a certain method
call:
olduow = objectstore.uow()
try:
objectstore.uow.set(newuow)
return function()
finally:
objectstore.uow.set(olduow)
the "finally" is guaranteed to execute and restore the original unit of
work....youre basically working in tandem with Python's own stackframes.
anyway thanks for all the thinking ! this is one of those areas that I
knew I would need help/suggestions with.
- mike
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users