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 taskfile for simple projects #430

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ tasks:

run:
desc: Starts {{ project_name }} in development mode
env:
ESMERALD_SETTINGS_MODULE: {{ project_name }}.configs.development.settings.DevelopmentAppSettings
cmds:
- esmerald runserver

Expand Down
12 changes: 6 additions & 6 deletions esmerald/routing/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_base_annotations(base_annotation: Any) -> Dict[str, Any]:
Returns the annotations of the base class.

Args:
base (Any): The base class.
base_annotation (Any): The base class.

Returns:
Dict[str, Any]: The annotations of the base class.
Expand Down Expand Up @@ -195,17 +195,17 @@ def get_data_field(handler: Union["HTTPHandler", "WebhookHandler", Any]) -> Any:
default to the normal Esmerald processing, otherwise it will use the complex approach of
designing the OpenAPI body.
"""
# If there are no body fields, we simply return the original
# default Esmerald body parsing
if not handler.body_encoder_fields:
return get_original_data_field(handler)

is_data_or_payload = (
DATA
if DATA in handler.signature_model.model_fields
else (PAYLOAD if PAYLOAD in handler.signature_model.model_fields else None)
)

# If there are no body fields, we simply return the original
# default Esmerald body parsing
if not handler.body_encoder_fields:
return get_original_data_field(handler)

if len(handler.body_encoder_fields) < 2 and is_data_or_payload is not None:
return get_original_data_field(handler)
return get_complex_data_field(handler, fields=handler.body_encoder_fields)
Expand Down
1 change: 0 additions & 1 deletion esmerald/routing/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ async def _get_response_data(
Any: The response data generated by processing the request.
"""
signature_model = get_signature(route)
is_data_or_payload: str = None

if parameter_model.has_kwargs:
kwargs: Dict[str, Any] = parameter_model.to_kwargs(connection=request, handler=route)
Expand Down
1 change: 0 additions & 1 deletion esmerald/transformers/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from esmerald.types import Dependencies # pragma: no cover
from esmerald.websockets import WebSocket # pragma: no cover


MEDIA_TYPES = [EncodingType.MULTI_PART, EncodingType.URL_ENCODED]
MappingUnion = Mapping[Union[int, str], Any]

Expand Down