collective / Products.PloneKeywordManager

Change, merge and delete keywords (AKA tags or subjects) in Plone.
https://pypi.org/project/Products.PloneKeywordManager/
4 stars 8 forks source link

Renaming Keywords only renames one keyword #70

Closed flipmcf closed 2 years ago

flipmcf commented 2 years ago

If you have this in your keyword manager:

Keyword A (50)
Keyword B (5)

And assuming the objects with keyword A and keyword B sets were distinct; had no intersection; no objects in common; Total of 55 objects...

And you try to 'replace / rename' "Keyword B" to "Keyword A" (merging keywords)

By:

  1. select Keyword B (5)
  2. enter "Keyword A" in "Rename" field
  3. click "Rename"

You should get something similar to:

msg: Changed Keyword B to Keyword A for 5 object(s).

Keyword A (55)

Instead, you get:

msg: Changed Keyword B to Keyword A for 5 object(s).

Keyword A (51)
Keyword B (4)

It only actually edits one object.

flipmcf commented 2 years ago

Answer: Whitespace matters.

https://github.com/collective/Products.PloneKeywordManager/blob/73c75916d4fe8445a6159c344e002768da833504/src/Products/PloneKeywordManager/tool.py#L97

"Update Object" is outside of the loop.