Skip to content

Commit a0a13e1

Browse files
committed
page pictures import: Do not import, if already set. Support two different kind of blob paths.
1 parent c430059 commit a0a13e1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/recensio/plone/migration/import_pagePictures.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,21 @@ def handleApply(self, action):
5353

5454
for brain_idx, brain in enumerate(brains):
5555
obj = brain.getObject()
56+
if getattr(obj, "pagePictures", False):
57+
logger.info("Page pictures already set for %r", obj)
58+
continue
5659
pagePictures = []
5760
logger.info(
5861
"%4d/%4d: Importing pagePictures for %r", brain_idx + 1, total, obj
5962
)
6063
for blob_idx, blob_path in enumerate(data[brain.UID]):
6164
if COLLECTIVE_EXPORTIMPORT_BLOB_HOME:
65+
partition_tag = (
66+
"blobstorage/" if "blobstorage/" in blob_path else "blobs/"
67+
)
6268
blob_path = (
6369
COLLECTIVE_EXPORTIMPORT_BLOB_HOME
64-
/ blob_path.partition("blobs/")[-1]
70+
/ blob_path.partition(partition_tag)[-1]
6571
)
6672
with blob_path.open("rb") as f:
6773
pagePictures.append(

0 commit comments

Comments
 (0)