Changeset 3201
- Timestamp:
- 05/15/07 14:40:17 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/mscott/Constraints/trunk/constraints/schema/constraints_001.py
r3200 r3201 3 3 from schevo.schema import * 4 4 schevo.schema.prep(locals()) 5 6 from schevo.functional import all 5 7 6 8 … … 14 16 15 17 _key(name) 18 19 20 class Widget(E.Entity): 21 22 name = f.unicode() 23 sprocket_list = f.entity_list('Sprocket') 24 25 _key(name) 26 27 _constraints = [ 28 "all((sprocket.widget is self) for sprocket in self.sprocket_list)", 29 "len(self.sprocket_list) == self.sys.count('Sprocket', 'widget')", 30 ] 31 32 33 class Sprocket(E.Entity): 34 35 name = f.unicode() 36 widget = f.entity('Widget') 37 38 _constraints = [ 39 "self in self.widget.sprocket_list", 40 ]
