Skip to content

Commit

Permalink
content.uuidToObject will now return None instead an empty list i…
Browse files Browse the repository at this point in the history
…f uuid not found.
  • Loading branch information
gbastien committed May 16, 2022
1 parent e5e895d commit d1386d1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Expand Up @@ -4,8 +4,8 @@ Changelog
0.57 (unreleased)
-----------------

- Nothing changed yet.

- `content.uuidToObject` will now return `None` instead an empty list if uuid not found.
[gbastien]

0.56 (2022-05-13)
-----------------
Expand Down
2 changes: 2 additions & 0 deletions src/imio/helpers/content.py
Expand Up @@ -474,6 +474,8 @@ def uuidToObject(uuid,
unrestricted=unrestricted)
if res:
res = res[0]
else:
res = None
return res


Expand Down
1 change: 1 addition & 0 deletions src/imio/helpers/tests/test_content.py
Expand Up @@ -306,6 +306,7 @@ def test_uuidToObject(self):
folder_uid = self.portal.folder.UID()
single_obj = uuidToObject(folder_uid)
self.assertEqual(single_obj.UID(), folder_uid)
self.assertIsNone(uuidToObject('unknown_uid'))

def test_disable_link_integrity_checks(self):
self.assertTrue(self.portal.portal_properties.site_properties.enable_link_integrity_checks)
Expand Down

0 comments on commit d1386d1

Please sign in to comment.