[Neo-report] r2423 vincent - /trunk/neo/client/app.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Sat Nov 6 00:22:56 CET 2010
Author: vincent
Date: Sat Nov 6 00:22:56 2010
New Revision: 2423
Log:
Don't check & fetch, just fetch and catch KeyError.
Modified:
trunk/neo/client/app.py
Modified: trunk/neo/client/app.py
==============================================================================
--- trunk/neo/client/app.py [iso-8859-1] (original)
+++ trunk/neo/client/app.py [iso-8859-1] Sat Nov 6 00:22:56 2010
@@ -432,8 +432,12 @@ class Application(object):
# Try in cache first
self._cache_lock_acquire()
try:
- if oid in self.mq_cache:
- return self.mq_cache[oid][0]
+ try:
+ result = self.mq_cache[oid]
+ except KeyError:
+ pass
+ else:
+ return result[0]
finally:
self._cache_lock_release()
# history return serial, so use it
@@ -559,9 +563,12 @@ class Application(object):
try:
self._cache_lock_acquire()
try:
- if oid in self.mq_cache:
- neo.logging.debug('load oid %s is cached', dump(oid))
+ try:
serial, data = self.mq_cache[oid]
+ except KeyError:
+ pass
+ else:
+ neo.logging.debug('load oid %s is cached', dump(oid))
return data, serial
finally:
self._cache_lock_release()
More information about the Neo-report
mailing list