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

folder_contents breaks if a catalog column name matches any blob fields #4078

Open
sauzher opened this issue Dec 11, 2024 · 3 comments
Open

Comments

@sauzher
Copy link

sauzher commented Dec 11, 2024

BUG/PROBLEM REPORT

folder_contents view breaks if a there is a catalog column (metadata) that matches any blob fields name and that folder contains items with that blob field populated.

What I did:

Add a portal_catalog metadata column named as any blob field (for example image)
Add an Image content in a folder (populate it with an actual file)
Try to access to folder_contents view

What I expect to happen:

See folder contents items

What actually happened:

The view stucks in loading mode.

The backend raises an error:

2024-12-11 04:28:21 ERROR Zope.SiteErrorLog 1733909301.730.405219910046 http://localhost:8081/Plone/folder/@@getVocabulary
Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module plone.app.content.browser.vocabulary, line 265, in __call__
  Module plone.app.content.utils, line 24, in json_dumps
  Module simplejson, line 412, in dumps
  Module simplejson.encoder, line 296, in encode
  Module simplejson.encoder, line 378, in iterencode
ValueError: Circular reference detected

Attributes list required by the pattern are filled with all catalog metadata columns

Python repr of the an item is something like

{'CreationDate': '2024-12-06T11:12:43-05:00',
[ ... ]
 'getMimeIcon': '/Plone/++resource++mimetype.icons/txt.png',
 'getObjSize': '890.0 KB',
 'getURL': 'http://localhost:8081/Plone/esibizione-1',
'id': 'esibizione-1',

 'image': <plone.namedfile.file.NamedBlobImage object at 0x7f5babcf17d0>,

[ ... ]

 'total_comments': 0}

image value is not json serializable

What version of Plone I am using:

Plone 5.x, 6.x Classic

@davisagli
Copy link
Member

It's unusual to store a NamedBlobImage in catalog metadata. I wouldn't be surprised if it causes problems in other places too. Do you need to do it?

@sauzher
Copy link
Author

sauzher commented Dec 12, 2024

@davisagli I totally agree. I found this situation during a migration from plone43 Archetypes to plone5 Dexterity.
I think that column was only used as column in atct-topic configuration, and it's not really needed anymore.

I was wondering whether there should be some sort of "do not add metadata names that references blob fields" disclaimer in the zcatalog (generally Plone) documentation.

@stevepiercy
Copy link
Contributor

I was wondering whether there should be some sort of "do not add metadata names that references blob fields" disclaimer in the zcatalog (generally Plone) documentation.

There is a relevant open issue plone/documentation#1730 that needs many subject matter experts to take just one tiny, wafer-thin, after-dinner mint bite of it. Currently there is nothing useful in about zcatalog Plone 6 Documentation. 😢

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

3 participants