equal
deleted
inserted
replaced
21 |
21 |
22 class ValidateException(Exception): |
22 class ValidateException(Exception): |
23 def __init__(self, code=700, field=None, msg=None): |
23 def __init__(self, code=700, field=None, msg=None): |
24 self.code=code |
24 self.code=code |
25 self.field=field |
25 self.field=field |
26 self.msg='Validation failed.' |
26 self.msg = msg |
|
27 if not msg: |
|
28 self.msg='Validation failed.' |
27 if field and not msg: |
29 if field and not msg: |
28 self.msg="Validation of '%s' failed."%field |
30 self.msg="Validation of '%s' failed."%field |
29 |
31 |
30 def dict(self): |
32 def dict(self): |
31 return {"code":self.code, |
33 return {"code":self.code, |