Avoid double-proxying boreal links
authorDan Scott <dscott@laurentian.ca>
Thu, 23 Feb 2012 21:48:11 +0000 (16:48 -0500)
committerDan Scott <dscott@laurentian.ca>
Tue, 7 May 2013 18:57:40 +0000 (14:57 -0400)
Signed-off-by: Dan Scott <dscott@laurentian.ca>
tools/ebooks/prep_ebook_records.py

index 54a39a0..597b82f 100644 (file)
@@ -593,6 +593,8 @@ def mark_isbn_for_sfx(record, options):
             isbnval = clean_isbn(isbnval)
             # And for every library we have enabled
             for lib in options['libraries']:
+                if lib == 'boreal':
+                    return False
                 found = check_for_isbn(options, lib, isbnval)
                 if found:
                     # Add the $9 subfield to mark this as a good one
@@ -898,7 +900,10 @@ def get_subfields(field, data):
     if ebrary and data['ebrary_code'] != 'boreal':
         subs.extend(['u', url])
     else:
-        subs.extend(['u', data['proxy'] + field['u']])
+        if data['ebrary_code'] == 'boreal' and re.search(r'ra.ocls.ca', field['u']):
+            subs.extend(['u', field['u']])
+        else:
+            subs.extend(['u', data['proxy'] + field['u']])
 
     # Check for a $z as the first 856; in Springer records, at least, this
     # indicates a multi-volume set that requires keeping the $z around