From dd70c0a4328a211db3f24156f2790846229fb021 Mon Sep 17 00:00:00 2001 From: Art Rhyno Date: Tue, 26 Jul 2011 07:28:21 -0400 Subject: [PATCH] Fix up support for adding physical materials using a URL. Signed-off-by: Art Rhyno --- conifer/integration/evergreen_site.py | 7 +------ conifer/libsystems/evergreen/item_status.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/conifer/integration/evergreen_site.py b/conifer/integration/evergreen_site.py index e822933..c6fa1f2 100644 --- a/conifer/integration/evergreen_site.py +++ b/conifer/integration/evergreen_site.py @@ -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: diff --git a/conifer/libsystems/evergreen/item_status.py b/conifer/libsystems/evergreen/item_status.py index 61608e9..544c096 100644 --- a/conifer/libsystems/evergreen/item_status.py +++ b/conifer/libsystems/evergreen/item_status.py @@ -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 -- 2.11.0