Changeset 190
- Timestamp:
- 08/28/07 19:14:26 (6 years ago)
- Location:
- elixir/trunk
- Files:
-
- 3 modified
-
CHANGES (modified) (1 diff)
-
elixir/ext/associable.py (modified) (1 diff)
-
tests/test_associable.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/CHANGES
r147 r190 1 1 0.4.0 2 - Fixed bug in associable not properly picking out its own plural name when 3 none is provided. Added unit test for the bug. 2 4 - Added ext sub-package for additional Elixir statements. 3 5 - Added ext.associable for generating polymorphic associations with Elixir -
elixir/trunk/elixir/ext/associable.py
r172 r190 120 120 interface_name = entity.table.name 121 121 able_name = interface_name + 'able' 122 attr_name = "%s_rel" % interface_name 122 123 if plural_name: 124 attr_name = "%s_rel" % plural_name 125 else: 126 plural_name = interface_name 127 attr_name = "%s_rel" % interface_name 123 128 124 129 association_table = sa.Table("%s" % able_name, entity._descriptor.metadata, -
elixir/trunk/tests/test_associable.py
r189 r190 12 12 using_options(shortnames=True) 13 13 14 15 class Comment(Entity): 16 has_field('id', Integer, primary_key=True) 17 has_field('name', Unicode) 18 has_field('text', String) 19 14 20 is_addressable = associable(Address, 'addresses') 21 is_commentable = associable(Comment, 'comments') 15 22 16 23 class Person(Entity): … … 20 27 using_options(shortnames=True) 21 28 is_addressable() 29 is_commentable() 22 30 23 31 class Order(Entity): … … 27 35 using_options(shortnames=True) 28 36 is_addressable('address', uselist=False) 37 38 class Foo(Entity): 39 pass 40 41 class Bar(Entity): 42 pass 43 44 is_fooable = associable(Foo) 45 is_barable = associable(Bar) 46 47 class Quux(Entity): 48 is_fooable() 49 is_barable() 29 50 30 51 class TestOrders(object): … … 37 58 cleanup_all() 38 59 39 def test_b idirectional(self):60 def test_basic(self): 40 61 home = Address(street='123 Elm St.', city='Spooksville') 41 62 work = Address(street='243 Hooper st.', city='Cupertino')
