Ticket #10240 (confirmed Bug)

Opened 6 years ago

Last modified 3 years ago

getMemberInfo is not part of the IMembershipTool interface

Reported by: kteague Owned by:
Priority: major Milestone: 4.x
Component: Backend (Python) Version: 4.1
Keywords: Cc:

Description

After installing the add-on 'plone.app.ldap', the Plone Control Panel screen breaks with the error:

  File "/Users/kteague/buildouts/shared/eggs/plone.app.layout-2.0b2-py2.6.egg/plone/app/layout/viewlets/common.py", line 216, in update
    member_info = membership.getMemberInfo(member.getId())
AttributeError: getMemberInfo

The LDAPUserFolder portal_membership tool, which replaces the default portal_membership implementation, does not supply a .getMemberInfo() method. This method is not part of the Products.CMFCore.membership.interfaces.IMembershipTool interface. Therefore, plone.app.layout should gracefully catch this call, instead of blowing up.

In plone.app.layout.viewlets.common, the call in the PersonalBarViewlets class that uses the .getMemberInfo() method will work if AttributeError's are caught:

            try:
                member_info = membership.getMemberInfo(member.getId())
            except AttributeError:
                member_info = None

With this modification, plone.app.ldap can be installed in Plone 4 without modification :)

Change History

comment:1 Changed 6 years ago by kteague

OK, it looks like more modifications are necessary to plone.app.ldap, but at least those are within the product, whereas this fix would require a new release of LDAPUserFolder otherwise.

comment:2 Changed 6 years ago by wichert

  • Status changed from new to closed
  • Resolution set to wontfix

Please never never install Products.LDAPUserFolder using the quick installer, since this will kill your Plone site. plone.app.ldap works just fine with LDAPUserFolder only being importable.

comment:3 Changed 6 years ago by limi

  • Status changed from closed to reopened
  • Resolution wontfix deleted

We should make sure to blacklist it in some way, then. "Plone site blows up if you install this" isn't what we want. People will install stuff that looks relevant in the add/remove products control panel.

comment:4 Changed 6 years ago by wichert

  • Status changed from reopened to closed
  • Resolution set to invalid

I fail to see how Plone core is responsible for that.

comment:5 Changed 6 years ago by limi

  • Status changed from closed to reopened
  • Resolution invalid deleted

It's a problem people will run into, and something we need to fix.

Stop closing the bug, it's not assigned to you, and you can feel free to ignore it.

comment:6 Changed 6 years ago by wichert

I already added a fix in PloneLDAP months ago.

comment:7 Changed 6 years ago by kteague

Well, I only blew-up a test instance - it is for Plone 4a4, I haven't put any Plone 4 into production yet, I'm not that bleeding edge.

I think it's something that people will trip over though. After installing plone.app.ldap, the Add-ons shows, "LDAPUserFolder CMF Tools" and "LDAP Support", so my first instinct was to just install both. I did read the plone.app.ldap installation instructions, but it didn't mention anything about this, it'd be nice to at least update those docs. Probably hard to fix Products.LDAPUserFolder from appearing in the add-ons though, short of doing a release without quickinstaller functionality - would be kind of nice though to avoid having a "blows up Plone site" button.

Regardless of the ldap issues, it'd still be nice to catch attribute errors anyways, since getMemberInfo isn't part of the interface. Although that's a very low priority issue.

comment:8 Changed 6 years ago by esteele

  • Component changed from Unknown to Infrastructure

comment:9 Changed 6 years ago by hannosch

On the LDAPUserFolder profile issue: plone.app.ldap should hide the LDAPUserFolder profiles. It is the add-on that pulls those in after all. See Products.CMFPlone.factory.HiddenProfiles on how to hide profiles. This is a named utility that you can register with the name "plone.app.ldap".

comment:10 Changed 6 years ago by hannosch

  • Status changed from reopened to closed
  • Resolution set to fixed

I fixed the getMemberInfo issue in  http://dev.plone.org/collective/changeset/120804. This adds a custom interface to PlonePAS that specifies the additional method. The method is used all over the place in Plone, so we cannot simply remove it from the contract.

comment:11 Changed 4 years ago by davisagli

  • Component changed from Infrastructure to General

comment:12 Changed 4 years ago by jelmd

  • Version set to 4.1

Unbelievable, that this crap is still not fixed!

comment:13 Changed 4 years ago by kleist

Does jelmd have a point? or are the spammers about to take over Trac as well??

Last edited 4 years ago by kleist (previous) (diff)

comment:14 Changed 4 years ago by jelmd

