Skip to content

Commit

Permalink
Back-ported kwargs support in operation
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jun 27, 2019
1 parent 8d3d109 commit 886df81
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/quorum/model.py
Expand Up @@ -2701,6 +2701,7 @@ def operation(
name = None,
description = None,
parameters = (),
kwargs = None,
factory = False,
level = 1,
devel = False
Expand All @@ -2722,6 +2723,10 @@ def operation(
:type parameters: Tuple
:param parameters: The sequence containing tuples that describe
the various parameters to be send to the operation.
:type kwargs: Dictionary
:param kwargs: The keyword based arguments that are going to be used
as the basis for the building of the entity retrieval query, these
values should be compliant with the "model's query language".
:type factory: bool
:param factory: If the operation is considered to be a factory
meaning that a new entity is going to be created and/or updated.
Expand All @@ -2737,12 +2742,15 @@ def operation(
generated the final function to be called.
"""

_kwargs = kwargs

def decorator(function, *args, **kwargs):
function._operation = Operation(
method = function.__name__,
name = name or function.__name__,
description = description,
parameters = parameters,
kwargs = _kwargs,
factory = factory,
level = level,
devel = devel
Expand Down

0 comments on commit 886df81

Please sign in to comment.