diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-04-23 13:27:22 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-04-23 15:21:39 +0300 |
commit | 9d4e01e2df83a108c2c44cc4471666b5cecf4c36 (patch) | |
tree | 272049de3e1e30f67aee4ce6304c92e349bccea0 /ick2/pipelineapi.py | |
parent | de851333b5a0c90aa8cb7fb75e188b9e391b582d (diff) | |
download | ick2-9d4e01e2df83a108c2c44cc4471666b5cecf4c36.tar.gz |
Change: all actions must have a "where"
Diffstat (limited to 'ick2/pipelineapi.py')
-rw-r--r-- | ick2/pipelineapi.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ick2/pipelineapi.py b/ick2/pipelineapi.py index 22db2b8..da774d4 100644 --- a/ick2/pipelineapi.py +++ b/ick2/pipelineapi.py @@ -23,3 +23,21 @@ class PipelineAPI(ick2.ResourceApiBase): def get_resource_name(self, resource): return resource.get('pipeline') + + def create(self, body, **kwargs): + resource = self.mangle_new_resource(body) + + actions = resource.get('actions', []) + for action in actions: + where = action.get('where') + if where is None: + raise NoWhere(action) + + return super().create(body, **kwargs) + + +class NoWhere(Exception): + + def __init__(self, action): + super().__init__( + 'Every action MUST specify a "where": {}'.format(action)) |