The point is, that as soon as one enables "LDAPUserFolder CMF Tools x.xx" the PloneSite doesn't work anymore and there is no way to disable it, because the related pages are not shown because of this bug (just a senseless message). So the only workaround is to re-install ...

Furthermore because of the very sparse documentation and Plone's bad error reporting, a user doesn't know, that "LDAPUserFolder..." is the cause of the problem. Thus e.g. I had to waste a lot of my valuable time to find a "fix" for this problem. Also I'm pretty sure, that other people will never find out, what's going wrong ...

comment:15 Changed 4 years ago by kleist

  • Priority changed from minor to major
  • Status changed from closed to reopened
  • Component changed from General to Backend (Python)
  • Resolution fixed deleted

comment:16 Changed 4 years ago by eleddy

jelmd: Making a patch/pull request is the best way to get things fixed in plone. do you have core access? if not I would suggest acquiring it. I'm happy to help you make that happen.

comment:17 Changed 4 years ago by davisagli

I suspect it would be less work to fix LDAPUserFolder to provide this method that is expected by Plone, than to fix every place in Plone that uses this method.

comment:18 Changed 3 years ago by kleist

  • Status changed from reopened to confirmed
  • Milestone changed from 4.0 to 4.x

Milestone 4.0 makes no sense.

comment:19 follow-up: ↓ 20 Changed 3 years ago by ciriarte

I see the same after enabling LDAP support for CMF (plone.app.ldap installed)

Module zope.tales.tales, line 696, in evaluate

  • URL: file:/opt/Plone/buildout-cache/eggs/Products.CMFPlone-4.3.2-py2.7.egg/Products/CMFPlone/skins/plone_content/folder_listing.pt
  • Line 128, Column 28
  • Expression: <PythonExpr pas_member.info(item_creator)>
  • Names:

{'container': <PloneSite at /Dev>,

'context': <PloneSite at /Dev>, 'default': <object object at 0x7f90c0b7db60>, 'here': <PloneSite at /Dev>, 'loop': {u'item': <Products.PageTemplates.Expressions.PathIterator object at 0x97efc10>}, 'nothing': None, 'options': {'args': ()}, 'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xa7bd050>, 'request': <HTTPRequest, URL= http://intranet2.tecno.com.py/Dev/folder_listing>, 'root': <Application at >, 'template': <FSPageTemplate at /Dev/folder_listing>, 'traverse_subpath': [], 'user': <PropertiedUser 'admin'>}

Module Products.PageTemplates.ZRPythonExpr, line 48, in call

  • traceback_info: pas_member.info(item_creator)

Module PythonExpr, line 1, in <expression> Module plone.memoize.instance, line 51, in memogetter Module Products.PlonePAS.browser.member, line 16, in info

AttributeError: getMemberInfo

Last edited 3 years ago by ciriarte (previous) (diff)

comment:20 in reply to: ↑ 19 Changed 3 years ago by ciriarte

Replying to ciriarte:

I see the same after enabling LDAP support for CMF (plone.app.ldap installed)

Module zope.tales.tales, line 696, in evaluate

  • URL: file:/opt/Plone/buildout-cache/eggs/Products.CMFPlone-4.3.2-py2.7.egg/Products/CMFPlone/skins/plone_content/folder_listing.pt
  • Line 128, Column 28
  • Expression: <PythonExpr pas_member.info(item_creator)>
  • Names:

{'container': <PloneSite at /Dev>,

'context': <PloneSite at /Dev>, 'default': <object object at 0x7f90c0b7db60>, 'here': <PloneSite at /Dev>, 'loop': {u'item': <Products.PageTemplates.Expressions.PathIterator object at 0x97efc10>}, 'nothing': None, 'options': {'args': ()}, 'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xa7bd050>, 'request': <HTTPRequest, URL= http://intranet2.tecno.com.py/Dev/folder_listing>, 'root': <Application at >, 'template': <FSPageTemplate at /Dev/folder_listing>, 'traverse_subpath': [], 'user': <PropertiedUser 'admin'>}

Module Products.PageTemplates.ZRPythonExpr, line 48, in call

  • traceback_info: pas_member.info(item_creator)

Module PythonExpr, line 1, in <expression> Module plone.memoize.instance, line 51, in memogetter Module Products.PlonePAS.browser.member, line 16, in info

AttributeError: getMemberInfo

by the way, the plone.app.ldap documentation page states that this module should not be enabled, would be nice to have that option disabled or a big red notice next to it :)

Note: See TracTickets for help on using tickets.