Fix up support for adding physical materials using a URL.
authorArt Rhyno <art632000@yahoo.ca>
Tue, 26 Jul 2011 11:28:21 +0000 (07:28 -0400)
committerArt Rhyno <art632000@yahoo.ca>
Tue, 26 Jul 2011 11:28:21 +0000 (07:28 -0400)
Signed-off-by: Art Rhyno <art632000@yahoo.ca>
conifer/integration/evergreen_site.py
conifer/libsystems/evergreen/item_status.py

index e822933..c6fa1f2 100644 (file)
@@ -179,12 +179,6 @@ class EvergreenIntegration(object):
             circmod = sort_circmod
             alldues = sort_alldues
             try:
-                # Note: MassLNC requires this, need to add a version
-                # value to settings and consider required opensrf to
-                # to be installed for any evergreen site.
-                #
-                # for org, skip1, callnum, skip2, loc, stats in counts:
-
                 callprefix = ''
                 callsuffix = ''
                 if len(callno) == 0:
@@ -367,6 +361,7 @@ class EvergreenIntegration(object):
             for key in params.keys():
                 if key.find('?r') != -1:
                     bibid = params[key]
+                
             results = M.marcxml_to_records(I.url_to_marcxml(query))
             numhits = len(results)
         elif is_barcode:
index 61608e9..544c096 100644 (file)
@@ -15,9 +15,20 @@ def bib_id_to_marcxml(bib_id):
     return E1('open-ils.supercat.record.marcxml.retrieve', bib_id)
 
 def url_to_marcxml(url):
+    EVERGREEN_SERVER = getattr(settings, 'EVERGREEN_SERVER', '')
+
+    # OPAC_URL: the base URL for the OPAC's Web interface.
+    # default: http://your-eg-server/
+    # local_settings variable: EVERGREEN_OPAC_URL
+
+    if hasattr(settings, 'EVERGREEN_OPAC_URL'):
+        OPAC_URL = settings.EVERGREEN_OPAC_URL
+    else:
+        assert EVERGREEN_SERVER
+        OPAC_URL = 'http://%s/' % EVERGREEN_SERVER
+
     # this is a hack. Given a opac Title Details url, return marcxml.
-    assert support.BASE, 'no EG BASE. Did you call support.initialize()?'
-    if url.startswith(support.BASE):
+    if url.startswith(OPAC_URL):
         if 'feed/bookbag' in url:
             #eg http://concat.ca/opac/extras/feed/bookbag/marcxml-full/60
             marc_url = re.sub(r'(.*/bookbag/)(.*?)(/.*)', r'\1marcxml-full\3', url)
@@ -28,7 +39,7 @@ def url_to_marcxml(url):
             if item_id:
                 marc_url = ("%s/opac/extras/unapi?"
                             "id=tag:concat.ca,9999:biblio-record_entry/" # FIMXE, concat.ca reference!
-                            "%s/-&format=marcxml-full" % (support.BASE, item_id))
+                            "%s/-&format=marcxml-full" % (OPAC_URL, item_id))
             xml = unicode(urllib2.urlopen(marc_url).read(), 'utf-8')
         return xml