-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: develop
Are you sure you want to change the base?
Conversation
@@ -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(): |
There was a problem hiding this comment.
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
block_data.clear() | ||
block_data.update(new_block) | ||
modified(obj) | ||
transaction.commit() |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
block_data.clear() | ||
block_data.update(new_block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need
@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. |
Fix renaming
@@ -100,7 +121,7 @@ def __call__(self): | |||
|
|||
old_id = obj.getId() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
Stop using relatedItems and create new field, fix creating multiple d…
https://taskman.eionet.europa.eu/issues/282960