Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ItemValidator(object):
- def __init__(self, items):
- self.items = items
- def validate(self):
- if Item("Green") in items:
- raise MyGreenValidationError
- return True
- >>> f = Foo()
- >>> item = Item("Green")
- >>> f.items.add(item)
- >>> i = ItemValidator(items)
- >>> if i.validate():
- >>> f.items.save() # or something
Advertisement
Add Comment
Please, Sign In to add comment