Skip to content
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

added uidtool #23

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Products.CMFUid Changelog
4.1 (unreleased)
----------------

- Modified the code of ``handleUidAnnotationEvent`` to check if both 'anno_tool' and 'uidtool' exist before using them. This change ensures that the code won't run unless both tools are available, preventing the 'NoneType' error.

4.0 (2023-02-01)
----------------
Expand Down
4 changes: 2 additions & 2 deletions src/Products/CMFUid/UniqueIdAnnotationTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def handleUidAnnotationEvent(ob, event):
if event.newParent is not None:
anno_tool = queryUtility(IUniqueIdAnnotationManagement)
uidtool = getToolByName(ob, 'portal_uidhandler', None)
if anno_tool is not None:
if anno_tool is not None and uidtool is not None:
wesleybl marked this conversation as resolved.
Show resolved Hide resolved
remove_on_add = anno_tool.getProperty('remove_on_add', False)
remove_on_clone = anno_tool.getProperty('remove_on_clone',
False)
Expand All @@ -95,7 +95,7 @@ def handleUidAnnotationEvent(ob, event):
anno_tool = queryUtility(IUniqueIdAnnotationManagement)
uidtool = getToolByName(ob, 'portal_uidhandler', None)

if anno_tool is not None:
if anno_tool is not None and uidtool is not None:
remove_on_clone = anno_tool.getProperty('remove_on_clone', False)
assign_on_clone = anno_tool.getProperty('assign_on_clone', False)
if remove_on_clone or assign_on_clone:
Expand Down