[open-ils-commits] r1041 - servres/trunk/conifer/integration (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Oct 13 22:38:46 EDT 2010


Author: gfawcett
Date: 2010-10-13 22:38:43 -0400 (Wed, 13 Oct 2010)
New Revision: 1041

Modified:
   servres/trunk/conifer/integration/uwindsor.py
Log:
be a bit more defensive w.r.t. network outages.

Modified: servres/trunk/conifer/integration/uwindsor.py
===================================================================
--- servres/trunk/conifer/integration/uwindsor.py	2010-10-14 02:36:26 UTC (rev 1040)
+++ servres/trunk/conifer/integration/uwindsor.py	2010-10-14 02:38:43 UTC (rev 1041)
@@ -81,19 +81,22 @@
 @memoize(timeout=CACHE_TIME)
 def _item_status(bib_id):
     if bib_id:
-        counts = E1('open-ils.search.biblio.copy_counts.location.summary.retrieve', 
-                    bib_id, 1, 0)
-        lib = desk = avail = 0
-        for org, callnum, loc, stats in counts:
-            avail_here = stats.get(AVAILABLE, 0)
-            anystatus_here = sum(stats.values())
-            if loc == RESERVES_DESK_NAME:
-                desk += anystatus_here
-                avail += avail_here
-            lib += anystatus_here
-        return (lib, desk, avail)
+        try:
+            counts = E1('open-ils.search.biblio.copy_counts.location.summary.retrieve', 
+                        bib_id, 1, 0)
+            lib = desk = avail = 0
+            for org, callnum, loc, stats in counts:
+                avail_here = stats.get(AVAILABLE, 0)
+                anystatus_here = sum(stats.values())
+                if loc == RESERVES_DESK_NAME:
+                    desk += anystatus_here
+                    avail += avail_here
+                lib += anystatus_here
+            return (lib, desk, avail)
+        except:
+            pass          # fail silently if there's an opensrf related error.
+    return None
 
-
 def cat_search(query, start=1, limit=10):
     if query.startswith(EG_BASE):
         # query is an Evergreen URL



More information about the open-ils-commits mailing list