NamedBlobFile in event description always modified

Can I get a second set of eyes on this?

I have a field:

    video_file = NamedBlobFile(
        title=_('video file'),
    )

I've found that when I register an event with zope.lifecycleevent.interfaces.IObjectModifiedEvent and check what fields have been modified,

in my event handler I have:

for d in event.descriptions:
    'video_file' in d.attributes:
        file_changed = True

(source: Modified Event Handler for Dexterity Form Field? )

this namedblobfile always pops up on the list of modified fields, even though "Keep existing file" is selected with the widget.

I'm thinking this is a bug, and looks like it's a bug in the widget not setting the value to z3c.form.interfaces.NOT_CHANGED

Analysis:

z3c.form.form.applyChanges computes what fields have changed. It specifically looks for this:

A namedblobfile will fail this check and move on to util.changedField whose job it is to really check if a value changed. This is hot wired to return true b/c namedblobfile implements zope.schema.interfaces.IObject

I have some other options here to avoid triggering 'the video file data changed' but wanted to check here first.

Anyone know of a better file field widget?

Should I file a bug against plone.formwidget.namedfile?

Am I just doing something wrong?

Your analysis seems sound to me, but:

I'm thinking this is a bug, and looks like it's a bug in the widget not setting the value to z3c.form.interfaces.NOT_CHANGED

This seems to be the place where the error is made and where something should be fixed, the other code you mention seems to be correct.

I've self-assigned the ticket, but currently quite lost on how to fix it. I might have something in a day or so.

Doctests even got updated.

Plone Foundation Code of Conduct