plone / plone.app.mosaic

Plone Mosaic main repository
https://pypi.python.org/pypi/plone.app.mosaic
GNU General Public License v2.0
35 stars 26 forks source link

Installed state not represented, if installed as dependency via metadata.xml #124

Closed agitator closed 9 years ago

agitator commented 9 years ago

If Mosaic is installed through metadata.xml from another package in Plone 5, Mosaic is not within the installed addons but active.

Tried from a mr.bob generated package. Can someone reproduce?

agitator commented 9 years ago

followup ... i get this error on a new instance, if i try to add a page

2015-08-14 15:39:54 ERROR plone.subrequest Error handling subrequest to /myproject/++contentlayout++ myproject/document.html Traceback (most recent call last): File "/Users/peter/workspace/myproject/src/plone.subrequest/plone/subrequest/init.py", line 133, in subrequest traversed = request.traverse(path) File "/Users/peter/workspace/myproject/eggs/Zope2-2.13.22-py2.7.egg/ZPublisher/BaseRequest.py", line 502, in traverse subobject = self.traverseName(object, entry_name) File "/Users/peter/workspace/myproject/eggs/Zope2-2.13.22-py2.7.egg/ZPublisher/BaseRequest.py", line 338, in traverseName ob2 = ob.publishTraverse(self, name) File "/Users/peter/workspace/myproject/eggs/plone.resource-1.0.4-py2.7.egg/plone/resource/directory.py", line 64, in publishTraverse raise NotFound NotFound 2015-08-14 15:39:54 WARNING plone.app.mosaic Missing layout /myproject/++contentlayout++myproject/document.html

datakurre commented 9 years ago

At irc you said that the registration was

Yet, in the error message it's "myproject", not "myproj".

agitator kirjoitti pe elokuuta 14 17:15:50 2015 GMT+0300:

followup ... i get this error on a new instance, if i try to add a page

2015-08-14 15:39:54 ERROR plone.subrequest Error handling subrequest to /myproject/++contentlayout++ myproject/document.html Traceback (most recent call last): File "/Users/peter/workspace/myproject/src/plone.subrequest/plone/subrequest/init.py", line 133, in subrequest traversed = request.traverse(path) File "/Users/peter/workspace/myproject/eggs/Zope2-2.13.22-py2.7.egg/ZPublisher/BaseRequest.py", line 502, in traverse subobject = self.traverseName(object, entry_name) File "/Users/peter/workspace/myproject/eggs/Zope2-2.13.22-py2.7.egg/ZPublisher/BaseRequest.py", line 338, in traverseName ob2 = ob.publishTraverse(self, name) File "/Users/peter/workspace/myproject/eggs/plone.resource-1.0.4-py2.7.egg/plone/resource/directory.py", line 64, in publishTraverse raise NotFound NotFound 2015-08-14 15:39:54 WARNING plone.app.mosaic Missing layout /myproject/++contentlayout++myproject/document.html


Reply to this email directly or view it on GitHub: https://github.com/plone/plone.app.mosaic/issues/124#issuecomment-13111872

agitator commented 9 years ago

found out why the resource wasn't found https://github.com/plone/plone.resource/issues/7

original issue/title is still valid

mauritsvanrees commented 9 years ago

I can confirm this. Easier way to reproduce this is to simply go to the Imports tab of portal_setup and apply the Plone Mosaic profile. Result is that the QI knows nothing about this product, which currently in Plone 5 means that Mosaic gets listed in the installable products but not the active products. This is all a bit tricky to get right. But it is a problem in CMFPlone/QuickInstaller/GenericSetup, not specifically a Mosaic problem. I am closing the issue.

datakurre commented 9 years ago

@mauritsvanrees Do you know why this only applies to Mosaic, but not Mosaic's dependencies?

datakurre commented 9 years ago

@mauritsvanrees On any case, thanks for checking this.

mauritsvanrees commented 9 years ago

Good question. Take a fresh Plone 5 site, apply plone.app.drafts in portal_setup. It is marked in portal_quickinstaller as installed now: there is an object in the QI. Not so when you do this with Mosaic. Strange indeed.

Actually, when you install nothing at all and look in the ZMI in portal_quickinstaller, you only see Drafts, not Mosaic. On a hunch, I temporarily removed the dependencies from metadata.xml in Mosaic and restarted Zope, and created a fresh Plone Site, but it is the same there: no Mosaic in ZMI QI. So possibly something wrong in Mosaic anyway, but I currently would not know what...

mauritsvanrees commented 9 years ago

Ah, I see it. In the QI we have this:

    def listInstallableProfiles(self):
        """List candidate products which have a GS profiles.
        """
        portal_setup = getToolByName(self, 'portal_setup')
        profiles = portal_setup.listProfileInfo(ISiteRoot)

And the Mosaic profiles are specifically registered for IPloneSiteRoot, not ISiteRoot. If I remove that restriction from the Mosaic zcml, it works as expected again.

ISiteRoot comes from... wait, what? Errr... QuickInstaller.py says:

try:
    pkg_resources.get_distribution('Products.CMFPlone')
except pkg_resources.DistributionNotFound:
    from Products.CMFPlone.interfaces import IPloneSiteRoot as ISiteRoot
else:
    from Products.CMFCore.interfaces import ISiteRoot

Surely this should be the other way around...

Heh, @agitator, this is something you actually merged. :-) See https://github.com/plone/Products.CMFQuickInstallerTool/pull/11 And I released it in Products.CMFQuickInstallerTool 3.0.10... I will fix this in CMFQuickInstaller.

agitator commented 9 years ago

@mauritsvanrees ... only merged, didn't question the order that was there ;-)

mauritsvanrees commented 9 years ago

@agitator No problem. Easy to miss. Actually, before I looked I expected that I myself was the one who merged it. :-)

datakurre commented 9 years ago

@mauritsvanrees Wow! Thanks for solving this :) I didn't know that could make such a difference. There would be no harm to fix Mosaic to register profile for ISiteRoot. @agitator, could you fix that for Mosaic?

mauritsvanrees commented 9 years ago

Yeah, removing the for line from the Mosaic profile is probably good.

agitator commented 9 years ago

fixed with https://github.com/plone/plone.app.mosaic/pull/126