Skip to content

Commit

Permalink
Merge pull request #1332 from girder/turn-down-logging
Browse files Browse the repository at this point in the history
Turn down logging about annotation ACLs.
  • Loading branch information
manthey authored Oct 5, 2023
2 parents 6bd10d2 + 70bc0b6 commit 23ea5c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Changes
- Prohibit bioformats and vips from reading mrxs directly ([#1328](../../pull/1328))
- Handle Python 3.12 deprecating utcnow ([#1331](../../pull/1331))
- Turn down logging about annotation ACLs ([#1332](../../pull/1332))

## 1.25.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,21 +759,21 @@ def _migrateACL(self, annotation):

item = Item().load(annotation['itemId'], force=True)
if item is None:
logger.warning(
logger.debug(
'Could not generate annotation ACL due to missing item %s', annotation['_id'])
return annotation

folder = Folder().load(item['folderId'], force=True)
if folder is None:
logger.warning(
logger.debug(
'Could not generate annotation ACL due to missing folder %s', annotation['_id'])
return annotation

user = None
if annotation.get('creatorId'):
user = User().load(annotation['creatorId'], force=True)
if user is None:
logger.warning(
logger.debug(
'Could not generate annotation ACL due to missing user %s', annotation['_id'])
return annotation

Expand Down
8 changes: 4 additions & 4 deletions girder_annotation/test_annotation/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def testMigrateAnnotationAccessControlNoItemError(self, user, admin):
Annotation().save(annot)
with mock.patch('girder_large_image_annotation.models.annotation.logger') as logger:
Annotation()._migrateDatabase()
logger.warning.assert_called_once()
logger.debug.assert_called_once()
annot = Annotation().load(annot['_id'], force=True)
assert 'access' not in annot

Expand All @@ -711,7 +711,7 @@ def testMigrateAnnotationAccessControlNoFolderError(self, user, admin):
Item().save(item)
with mock.patch('girder_large_image_annotation.models.annotation.logger') as logger:
Annotation()._migrateDatabase()
logger.warning.assert_called_once()
logger.debug.assert_called_once()
annot = Annotation().load(annot['_id'], force=True)
assert 'access' not in annot

Expand All @@ -728,7 +728,7 @@ def testMigrateAnnotationAccessControlNoUserError(self, user, admin):
Annotation().save(annot)
with mock.patch('girder_large_image_annotation.models.annotation.logger') as logger:
Annotation()._migrateDatabase()
logger.warning.assert_called_once()
logger.debug.assert_called_once()
annot = Annotation().load(annot['_id'], force=True)
assert 'access' not in annot

Expand All @@ -745,6 +745,6 @@ def testMigrateAnnotationAccessControlNullUserError(self, user, admin):
Annotation().save(annot)
with mock.patch('girder_large_image_annotation.models.annotation.logger') as logger:
Annotation()._migrateDatabase()
logger.warning.assert_called_once()
logger.debug.assert_called_once()
annot = Annotation().load(annot['_id'], force=True)
assert 'access' not in annot

0 comments on commit 23ea5c3

Please sign in to comment.