def load_books(sender, instance, created, **kwargs): try: harvesting.load_books(instance) except URLError: log.debug("Unable to contact the repository") except: log.exception("Error while loading books in the collection")
def load_books(self, request, queryset): for collection in queryset: results = harvesting.load_books(collection) self.message_user(request, '%d books loaded and %d books skipped ' 'for %s' % (results[0], results[1], collection.name,))