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.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss