Skip to content

Commit

Permalink
add condition to example of creating initial versions
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer committed Nov 12, 2024
1 parent af3539c commit 96537e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@ Re-enable versioning and create initial versions after all imports and fixes are
for index, brain in enumerate(brains):
obj = brain.getObject()
try:
portal_repository.save(obj=obj, comment="Imported Version")
if not portal_repository.getHistoryMetadata(obj=obj):
portal_repository.save(obj=obj, comment="Imported Version")
except FileTooLargeToVersionError:
pass
if not index % 1000:
Expand Down Expand Up @@ -1928,7 +1929,8 @@ After the migration you need to restart the instance to make all changes work.
for index, brain in enumerate(brains):
obj = brain.getObject()
try:
portal_repository.save(obj=obj, comment="Imported Version")
if not portal_repository.getHistoryMetadata(obj=obj):
portal_repository.save(obj=obj, comment="Imported Version")
except FileTooLargeToVersionError:
pass
if not index % 1000:
Expand Down

0 comments on commit 96537e0

Please sign in to comment.