From fc97c6477649fe23e99d782955a38d4095018fd3 Mon Sep 17 00:00:00 2001 From: Art Rhyno Date: Fri, 19 Apr 2013 15:34:19 -0400 Subject: [PATCH] Fix e-resources bug and add note about academic terms to README Thanks to shadowspar for fixing bug that adds electronic resources from the catalog as physical items (PHYS) instead of URLs and cleaning up URLs that have additional paramters after the bib id. Academic terms are hardcoded in the integration class and a long overdue note has been added to README. The next step is to add an actual admin interface for this. Signed-off-by: Art Rhyno --- conifer/README | 3 ++- conifer/integration/evergreen_site.py | 16 ++++++++-------- conifer/integration/uwindsor.py | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/conifer/README b/conifer/README index 0ee43c0..25a9284 100644 --- a/conifer/README +++ b/conifer/README @@ -101,4 +101,5 @@ the active dist-packages folder, e.g. /usr/local/lib/python2.6/dist-packages Integration is carried out through an intergration class, for Windsor we use "conifer.integration.uwindsor.UWindsorIntegration", but this should be defined for your institution. The "evergreen_example.py" file in the integration directory can be used as a -model. +model. The "term_catalogue" function is where the academic terms, e.g. Fall 2013, +are defined. We need to add an admin interface for this at some point. diff --git a/conifer/integration/evergreen_site.py b/conifer/integration/evergreen_site.py index 6f4b3a3..0fa3aee 100644 --- a/conifer/integration/evergreen_site.py +++ b/conifer/integration/evergreen_site.py @@ -354,6 +354,7 @@ class EvergreenIntegration(object): barcode = '' bibid = '' is_barcode = re.search('\d{14}', query) + if query.startswith(self.OPAC_URL): results = [] # query is an Evergreen URL @@ -366,11 +367,11 @@ class EvergreenIntegration(object): results = M.marcxml_to_records(I.url_to_marcxml(query)) else: # likely template opac - url_nums = [int(s) for s in query.split('/') if s.isdigit()] - if len(url_nums) > 0: - bib_id = url_nums[len(url_nums) - 1] - results = M.marcxml_to_records(self.bib_id_to_marcxml(bib_id)) - + # first seq of digits after a / should be the bibid + match = re.search(r'/(\d+)', query) + if match: + bibid = match.group(1) + results = M.marcxml_to_records(self.bib_id_to_marcxml(bibid)) numhits = len(results) elif is_barcode: results = [] @@ -478,11 +479,10 @@ class EvergreenIntegration(object): 856$u form an associative array, where $9 holds the institution codes and $u holds the URLs. """ - # TODO: move this to local_settings + LIBCODE = 'OWA' if hasattr(settings, 'EVERGREEN_LIBCODE'): - # LIBCODE = settings.EVERGREEN_OPAC_URL - LIBCODE = self.OPAC_URL + LIBCODE = settings.EVERGREEN_LIBCODE try: dct = M.marcxml_to_dictionary(marc_string) words = lambda string: re.findall(r'\S+', string) diff --git a/conifer/integration/uwindsor.py b/conifer/integration/uwindsor.py index 982b5c9..061c929 100644 --- a/conifer/integration/uwindsor.py +++ b/conifer/integration/uwindsor.py @@ -76,8 +76,8 @@ class UWindsorIntegration(EvergreenIntegration): """ # TODO: make this algorithmic. return [ - ('2011S', '2011 Summer', date(2011,5,1), date(2011,9,1)), - ('2011F', '2011 Fall', date(2011,9,1), date(2011,12,31)), + ('2013S', '2013 Summer', date(2013,5,1), date(2013,9,1)), + ('2013F', '2013 Fall', date(2013,9,1), date(2013,12,31)), ] def _campus_info(self, name, *args): -- 2.11.0