[open-ils-commits] r19647 - branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 8 17:01:16 EST 2011
Author: dbs
Date: 2011-03-08 17:01:10 -0500 (Tue, 08 Mar 2011)
New Revision: 19647
Modified:
branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/ResolverResolver.pm
Log:
Be more defensive when parsing SFX target results
SFX in the wild has been observed returning targets for getFullTxt
requests that have no target URLs, which makes it rather impossible
to provide a link to the full text resource. Skip such targets (and
for good measure, skip them if they don't have a name either).
Also, change from the SID "conifer" to the more generic and accurate
"evergreen".
Modified: branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/ResolverResolver.pm
===================================================================
--- branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/ResolverResolver.pm 2011-03-08 21:58:00 UTC (rev 19646)
+++ branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/ResolverResolver.pm 2011-03-08 22:01:10 UTC (rev 19647)
@@ -123,7 +123,7 @@
# Big ugly SFX OpenURL request
my $url_args = '?url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&'
- . 'ctx_enc=UTF-8&ctx_ver=Z39.88-2004&rfr_id=info:sid/conifer&'
+ . 'ctx_enc=UTF-8&ctx_ver=Z39.88-2004&rfr_id=info:sid/evergreen&'
. 'sfx.ignore_date_threshold=1&'
. 'sfx.response_type=multi_obj_detailed_xml&__service_type=getFullTxt';
@@ -158,19 +158,27 @@
my @sfx_result;
foreach my $target (@targets) {
+ my %full_txt;
+
+ # Ensure we have a name and especially URL to return
+ $full_txt{'name'} = $target->findvalue('./target_public_name') || next;
+ $full_txt{'url'} = $target->findvalue('.//target_url') || next;
+ $full_txt{'coverage'} = $target->findvalue('.//coverage_statement') || '';
+ $full_txt{'embargo'} = $target->findvalue('.//embargo_statement') || '';
+
if ($format eq 'raw') {
push @sfx_result, {
- public_name => $target->findvalue('./target_public_name'),
- target_url => $target->findvalue('.//target_url'),
- target_coverage => $target->findvalue('.//coverage_statement'),
- target_embargo => $target->findvalue('.//embargo_statement'),
+ public_name => $full_txt{'name'},
+ target_url => $full_txt{'url'},
+ target_coverage => $full_txt{'coverage'},
+ target_embargo => $full_txt{'embargo'},
};
} else {
my $rhr = Fieldmapper::resolver::holdings_record->new;
- $rhr->public_name($target->findvalue('./target_public_name'));
- $rhr->target_url($target->findvalue('.//target_url'));
- $rhr->target_coverage($target->findvalue('.//coverage_statement'));
- $rhr->target_embargo($target->findvalue('.//embargo_statement'));
+ $rhr->public_name($full_txt{'name'});
+ $rhr->target_url($full_txt{'url'});
+ $rhr->target_coverage($full_txt{'coverage'});
+ $rhr->target_embargo($full_txt{'embargo'});
push @sfx_result, $rhr;
}
}
More information about the open-ils-commits
mailing list