Skip to content

Commit

Permalink
Merge branch 'main' into controlpanel_validation
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleybl committed Apr 30, 2024
2 parents d3f75e3 + f2e3653 commit c8adc97
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions news/1775.bugfix
@@ -0,0 +1 @@
Users service: Fixed edge case AttributeError if a user is enumerated but doesn't actually exist. @davisagli
1 change: 1 addition & 0 deletions news/1776.documentation
@@ -0,0 +1 @@
Fix event start & end timezone in documentation examples. @davisagli
4 changes: 3 additions & 1 deletion src/plone/restapi/services/users/get.py
Expand Up @@ -115,7 +115,9 @@ def _principal_search_results(
principals = []
for principal_info in search_for_principal(hunter, self.search_term):
principal_id = principal_info[id_key]
principals.append(get_principal_by_id(principal_id))
principal = get_principal_by_id(principal_id)
if principal is not None:
principals.append(principal)

return principals

Expand Down
4 changes: 2 additions & 2 deletions src/plone/restapi/tests/http-examples/event.resp
Expand Up @@ -44,7 +44,7 @@ Content-Type: application/json
],
"description": "This is an event",
"effective": null,
"end": "2013-01-01T12:00:00",
"end": "2013-01-01T12:00:00+00:00",
"event_url": null,
"exclude_from_nav": false,
"expires": null,
Expand Down Expand Up @@ -78,7 +78,7 @@ Content-Type: application/json
"relatedItems": [],
"review_state": "private",
"rights": "",
"start": "2013-01-01T10:00:00",
"start": "2013-01-01T10:00:00+00:00",
"subjects": [],
"sync_uid": null,
"text": null,
Expand Down
5 changes: 3 additions & 2 deletions src/plone/restapi/tests/test_documentation.py
@@ -1,5 +1,6 @@
from base64 import b64encode
from datetime import datetime
from datetime import timezone
from pkg_resources import resource_filename
from plone import api
from plone.app.discussion.interfaces import ICommentAddedEvent
Expand Down Expand Up @@ -319,8 +320,8 @@ def test_documentation_event(self):
self.portal.invokeFactory("Event", id="event")
self.portal.event.title = "Event"
self.portal.event.description = "This is an event"
self.portal.event.start = datetime(2013, 1, 1, 10, 0)
self.portal.event.end = datetime(2013, 1, 1, 12, 0)
self.portal.event.start = datetime(2013, 1, 1, 10, 0, tzinfo=timezone.utc)
self.portal.event.end = datetime(2013, 1, 1, 12, 0, tzinfo=timezone.utc)
transaction.commit()
response = self.api_session.get(self.portal.event.absolute_url())
save_request_and_response_for_docs("event", response)
Expand Down

0 comments on commit c8adc97

Please sign in to comment.