Skip to content

Commit

Permalink
The method get always returns a single row or None
Browse files Browse the repository at this point in the history
  • Loading branch information
muflone committed Jun 6, 2021
1 parent 12b8e9c commit 9148706
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyodoo/v12/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def explode_filter(filters: list[Union[BooleanOperator, Filter, str]]

def get(self,
entity_id: int,
fields: tuple[str, ...] = None) -> dict[str, Any]:
fields: tuple[str, ...] = None) -> Optional[dict[str, Any]]:
"""
Get a row from a model using its ID
Expand Down Expand Up @@ -254,9 +254,9 @@ def delete(self,

def do_read(self,
entity_id: int,
options: dict[str, Any]) -> dict[str, Any]:
options: dict[str, Any]) -> Optional[dict[str, Any]]:
"""
Get some records in the requested model applying a filter and some
Get a record in the requested model applying a filter and some
options (like fields or context)
:param entity_id: Object ID to get
Expand All @@ -271,7 +271,7 @@ def do_read(self,
'read',
[entity_id],
options)
return results
return results[0] if results else None

def do_search(self,
filters: list[Union[BooleanOperator, Filter, str]],
Expand Down

0 comments on commit 9148706

Please sign in to comment.