[open-ils-commits] r1304 - in servres/trunk/conifer: integration syrup/views (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Apr 2 20:53:55 EDT 2011


Author: gfawcett
Date: 2011-04-02 20:53:54 -0400 (Sat, 02 Apr 2011)
New Revision: 1304

Modified:
   servres/trunk/conifer/integration/evergreen_site.py
   servres/trunk/conifer/syrup/views/items.py
Log:
Fixed a few bugs that occurred if you did not have OPENSRF_STAFF_USERID defined.

Modified: servres/trunk/conifer/integration/evergreen_site.py
===================================================================
--- servres/trunk/conifer/integration/evergreen_site.py	2011-04-03 00:38:02 UTC (rev 1303)
+++ servres/trunk/conifer/integration/evergreen_site.py	2011-04-03 00:53:54 UTC (rev 1304)
@@ -220,8 +220,8 @@
     OSRF_CAT_SEARCH_ORG_UNIT = getattr(settings, 'OSRF_CAT_SEARCH_ORG_UNIT', None)
 
     def cat_search(self, query, start=1, limit=10):
-        barcode = 0
-        bibid	= 0
+        barcode = ''
+        bibid	= ''
         is_barcode = re.search('\d{14}', query)
 
         if query.startswith(self.EG_BASE):

Modified: servres/trunk/conifer/syrup/views/items.py
===================================================================
--- servres/trunk/conifer/syrup/views/items.py	2011-04-03 00:38:02 UTC (rev 1303)
+++ servres/trunk/conifer/syrup/views/items.py	2011-04-03 00:53:54 UTC (rev 1304)
@@ -7,7 +7,7 @@
 from collections                 import defaultdict
 from conifer.libsystems.evergreen.support import initialize, E1
 
-if getattr(settings, 'OPENSRF_STAFF_USERID'): # TODO: we need an explicit 'we do updates' flag
+if hasattr(settings, 'OPENSRF_STAFF_USERID'): # TODO: we need an explicit 'we do updates' flag
     from conifer.libsystems.evergreen import opensrf
 
 @members_only
@@ -297,8 +297,9 @@
         except:
             pubdate = ''
 
-        bibid = bib_id=request.POST.get('bibid')
-        bc = None
+        bibid   = bib_id=request.POST.get('bibid', '')
+        bar_num = request.POST.get('bc', '')
+        barcode = None
 
         # TODO: the Leddy stuff here belongs in an integration-module function. [GF]
 
@@ -309,19 +310,17 @@
         eg_location = ''
 
         #TODO: use python bindings for these interactions
-        bar_num=request.POST.get('bc')
-        if bar_num and getattr(settings, 'OPENSRF_STAFF_USERID'): # TODO: we need an explicit 'we do updates' flag
-            bc = bar_num
-            eg_modifier, eg_location, eg_callno = opensrf.ils_item_info(bc)
-
-        if bibid > 0:
+        if bar_num and hasattr(settings, 'OPENSRF_STAFF_USERID'): # TODO: we need an explicit 'we do updates' flag
+            barcode = bar_num
+            eg_modifier, eg_location, eg_callno = opensrf.ils_item_info(barcode)
+        if bibid:
             item = site.item_set.create(parent_heading=parent_item,
                                         title=dublin.get('dc:title','Untitled'),
                                         author=dublin.get('dc:creator'),
                                         publisher=dublin.get('dc:publisher',''),
                                         published=pubdate,
                                         bib_id = bibid,
-                                        barcode = bc,
+                                        barcode = barcode,
                                         circ_modifier = eg_modifier,
                                         circ_desk = eg_location,
                                         orig_callno = eg_callno,
@@ -333,9 +332,9 @@
                                         author=dublin.get('dc:creator'),
                                         publisher=dublin.get('dc:publisher',''),
                                         published=pubdate,
-                                        barcode = bc,
+                                        barcode = barcode,
                                         circ_modifier = eg_modifier,
-                                        circ_desk = eg_desk,
+                                        circ_desk = eg_location,
                                         orig_callno = eg_callno,
                                         marcxml=raw_pickitem,
                                         **dct)



More information about the open-ils-commits mailing list