Skip to content

IMS Indicator on new version should update links to figures 282960 #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 49 commits into
base: develop
Choose a base branch
from

Conversation

dobri1408
Copy link
Contributor

@@ -131,6 +150,27 @@ def __call__(self):
pr = getToolByName(obj, 'portal_repository')
pr.save(obj=obj, comment=change_note)

# CHANGE URL OF FIGURES TO THE NEW DRAFT VERSION
obj_blocks = obj.blocks
for block_data in obj_blocks.values():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dobri1408 Please use visit blocks helper methods from plone.restapi

@dobri1408 dobri1408 requested a review from avoinea February 26, 2025 12:02
@dobri1408 dobri1408 requested a review from avoinea May 14, 2025 10:49
block_data.clear()
block_data.update(new_block)
modified(obj)
transaction.commit()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the transaction.commit() is redundant here 🤔

for block_data in visit_blocks(obj, obj.blocks):
if (block_data.get("@type") == "embed_content" and
"url" in block_data):
new_block = copy.deepcopy(block_data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary. In place modifying new_block["url"] = url should be enough. You can test this by restarting Plone instance n order to make sure there is no cache keeping the new value.

Comment on lines 169 to 170
block_data.clear()
block_data.update(new_block)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need

@dobri1408
Copy link
Contributor Author

@avoinea indeed it's working, but I have realised that this will be overwritten by @Narcis2005 in context of https://taskman.eionet.europa.eu/issues/263578, tomorrow, as we discussed last week. It's very good that you made a review before, so Narcis can have a clean code base. We consider that the two tasks are related, because the new ticket will affect this feature, so we will continue in the same pr.

@@ -100,7 +121,7 @@ def __call__(self):

old_id = obj.getId()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify here if there is in related items an uid even if this is return .1, maybe that .1 is renamed

try:
old_version = parent[old_id]
if old_id not in parent:
old_version = obj.relatedItems[0].to_object
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify if relatedItems are here!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify if relatedItems is also an Indicator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants