Add an expects_keyhash method to
OpenILS::WWW::AddedContent::Syndetic and look for it from
OpenILS::WWW::AddedContent. This allows us to pass a keyhash
(containing isbn/upc/whatever) to this handler while still passing a
simple scalar containing an ISBN to other AddedContent handlers.
Signed-off-by: Jeff Godin <jgodin@tadl.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
return Apache2::Const::NOT_FOUND unless @{$keyhash->{isbn}} || @{$keyhash->{upc}};
try {
- $data = $handler->$method($keyhash);
+ if ($handler->can('expects_keyhash') && $handler->expects_keyhash() eq 1) {
+ # Handler expects a keyhash
+ $data = $handler->$method($keyhash);
+ } else {
+ # Pass single ISBN as a scalar to the handler
+ $data = $handler->$method($keyhash->{isbn}[0]);
+ }
} catch Error with {
$err = shift;
decr_error_countdown();
return $self->{userid};
}
+sub expects_keyhash {
+ # we expect a keyhash as opposed to a simple scalar containing an ISBN
+ return 1;
+}
# --------------------------------------------------------------------------
sub jacket_small {