Skip to content

Commit

Permalink
OcrdMets.get_physical_pages: cover return_divs w/o for_fileIds for_pa…
Browse files Browse the repository at this point in the history
…geIds
  • Loading branch information
bertsky committed Sep 27, 2024
1 parent fa0fada commit 9641d4a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ocrd_models/ocrd_mets.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,16 @@ def get_physical_pages(self, for_fileIds : Optional[List[str]] = None, for_pageI
If return_divs is set, returns div memory objects instead of strings of ids
"""
if for_fileIds is None and for_pageIds is None:
if return_divs:
if self._cache_flag:
return list(self._page_cache[METS_PAGE_DIV_ATTRIBUTE.ID].values())

return [x for x in self._tree.getroot().xpath(
'mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]/mets:div[@TYPE="page"]',
namespaces=NS)]

return self.physical_pages

# log = getLogger('ocrd.models.ocrd_mets.get_physical_pages')
if for_pageIds is not None:
ret = []
Expand Down

0 comments on commit 9641d4a

Please sign in to comment.