-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
folder_contents broken when using Root Navigation behaviour on folder clone #159
Comments
I can also reproduce this, but without virtual hosting. 5.0.5 1: Create a 'subsite' (or a top level folder) Let's call it 'root' (so /root is now the real site top level) Navigation works as expected! folders under /root are now my navigation. However:
set navigation back to '/' and folder listings come back, but navigation is broken. (you only see 'root') This might be reproducible without a special 'subsite' content type, but that's unknown. I just find it interesting to see another person using subsites other than myself. I am accessing my zope instance directly: I can add read access to our buildout with a very small trust relationship - but can't make it public b/c people wearing suits and ties said I can't. |
One can re-create this issue without special content types. create Plonesite 'plone' as usual ( localhost:8080/plone/ ) I see 'folder' appear in my navigation Create another folder called 'subfolder' under that ( localhost:8080/plone/folder/subfolder ) Now, go to folder view of the subsite: localhost:8080/plone/folder/folder_contents ) I see 'subfolder' listed in the folder_contents Go to site-setup->Navigation Navigation changes as expected. Navigation now has 'subfolder' and "home" links to localhost:8080/plone/folder/ go to localhost:8080/plone/folder/folder_contents Empty. This is the bug. It should list 'subfolder' Set navigation root back to '/' and folder contents goes back to correct behavior. Adding objects is also broken, but I'm going to focus on 'folder_contents' view and see what I shake loose. |
The workaround I'm using is to avoid this setting altogether (leave configuration registry setting 'plone.root' alone ) and tag the navigation root object with the 'INavigationRoot' interface marker. The behavior seems to work well, the navigation displays correctly, listing contents does not break, and adding content goes where you expect it. |
Unfortunatelly, that workaround doesn't apply to my case. I have never touched the "root path" setting in site setup -> navigation. I am seeing the problem by simply adding the "Navigation root" behaviour ('INavigationRoot' interface marker) to the subfolder/subsite. Everything shows up as expected when going to http://localhost:8080/plone/subsite/folder_contents but not when visiting http://subsite_url/folder_contents , having subsite_url defined as a virtualhost. Were you able to reproduce this case? |
I cannot reproduce using INavigationRoot interface maker. I am also not using VirtualHostMonster, and don't plan on using it, so I might not be able to reproduce. I have not setup virtual hosting yet, so my problem is exactly the opposite of yours. It's possible you could use the configuration registry setting that I found troublesome. |
I now believe we are describing separate issues, so I'll open my own. |
I can reproduce the issue with both Plone 6 and Plone 5. It's been like that forever, since I use VirtualHostMonster and only subportions of the site are visible on each domain. If I access my site without the VHM:
Then the folder listing works fine because the @@qsOptions URL that the browser loads is If, however, I access the site using the VHM:
Then the folder listing does not work at all, and that's because the @@qsOptions URL that the browser wants to load then becomes I believe the bug may be in
|
I can confirm — via some elite This is because the method above |
I don't seem to be able to edit my Github comments right now (it's slow), so I will clarify that only paths handled by |
I've instrumented
Here is the output:
That is wrong. The |
Haha! I think I have a fix. Holy balls, a fix for an issue that has been open since 6 years! Wait a few minutes for PR please... |
HAHA FIXED plone/plone.base#18 |
So, let me get this straight. The "canonical way" (bigger than 'best practice') to get a site root is to traverse upwards until you find an object that implements ISite. You are proposing that we add a utility to do just this. And use that utility. I tend to agree with this, I've seen it documented, somewhere, and I was taught this way back in Plone 2 also. I have custom code that uses this method also. Questions: @Rudd-O How did you arrive at ISite as the interface marker? I think there are more, like ISiteRoot and INavigationRoute that are also good candidates. Docs say use ISiteRoot https://docs.plone.org/develop/plone/serving/traversing.html#traversing-back-to-the-site-root Does this play well with zope.component.hooks.getSite? Should it? Does it even matter? I concur, you are on the right track here. Just throwing out some ideas. |
If the comment is addressed to me, all I have to say is that I am preserving the behavior of the code, just including the topmost accessible object (rather than the bottommost only) in the list of objects to be considered as "site roots" to return to the caller. |
I'm going to move this discussion to the PR where it belongs. Sorry. I was doing review questions on the issue, not the PR. |
I am having a problem where folder_contents breaks when in a folder inside a subsite. The contents of the folder don't show up, and a 404 error trying to load @@qsOptions is logged in the browser console. It sounds a bit like issue #103, but not exactly. I am also using virtual hosting and nginx.
These are the steps to reproduce:
Create new plone site (mysite)
Create a new "Subsite" dexterity content type as a clone of "Folder". Add the "Navigation root" behaviour to it.
Add a new "Subsite" in the root of mysite (mysubsite) and publish it.
Create a page inside mysubsite, publish it and make it the default view for mysubsite
Create a folder called "Folder 1" inside mysubsite (folder1) and folders, pages or any other content type objects inside folder1. Publish them all.
Create virtual host configuration on separate webserver (in my case, a nginx reverse proxy) for mysubsite:
0-proxy-headers contains this:
Info about my setup:
Plone 5.1.2.1 (5112) (Although it breaks in 5.0.6 as well)
CMF 2.2.12
Zope 2.13.27
Python 2.7.14 (default, Aug 17 2018, 09:45:23) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]
PIL 5.1.0 (Pillow)
The text was updated successfully, but these errors were encountered: