Skip to content

Commit

Permalink
fix code analyses warnings/errors
Browse files Browse the repository at this point in the history
  • Loading branch information
frisi committed Feb 12, 2019
1 parent 5718599 commit dbc9e9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/plone/api/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,14 +675,14 @@ def find(context=None, depth=None, **kwargs):
operator = 'or'
ifaces = object_provides
if isinstance(object_provides, dict):
operator = object_provides.get('operator', operator)
ifaces = object_provides.get('query', [])
operator = object_provides.get('operator', operator)
ifaces = object_provides.get('query', [])
elif not isinstance(object_provides, (list, tuple)):
ifaces = [object_provides]

query['object_provides'] = {
'query': [getattr(x, '__identifier__', x) for x in ifaces],
'operator': operator
'operator': operator,
}

# Make sure we don't dump the whole catalog.
Expand Down
8 changes: 4 additions & 4 deletions src/plone/api/tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,17 +1034,17 @@ def test_find_interface_dict(self):
'query': [
IContentish.__identifier__,
INavigationRoot.__identifier__],
'operator': 'and'
}
'operator': 'and',
},
)
self.assertEqual(len(brains), 1)

# plone.api query using interfaces
brains = api.content.find(
object_provides={
'query': [IContentish, INavigationRoot],
'operator': 'and'
}
'operator': 'and',
},
)
self.assertEqual(len(brains), 1)

Expand Down

1 comment on commit dbc9e9e

@jenkins-plone-org
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frisi Jenkins CI reporting about code analysis
See the full report here: https://jenkins.plone.org/job/package-plone.api/165/violations

src/plone/api/content.py:589:1: C901 'find' is too complex (11)
src/plone/api/tests/test_content.py:1028:9: D001 found directlyProvides( replace it with zope.interface.provider

Follow these instructions to reproduce it locally.

Please sign in to comment.