Changeset 422
- Timestamp:
- 12/04/08 17:11:53 (3 years ago)
- Location:
- elixir/trunk
- Files:
-
- 3 modified
-
elixir/entity.py (modified) (1 diff)
-
elixir/properties.py (modified) (1 diff)
-
tests/test_properties.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/elixir/entity.py
r421 r422 841 841 842 842 for entity in entities: 843 # delete all Elixir properties so that it doesn't interfere with 844 # SQLAlchemy. At this point they should have be converted to 845 # builders. 846 for name, attr in entity.__dict__.items(): 847 if isinstance(attr, Property): 848 delattr(entity, name) 849 843 850 if entity._descriptor.autosetup: 844 851 _cleanup_autosetup_triggers(entity) -
elixir/trunk/elixir/properties.py
r383 r422 127 127 entity._descriptor.builders.append(self) 128 128 129 # delete the original attribute so that it doesn't interfere with130 # SQLAlchemy. Note that getattr and delattr are not symmetrical:131 # getattr look up in parent classes, while delattr must be called on132 # the exact class holding the attribute.133 if name in entity.__dict__:134 delattr(entity, name)135 136 129 def __repr__(self): 137 130 return "Property(%s, %s)" % (self.name, self.entity) -
elixir/trunk/tests/test_properties.py
r349 r422 14 14 def teardown(self): 15 15 cleanup_all(True) 16 17 def test_lifecycle(self): 18 class A(Entity): 19 name = Field(String(20)) 20 21 assert isinstance(A.name, Field) 22 23 setup_all() 24 25 assert not isinstance(A.name, Field) 16 26 17 27 def test_generic_property(self):
