Skip to content

Commit

Permalink
Accepting various suggestions, thanks every 01.
Browse files Browse the repository at this point in the history
  • Loading branch information
gogobd committed Nov 8, 2023
1 parent 60bd67d commit 15432c5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ documents = api.content.find(
%
% self.assertGreater(len(documents), 0)

Find all Documents, and use unrestrictedSearchResults:
Find all `Document` content types, and use unrestricted search results:

```python
from plone import api
documents = api.content.find(
context=api.portal.get(),
portal_type='Document',
portal_type="Document",
unrestricted=True,
)
```
Expand Down
2 changes: 1 addition & 1 deletion news/312.implementation
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Implemented unrestricted find.
Implemented unrestricted find of content types. @gogobd
3 changes: 2 additions & 1 deletion src/plone/api/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,13 @@ def _parse_object_provides_query(query):
return result


def find(context=None, depth=None, **kwargs):
def find(context=None, depth=None, untestricted=False, **kwargs):
"""Find content in the portal.
:param context: Context for the search
:type obj: Content object
:param depth: How far in the content tree we want to search from context
:param unrestricted: Boolean, use unrestrictedSearchResults if True
:type obj: Content object
:returns: Catalog brains
:rtype: List
Expand Down
4 changes: 2 additions & 2 deletions src/plone/api/tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,8 @@ def test_find(self):
documents = api.content.find(portal_type="Document")
self.assertEqual(len(documents), 2)

def test_find(self):
"""Test the finding of content in various ways."""
def test_untrestricted_find(self):
"""Test the finding of content in with unrestricted search."""

# Find documents
documents = api.content.find(portal_type="Document", unrestricted=True)
Expand Down

0 comments on commit 15432c5

Please sign in to comment.