Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Expect proper operation_type
Browse files Browse the repository at this point in the history
  • Loading branch information
jiivan committed Jul 3, 2019
1 parent 9a7caf4 commit 8fe47df
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion golem/rpc/api/ethereum_.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def item(o):
@rpc_utils.expose('pay.operations')
@staticmethod
def get_operations(
operation_type: typing.Optional[model.WalletOperation.TYPE],
operation_type: typing.Optional[str],
page_num: int = 1,
per_page: int = 20,
):
Expand All @@ -88,6 +88,11 @@ def get_operations(
query = model.WalletOperation.select() \
.order_by(model.WalletOperation.id.desc())
if operation_type:
try:
operation_type = model.WalletOperation.TYPE(operation_type)
except ValueError:
logger.error('Invalid operation type: %r', operation_type)
return []
query = query.where(
model.WalletOperation.operation_type == operation_type,
)
Expand Down

0 comments on commit 8fe47df

Please # to comment.