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

Fix empty uploads in forms #524

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix empty uploads in forms (#520)
gi0baro committed Nov 15, 2024
commit e1aa47ea3b2a63a7c225f87160320f037a39acfe
4 changes: 2 additions & 2 deletions emmett/forms.py
Original file line number Diff line number Diff line change
@@ -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?
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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",