Skip to content

Commit

Permalink
Merge pull request #17 from prakashpp/validate
Browse files Browse the repository at this point in the history
Added validation
  • Loading branch information
Sharoon Thomas committed Dec 15, 2014
2 parents 1e80ef5 + 02ae053 commit 40212ab
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions user.py
Expand Up @@ -28,6 +28,24 @@ class NereidUser:
help="Parties to which this user is related"
)

@classmethod
def __setup__(cls):
super(NereidUser, cls).__setup__()
cls._error_messages.update({
"party_not_in_parties": "Party missing from Parties",
})

@classmethod
def validate(cls, users):
super(NereidUser, cls).validate(users)

for user in users:
user.validate_party()

def validate_party(self):
if self.parties and self.party not in self.parties:
self.raise_user_error('party_not_in_parties')

@classmethod
def create(cls, vlist):
"""
Expand Down

0 comments on commit 40212ab

Please sign in to comment.