-
-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #411 serializing default_page item property into something like … #983
base: main
Are you sure you want to change the base?
Conversation
…ike `"default_page": {"@id": "http://localhost:8080/Plone/front-page"}`
@sauzher you need to sign the Plone Contributor Agreement in order to merge this pull request. Learn about the Plone Contributor Agreement: http://docs.plone.org/develop/coredev/docs/contributors_agreement_explained.html |
@sauzher thanks for creating this Pull Request and help improve Plone! To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass. Whenever you feel that the pull request is ready to be tested, either start all jenkins jobs pull requests by yourself, or simply add a comment in this pull request stating:
With this simple comment all the jobs will be started automatically. Happy hacking! |
@sauzher you need to sign the Plone Contributor Agreement in order to merge this pull request. Learn about the Plone Contributor Agreement: http://docs.plone.org/develop/coredev/docs/contributors_agreement_explained.html |
@sauzher thanks for creating this Pull Request and help improve Plone! To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass. Whenever you feel that the pull request is ready to be tested, either start all jenkins jobs pull requests by yourself, or simply add a comment in this pull request stating:
With this simple comment all the jobs will be started automatically. Happy hacking! |
I really do not know how to solve this https://travis-ci.org/github/plone/plone.restapi/jobs/720903264#L346. |
@sauzher please run black on your code base:
Improving the CI error message has been on my list for quite a while. Travis is limited though. |
@jenkins-plone-org please run jobs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most useful is that when you include the default page you also serialize it in the response. This would avoid needing to fetch it again. Maybe implement it as an expander?
@tiberiuichim thanks for the pull review.
I don't know the desiderata behind |
@sauzher Indeed, it is the job of the frontend to decide if it wants this information. With an expander, it can do that:
So it would get the "context", but also whatever content it needs to use to properly show the page. What should be included in the |
@tiberiuichim Thanks, I was unaware of this possiblity. Dunno what to say... honestly, at this time, I personally would prefer a two step approach on fetching a container and its default_page. They are still two separate context with theirs own components information (workflows, actions, etc.). Having ID (in the default_page property) and its title, description, type properties available in the Perhaps dealing with containers with thousands items (or more) it may be better having default_page's metadatas directly into the new Fetching the |
Just throwing #944 into discussion. I'm ok either way |
@jenkins-plone-org please run jobs |
@jenkins-plone-org please run jobs |
For the deserializer, we currently have a PATCH service for a customer project: class SetDefaultPage(Service):
"""Set the default page for the given content object."""
def reply(self):
data = json_body(self.request)
default_page = data.get("default_page", None)
try:
self.context.setDefaultPage(default_page)
except Unauthorized as exc:
self.request.response.setStatus(403)
return dict(error=dict(type="Forbidden", message=str(exc)))
except BadRequest as exc:
self.request.response.setStatus(400)
return dict(error=dict(type="Bad Request", message=str(exc)))
return self.reply_no_content() |
…
"default_page": {"@id": "http://localhost:8080/Plone/front-page"}