From: CLIFFORD I. <cli...@di...> - 2004-09-30 21:46:24
|
At 10:45 AM 30/09/2004 -0500, Ian Bicking wrote: >SQLObject caches objects fairly aggressively. When you update something >in the database without using SQLObject, the cache will still remain with >the old (now incorrect) values. When you restart the AppServer, you are >purging the cache, and hence the problem went away. >You can refresh values with .sync() or .expire() (expire refreshes the >values lazily). Right now there's no "expire everything" method, though >there really should be. > >Does that explain your problem? Hi Ian, I have eliminated Webware out of the loop for testing purposes. Regardless of whether I use two different SQLObject instances to change the data or one instance of SQLObject with psql, I get the same behaviour. Below, I have two Python shells running which I have called Instance 1 and Instance 2. You will notice that the second instance does NOT see changes made by the first even though SQLObject is used on both cases. How would you use sync() or expire() in the example below? I could not find any documentation on it. Instance 1 ---------- >>> from myClasses import * >>> from psycopg import * # needed to trap for exceptions >>> grpTypes = GrpType.select(orderBy=GrpType.q.name) >>> for theGroupType in grpTypes: ... print theGroupType.id, theGroupType.name ... 1 Test 1 2 Test 2 3 Test 3 4 Test 4 5 Test 5 6 Test 6 7 Test 7 Instance 2 ---------- Execute same code as above, same results. Instance 1 ---------- >>> x = GrpType.get(7) >>> x <GrpType 7 name='Test 7' modUserId='cilkay' modDate=<DateTime object for '2004-09-30 16:46:39.88' at 407c83d8>> >>> x.name = 'I have changed' >>> x <GrpType 7 name='I have changed' modUserId='cilkay' modDate=<DateTime object for '2004-09-30 16:46:39.88' at 407c83d8>> >>> grpTypes = GrpType.select(orderBy=GrpType.q.name) >>> for theGroupType in grpTypes: ... print theGroupType.id, theGroupType.name ... 7 I have changed 1 Test 1 2 Test 2 3 Test 3 4 Test 4 5 Test 5 6 Test 6 Instance 2 ---------- >>> grpTypes = GrpType.select(orderBy=GrpType.q.name) >>> for theGroupType in grpTypes: ... print theGroupType.id, theGroupType.name ... 1 Test 1 2 Test 2 3 Test 3 4 Test 4 5 Test 5 6 Test 6 7 Test 7 Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |