Skip to content
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

Refs #534 - Control Panels: dexterity-types #907

Merged

Conversation

avoinea
Copy link
Sponsor Member

@avoinea avoinea commented Apr 10, 2020

See #534

@avoinea avoinea requested a review from tisto April 10, 2020 13:01
@mister-roboto
Copy link

@avoinea 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:

@jenkins-plone-org please run jobs

With this simple comment all the jobs will be started automatically.

Happy hacking!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 95.594% when pulling c83be75 on eea:eea-dexterity-control-panel into 864d566 on plone:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 95.594% when pulling c83be75 on eea:eea-dexterity-control-panel into 864d566 on plone:master.

@tisto
Copy link
Sponsor Member

tisto commented Apr 12, 2020

@avoinea thank you! I will try to find time in the next days to review this PR.

Copy link
Sponsor Member

@tisto tisto left a comment

Choose a reason for hiding this comment

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

Overall this PR looks good to me. Great work @avoinea!!! Most of my comments are nitpicking and recommendations more than requests for changes. Though, we definitely need a few unit/integration tests for this new endpoint to keep our high standards. :)

Sidenote: I just realized that coveralls is broken (I will look into this), otherwise it would complain about the drop in test coverage this PR would introduce.

docs/source/controlpanels.rst Outdated Show resolved Hide resolved
docs/source/controlpanels.rst Outdated Show resolved Hide resolved
docs/source/controlpanels.rst Outdated Show resolved Hide resolved
Dexterity Types
^^^^^^^^^^^^^^^

``@controlpanels/dexterity-types`` is a custom folderish control panel endpoint, that will allow you to add, remove and configure available :ref:`types`
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Just a note to self. The old control panel is also named "dexterity-types".

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

;) I tried to follow the same pattern as for control panels based on plone.app.registry

docs/source/controlpanels.rst Outdated Show resolved Hide resolved
src/plone/restapi/controlpanels/types.py Outdated Show resolved Hide resolved
if "IDisableCSRFProtection" in dir(plone.protect.interfaces):
alsoProvides(self.request, plone.protect.interfaces.IDisableCSRFProtection)

if IPloneRestapiLayer.providedBy(self.request):
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Just out of curiosity. Why do we do this here?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Well I don't think CSRF protection make sense with RestAPI calls. Anyway, without it calls will fail with invalid CSRF.

I inspired also from plone.restapi https://github.com/plone/plone.restapi/search?q=IDisableCSRFProtection&unscoped_q=IDisableCSRFProtection

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

CSRF is clear. I commented on this line "if IPloneRestapiLayer.providedBy(self.request):"

@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I am wondering if we should prepare the file structure for another non-plone.app.registry-based controlpanel. Then we need another directory where we put delete.py into.

@@ -1345,7 +1345,7 @@ def test_querystringsearch_post(self):

class TestDocumentationMessageTranslations(TestDocumentationBase):

layer = layer = PLONE_RESTAPI_DX_FUNCTIONAL_TESTING
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Good catch. How the hell did that end up here? :)

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

😄

)
save_request_and_response_for_docs("controlpanels_post_dexterity_item", response)

# GET
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Those should go into individual tests IMHO to indicate what's wrong to the developers in case we have a test failure.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Oh. Those are just documentation generation tests. Didn't realize that at first. I'd still prefer individual test functions here I guess.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

@tisto
Copy link
Sponsor Member

tisto commented Apr 12, 2020

FYI: coverage does not work because the branch lives on a different repo. @avoinea would it be possible for future PRs (both Volto and REST API) to create branches on the original repo? It seems forking introduces some problems with our current CI infrastructure.

@avoinea avoinea changed the base branch from master to eea-eea-dexterity-control-panel April 13, 2020 14:49
@avoinea
Copy link
Sponsor Member Author

avoinea commented Apr 13, 2020

@tisto I changed the base of this PR, does I think you can merge it and then we can continue on the PR you've created #909

@tisto
Copy link
Sponsor Member

tisto commented Apr 14, 2020

@avoinea sounds good. Could you close this PR then pls?

@avoinea avoinea merged commit b6750f3 into plone:eea-eea-dexterity-control-panel Apr 14, 2020
@avoinea avoinea deleted the eea-dexterity-control-panel branch April 14, 2020 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants