Skip to content

Commit

Permalink
Fix empty uploads in forms (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro authored Nov 15, 2024
1 parent adca68c commit 64f0c8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions emmett/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ async def _process(self, **kwargs):
#: handle uploads
for field in filter(lambda f: f.type == "upload", self.writable_fields):
upload = self.files[field.name]
del_field = field.name + "__del"
if not upload.filename:
if not upload:
del_field = field.name + "__del"
if self.input_params.get(del_field, False):
self.params[field.name] = self.table[field.name].default or ""
# TODO: do we want to physically delete file?
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ classifiers = [

dependencies = [
"click>=6.0",
"emmett-core[granian,rapidjson]~=1.0.2",
"emmett-core[granian,rapidjson]~=1.0.4",
"emmett-pydal==17.3.1",
"pendulum~=3.0.0",
"pyyaml~=6.0",
Expand Down

0 comments on commit 64f0c8b

Please sign in to comment.