Skip to content
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

TypeError thrown when during groups lookup #3952

Open
alecpm opened this issue May 15, 2024 · 1 comment
Open

TypeError thrown when during groups lookup #3952

alecpm opened this issue May 15, 2024 · 1 comment

Comments

@alecpm
Copy link
Member

alecpm commented May 15, 2024

The offending code is here. The traceback looks like this:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 176, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 385, in publish_module
  Module ZPublisher.WSGIPublisher, line 280, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module Products.CMFPlone.controlpanel.browser.usergroups_usermembership, line 57, in __call__
  Module Products.CMFPlone.controlpanel.browser.usergroups_usermembership, line 54, in update
  Module Products.CMFPlone.controlpanel.browser.usergroups_usermembership, line 63, in getGroups
TypeError: '<' not supported between instances of 'bool' and 'str'

The issue is that when there's a None value in the groupResults (which is anticipated in the sort code) the lambda returns False which fails to compare against the group title/name strings under Python 3. The list comprehension that defines groupResults should probably just filter out None values to avoid this issue. I'm not entirely sure what circumstances result in a None group value, but I am seeing it occur in a real world use case.

@davisagli
Copy link
Sponsor Member

FWIW we fixed a similar bug in plone.restapi recently: plone/plone.restapi#1775

I think it can happen if a group is enumerated by a PAS plugin but it can't actually be fetched by id for some reason.

In your case maybe there is something wrong with what the dexterity.membrane PAS plugins are returning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants