Skip to content

Commit

Permalink
Merge pull request #292 from plone/vhm_select_default_page
Browse files Browse the repository at this point in the history
Fix `select_default_page` in VHM environments
  • Loading branch information
mauritsvanrees authored Aug 21, 2024
2 parents 02d770a + a931ec9 commit e5191a4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
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

0 comments on commit e5191a4

Please sign in to comment.