Oleg, I will return to this and check what is wrong when I will get a little time. Currently I'm over my head with some work projects, sorry.
It may be something about the expireAll method. When I implemented this, that method wasn't yet implemented. I tried to manually expire the record with rec.expire() and it that case it worked as expected (the cache returned a new object). So I'll have to look if there is something wrong with expireAll or is just the way the test was setup. Regarding your version below, even if you keep a reference to the object during the cache cleanup, the cache shouldn't return a reference to it after that. I'll need to better look at this and I'll get back to you about it as soon as I find some time to investigate. While your test below should work, it may hide some problems inside expireAll On Monday 02 October 2006 17:08, Oleg Broytmann wrote: > Hello! I'd like to return to the problem the patch caused in > test_cache. > > On Mon, May 29, 2006 at 10:26:49PM +0300, Dan Pascu wrote: > > def __init__(self, instance): > > - self.instance = instance > > + self.instance = weakref.proxy(instance) > > > > def setClass(cls, soClass): > > cls.soClass = soClass > > @@ -1501,7 +1502,7 @@ > > class SQLObjectState(object): > > > > def __init__(self, soObject): > > - self.soObject = soObject > > + self.soObject = weakref.proxy(soObject) > > self.protocol = 'sql' > > What do you think of the following test_cache? > > def test_cache(): > setupClass(CacheTest) > s = CacheTest(name='foo') > obj_id = id(s) > s_id = s.id > assert CacheTest.get(s_id) is s > weak_s = weakref.ref(s) > assert not s.sqlmeta.expired > CacheTest.sqlmeta.expireAll() > assert s.sqlmeta.expired > del s > CacheTest.sqlmeta.expireAll() > s = CacheTest.get(s_id) > # We should have the old object deleted > assert weak_s() is None > > Oleg. -- Dan ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss