Skip to content

Commit

Permalink
bumped version to 0.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Pradan committed Sep 28, 2017
1 parent c602aa0 commit aa985e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='pymental',
version='0.0.8',
version='0.0.9',
description='Client library for interacting with Elemental Conductor',
author='PBS Core Services Team',
author_email='pbsi-team-core-services@pbs.org',
Expand Down
14 changes: 10 additions & 4 deletions src/pymental/models/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ class NodeList(Model):

nodes = ListField('node', Node)

def filter(self, **kwargs):
if len(kwargs) != 1:
raise ValueError("Exactly 1 filter criteria required. "
"e.g. status='active'")
def filter(self, product=None, **kwargs):
if len(kwargs) != (2 if product else 1):
raise ValueError(
"Exactly 1 filter criteria required.(Besides product)"
"e.g. status='active'")

key, val = kwargs.popitem()
if product:
return [node for node in self.nodes
if getattr(node, key, None) == val
and node.product == product]
return [node for node in self.nodes if getattr(node, key, None) == val]

@property
Expand Down

0 comments on commit aa985e3

Please sign in to comment.