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: '<' not supported between instances of 'dict' and 'dict' #194

Open
Glamurio opened this issue Feb 13, 2020 · 0 comments
Open

Comments

@Glamurio
Copy link

I've just been migrating a lot of our Dexterity types from the website to code and stumbled upon this issue. Apparently the cause is this line:

        results = [(translate(ctype['title'], context=request), ctype)
                   for ctype in results]
        results.sort()

The error happens when translating titles of existing types. In my case, I was creating a custom event type called "Termin", the German word for "event". When Plone tries to sort the content types, it translates "event" to "Termin", which causes Plone to attempt to sort the next occurence of the title name, which is the dict.

You can prevent the issue from happening by telling Plone to simply sort by ID instead in case of duplicates.
results.sort(key = lambda x: (x[0], x[1].get('id', '')))

The same error also seems to happen in other parts of Plone, as shown here.

potzenheimer added a commit to a25kk/hfph that referenced this issue Oct 26, 2022
Refactor local setup and add work around for plone core issue:
plone/plone.app.content#194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant