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

Fix select_default_page in VHM environments #292

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/292.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix `select_default_page` in VHM hosted sites
[petschki]
2 changes: 1 addition & 1 deletion plone/app/content/browser/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_selectable_items(self):

results = []
for brain in portal_catalog(
path={"query": context.absolute_url_path(), "depth": 1},
path={"query": "/".join(context.getPhysicalPath()), "depth": 1},
sort_on="getObjPositionInParent",
):
portal_type = brain.portal_type
Expand Down
27 changes: 27 additions & 0 deletions plone/app/content/tests/test_selectdefaultpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SelectDefaultPageDXTestCase(unittest.TestCase):
layer = PLONE_APP_CONTENT_DX_FUNCTIONAL_TESTING

def setUp(self):
self.app = self.layer["app"]
self.portal = self.layer["portal"]
self.portal.acl_users.userFolderAddUser(
"editor", TEST_USER_PASSWORD, ["Editor"], []
Expand Down Expand Up @@ -93,6 +94,32 @@ def test_select_default_page_view(self):
self.assertTrue("Select default page" in self.browser.contents)
self.assertTrue('id="testdoc"' in self.browser.contents)

def test_select_default_page_vhm_hosted(self):
# Install a Virtual Host Monster
if "virtual_hosting" not in self.app.objectIds():
# If ZopeLite was imported, we have no default virtual
# host monster
from Products.SiteAccess.VirtualHostMonster import (
manage_addVirtualHostMonster,
)

manage_addVirtualHostMonster(self.app, "virtual_hosting")
transaction.commit()

folder = self.portal.testfolder
folder_vhm_url = (
"{}/VirtualHostBase/http/plone.org/{}/VirtualHostRoot/{}".format(
self.app.absolute_url(),
self.portal.id,
folder.id,
)
)

self.browser.open(f"{folder_vhm_url}/@@select_default_page")

self.assertTrue("Select default page" in self.browser.contents)
self.assertTrue('id="testdoc"' in self.browser.contents)

def test_select_default_page_view_with_folderish_type(self):
"""Check if folderish types are available."""
folder = self.portal.testfolder
Expand Down