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

Add VHM support to @search #508

Merged
merged 1 commit into from Apr 17, 2018
Merged

Add VHM support to @search #508

merged 1 commit into from Apr 17, 2018

Conversation

csenger
Copy link
Contributor

@csenger csenger commented Mar 7, 2018

Solves issue #186

If called via VHM it will include the VirtualHostRoot path in a path search

@coveralls
Copy link

coveralls commented Mar 7, 2018

Coverage Status

Coverage increased (+0.007%) to 96.529% when pulling c02e3dc on issue-186-search-in-vhm into ff4101e on master.

@tisto
Copy link
Sponsor Member

tisto commented Mar 13, 2018

@sneridagh what's the status here?

Copy link
Member

@lukasgraf lukasgraf left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this, that's something I missed in the initial implementation of @search.

Looks good to me 👍 , just one point regarding possibly maintaining backwards compatibility.

vhm_physical_path = self.request.get('VirtualRootPhysicalPath')
if vhm_physical_path:
path = query['path'].get('query')
if path:
Copy link
Member

Choose a reason for hiding this comment

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

Could we change this to something along the lines of if vhm_physical_path and not path.startswith('/'.join(vhm_physical_path)):?

(Only prepend VirtualRootPhysicalPath if client didn't already supply it).

That would keep backwards compatibility with clients that for some reason already did know the Plone site ID (maybe communicated out-of-band), and still assist clients that don't know it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that. This will fail if you have a folder in the site root with the same id as the site. As it is not a dev who decides that it i did not implement it.

I don't think we should make this behavior optional and the old behavior the default. So if backwards compatibility is a blocker it should go into a 2.0alpha release.

Copy link
Member

Choose a reason for hiding this comment

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

@csenger yeah, I thought about that case too. I was thinking that with Plone and Acquisition you're not going to have a good time naming an object the same as the Plone site ID - but you're right, it's possible, though probably rare.

I don't think we should make this behavior optional and the old behavior the default. So if backwards compatibility is a blocker it should go into a 2.0alpha release.

Yeah, I think you're right - offering two code paths here is probably more confusing than it helps 👍

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

@lukasgraf @csenger 2.0.0 is around the corner anyways. I don't mind just including that one in a new major release as a breaking change. Though, if this is a breaking change, we have to document it in our upgrade guide: http://plonerestapi.readthedocs.io/en/latest/upgrade-guide.html

@tisto tisto added this to the 2.0.0 milestone Mar 16, 2018
@tisto tisto merged commit bfd78ce into master Apr 17, 2018
@tisto tisto deleted the issue-186-search-in-vhm branch April 17, 2018 19:45
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