[Checkins] SVN: relstorage/trunk/relstorage/relstorage.py Fixed KeyError reporting to not trip over a related KeyError while
Shane Hathaway
shane at hathawaymix.org
Sat Jan 24 19:46:35 EST 2009
Log message for revision 94992:
Fixed KeyError reporting to not trip over a related KeyError while
logging. Also expanded a docstring.
Changed:
U relstorage/trunk/relstorage/relstorage.py
-=-
Modified: relstorage/trunk/relstorage/relstorage.py
===================================================================
--- relstorage/trunk/relstorage/relstorage.py 2009-01-25 00:03:00 UTC (rev 94991)
+++ relstorage/trunk/relstorage/relstorage.py 2009-01-25 00:46:35 UTC (rev 94992)
@@ -238,7 +238,9 @@
def _get_oid_cache_key(self, oid_int):
"""Return the cache key for finding the current tid.
- This is overridden by BoundRelStorage.
+ This is overridden by BoundRelStorage. This version always returns
+ None because a non-bound storage does not have a prev_polled_tid,
+ which is required for cache invalidation.
"""
return None
@@ -261,12 +263,18 @@
else:
msg.append("Current transaction is %d" % row[0])
- rows = adapter.iter_object_history(cursor, oid_int)
tids = []
- for row in rows:
- tids.append(row[0])
- if len(tids) >= 10:
- break
+ try:
+ rows = adapter.iter_object_history(cursor, oid_int)
+ except KeyError:
+ # The object has no history, at least from the point of view
+ # of the current database load connection.
+ pass
+ else:
+ for row in rows:
+ tids.append(row[0])
+ if len(tids) >= 10:
+ break
msg.append("Recent object tids: %s" % repr(tids))
log.warning('; '.join(msg))
More information about the Checkins
mailing list