plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
246 stars 186 forks source link

Calendar portlet navigation problem #2215

Closed claytonc closed 6 years ago

claytonc commented 6 years ago

BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)

What I did:

  1. added a folder in the site, for example "Folder 1";
  2. added a calendar portlet inside the folder created;
  3. view the portlet in the site, hit the button for next month and back month.

Adding a calendar portlet to the root of the site works well.

What I expect to happen:

Calendar portlet showing next or previous month

What actually happened:

KeyError: u'Cannot find object at path folder-1'

What version of Plone/ Addons I am using:

Plone 4.3.14 no addons.

The error occurs from the version of Plone 4.3.12 and using plone.portlets == 2.3.

Debugging I discovered that the error occurs because the path is being passed as string unicode: u'/Plone/folder-1'. [1]

For example [2]: context.restrictedTraverse(u'/Plone/folder-1') ==> *** KeyError: u '/'

[1] https://github.com/plone/plone.portlets/blob/2.3/plone/portlets/utils.py#L66 [2] https://github.com/plone/plone.app.portlets/blob/2.5.6/plone/app/portlets/utils.py#L55

claytonc commented 6 years ago

[1] https://github.com/plone/plone.portlets/blob/2.3/plone/portlets/utils.py#L66

I didn't fix because I don't know why did they use "decode()" at line 66.

claytonc commented 6 years ago

https://github.com/plone/plone.app.portlets/blob/2.5.6/plone/app/portlets/utils.py#L42

path = key.encode() ?

hvelarde commented 6 years ago

maybe because the use encode here? https://github.com/plone/plone.portlets/blob/2.3/plone/portlets/utils.py#L56

idgserpro commented 6 years ago

I didn't fix because I don't know why did they use "decode()" at line 66.

Using "blame" it seems to be Python 3 support https://github.com/plone/plone.portlets/blame/2.3/plone/portlets/utils.py#L66. Maybe @davisagli can give us a hint here.

mauritsvanrees commented 6 years ago

Confirmed. Plone 5.0 is using plone.portlets 2.3.3 and branch 2.2.x. See https://github.com/plone/buildout.coredev/pull/284. We should do the same should happen on 4.3: it is currently using a newer plone.portlets than 5.0, which is of course silly. I will fix that.

Summary: you can fix this in individual projects by pinning plone.portlets = 2.2.3.