Changeset 348
- Timestamp:
- 06/20/08 14:09:41 (5 years ago)
- Location:
- elixir/trunk/elixir
- Files:
-
- 2 modified
-
entity.py (modified) (5 diffs)
-
properties.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/elixir/entity.py
r347 r348 7 7 8 8 import sys 9 import inspect 9 10 import warnings 11 from copy import copy 10 12 11 13 import sqlalchemy … … 84 86 85 87 self.parent = None 88 #XXX: use entity.__subclasses__ ? 86 89 self.children = [] 87 90 … … 99 102 self._columns = list() 100 103 self.constraints = list() 104 101 105 # properties waiting for a mapper to exist 102 106 self.properties = dict() … … 661 665 return False 662 666 667 663 668 class EntityMeta(type): 664 669 """ … … 684 689 if isinstance(attr, Property)] 685 690 sorted_props = sorted(properties, key=lambda i: i[1]._counter) 686 687 691 for name, prop in sorted_props: 688 692 prop.attach(cls, name) 693 694 entity_base = None 695 for base in bases: 696 if isinstance(base, EntityMeta): 697 if not is_entity(base): 698 entity_base = base 699 if entity_base: 700 # Process attributes (using the assignment syntax), looking for 701 # 'Property' instances and attaching them to this entity. 702 base_props = inspect.getmembers(entity_base, 703 lambda a: isinstance(a, Property)) 704 local_props = [(name, copy(attr)) for name, attr in base_props] 705 sorted_props = sorted(local_props, key=lambda i: i[1]._counter) 706 for name, prop in sorted_props: 707 prop.attach(cls, name) 689 708 690 709 # Process mutators. Needed before _install_autosetup_triggers so that -
elixir/trunk/elixir/properties.py
r347 r348 116 116 # delete the original attribute so that it doesn't interfere with 117 117 # SQLAlchemy. 118 if hasattr(entity, name):118 if name in entity.__dict__: 119 119 delattr(entity, name) 120 120
