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

Adding a name of a user that does not exists to contributors shows error #3526

Closed pbauer closed 2 years ago

pbauer commented 2 years ago

BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)

Adding a name of a user that does not exists in Plone (or ldap) leads to error while rendering plone.contributors being displayed at the bottom:

Bildschirmfoto 2022-05-13 um 12 50 39

What I did:

You can test ot here: https://6-classic.demo.plone.org/

What I expect to happen:

Show the entered value. Adding arbitrary text here is a valid use cases and was possible in previous versions.

What actually happened:

Raised a error whne redering plone.contributors

What version of Plone/ Addons I am using:

Plone 6 coredev.

yurj commented 2 years ago

Maybe this: (https://github.com/plone/plone.app.layout/blob/c71efdd951f8e1702b3118d9897615d5cfd97c33/plone/app/layout/viewlets/document_byline.pt#L10)

This commit: https://github.com/plone/plone.app.layout/commit/c71efdd951f8e1702b3118d9897615d5cfd97c33

changed

view/authorname to view.get_fullname(creator_id)

The error is: AttributeError: 'NoneType' object has no attribute 'get' because in:

    def get_fullname(self, user_id):
        return self.portal_membership.getMemberInfo(user_id).get("fullname") or user_id

getMemberInfo can return None.

It should be something like:

userid_minfo = self.portal_membership.getMemberInfo(user_id)
if userid_minfo:
    return userid_minfo.get("fullname", user_id)
else:
    return user_id

@ale-rt

ale-rt commented 2 years ago

Yep, that's my stuff :)