Open frapell opened 6 months ago
In general, things don't work out well when a contained content item has the same id as a field. Unfortunately, fixing this probably requires deep changes in Zope, to only traverse to sub-items via item access (__getitem__
) and not attribute access. That would be a pretty fundamental change. It looks like Hanno tried to clean this up in 2010 but ran into some trouble because traversal prefers acquired attributes over __getitem__
: https://github.com/zopefoundation/Products.BTreeFolder2/blob/master/src/Products/BTreeFolder2/BTreeFolder2.py#L233
There is a very specific edge case, where an item with id "image" will throw an exception. Steps to reproduce:
The following traceback is observed:
The issue happens here https://github.com/plone/plone.namedfile/blob/e8a44b8688e596a123b10a4a2e6ae48c82cdf140/plone/namedfile/scaling.py#L564-L567 where
getattr(context, fieldname, None)
returns the content item with idimage
instead of the expected fieldI am not sure what the proper fix would be here... maybe
ImageScaling
should adapt some more specific interface thanITraversable
?Suggestions?