Skip to content

Commit

Permalink
Merge pull request #35 from plone/value-none-error
Browse files Browse the repository at this point in the history
Fix `NamedFileWidget` bug when trying to create value   from `None`
  • Loading branch information
jensens authored Mar 9, 2021
2 parents c8d11d0 + 1f7c34b commit 88675a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/35.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `NamedFileWidget` bug when trying to create value from `None`. [vangheem]
3 changes: 2 additions & 1 deletion plone/formwidget/namedfile/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ def extract(self, default=NOVALUE):
dm = getMultiAdapter((self.context, self.field,), IDataManager)
# For sub-widgets to function use a query() not get()
data = dm.query(default)
data = _make_namedfile(data, self.field, self.context)
if data is not None:
data = _make_namedfile(data, self.field, self.context)
return data

# empty unnamed FileUploads should not count as a value
Expand Down

0 comments on commit 88675a6

Please sign in to comment.