diff --git a/emmett/__version__.py b/emmett/__version__.py index fab833f3..b482efeb 100644 --- a/emmett/__version__.py +++ b/emmett/__version__.py @@ -1 +1 @@ -__version__ = "2.6.1" +__version__ = "2.6.2" diff --git a/emmett/cli.py b/emmett/cli.py index 0a64d7b6..f54f3c73 100644 --- a/emmett/cli.py +++ b/emmett/cli.py @@ -15,6 +15,7 @@ import code import os +import pathlib import re import sys import types @@ -232,8 +233,18 @@ def main(self, *args, **kwargs): @click.option( "--loop", type=click.Choice(["auto", "asyncio", "uvloop"]), default="auto", help="Event loop implementation." ) -@click.option("--ssl-certfile", type=str, default=None, help="SSL certificate file") -@click.option("--ssl-keyfile", type=str, default=None, help="SSL key file") +@click.option( + "--ssl-certfile", + type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True, path_type=pathlib.Path), + default=None, + help="SSL certificate file", +) +@click.option( + "--ssl-keyfile", + type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True, path_type=pathlib.Path), + default=None, + help="SSL key file", +) @click.option("--reloader/--no-reloader", is_flag=True, default=True, help="Runs with reloader.") @pass_script_info def develop_command(info, host, port, interface, loop, ssl_certfile, ssl_keyfile, reloader): @@ -296,8 +307,18 @@ def develop_command(info, host, port, interface, loop, ssl_certfile, ssl_keyfile @click.option("--access-log/--no-access-log", is_flag=True, default=False, help="Enable access log.") @click.option("--backlog", type=int, default=2048, help="Maximum number of connections to hold in backlog") @click.option("--backpressure", type=int, help="Maximum number of requests to process concurrently (per worker)") -@click.option("--ssl-certfile", type=str, default=None, help="SSL certificate file") -@click.option("--ssl-keyfile", type=str, default=None, help="SSL key file") +@click.option( + "--ssl-certfile", + type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True, path_type=pathlib.Path), + default=None, + help="SSL certificate file", +) +@click.option( + "--ssl-keyfile", + type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True, path_type=pathlib.Path), + default=None, + help="SSL key file", +) @pass_script_info def serve_command( info, diff --git a/emmett/forms.py b/emmett/forms.py index bc0edb0e..77e5ee84 100644 --- a/emmett/forms.py +++ b/emmett/forms.py @@ -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? diff --git a/emmett/routing/response.py b/emmett/routing/response.py index a1c23cd8..0d16a20c 100644 --- a/emmett/routing/response.py +++ b/emmett/routing/response.py @@ -13,7 +13,7 @@ from typing import Any, Dict, Tuple, Union -from emmett_core.http.response import HTTPResponse, HTTPStringResponse +from emmett_core.http.response import HTTPStringResponse from emmett_core.routing.response import ResponseProcessor from renoir.errors import TemplateMissingError diff --git a/pyproject.toml b/pyproject.toml index f63d9aff..e337cd2c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "emmett" -version = "2.6.1" +version = "2.6.2" description = "The web framework for inventors" readme = "README.md" license = "BSD-3-Clause" @@ -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",