diff --git a/catalog/book/models.py b/catalog/book/models.py index d451b9bf..9df59394 100644 --- a/catalog/book/models.py +++ b/catalog/book/models.py @@ -48,7 +48,7 @@ class EditionInSchema(ItemInSchema): pub_month: int | None = None binding: str | None = None price: str | None = None - pages: str | None = None + pages: int | str | None = None series: str | None = None imprint: str | None = None diff --git a/neodb-takahe b/neodb-takahe index 4b434ff4..c1f202a9 160000 --- a/neodb-takahe +++ b/neodb-takahe @@ -1 +1 @@ -Subproject commit 4b434ff4a53d162e4caca0880d9827289ccac0f3 +Subproject commit c1f202a958b0c90a605042d9157f7dc246a5ac9a diff --git a/takahe/ap_handlers.py b/takahe/ap_handlers.py index 212a1a1d..b5aabce7 100644 --- a/takahe/ap_handlers.py +++ b/takahe/ap_handlers.py @@ -32,18 +32,22 @@ _supported_ap_journal_types = { def _parse_item_links(objects): logger.debug(f"Parsing item links from {objects}") + if not objects: + return [] + objs = objects if isinstance(objects, list) else [objects] items = [ - obj["href"] - for obj in objects - if obj["type"] in _supported_ap_catalog_item_types + obj["href"] for obj in objs if obj["type"] in _supported_ap_catalog_item_types ] return items def _parse_piece_objects(objects): logger.debug(f"Parsing pieces from {objects}") + if not objects: + return [] + objs = objects if isinstance(objects, list) else [objects] pieces = [] - for obj in objects: + for obj in objs: if obj["type"] in _supported_ap_journal_types.keys(): pieces.append(obj) else: @@ -96,11 +100,7 @@ def _update_or_create_post(pk, obj): cls.update_by_ap_object(owner, item, p, pk, _get_visibility(post.visibility)) -def post_created(pk, obj): - _update_or_create_post(pk, obj) - - -def post_updated(pk, obj): +def post_fetched(pk, obj): _update_or_create_post(pk, obj)