Changeset 478 for elixir/trunk
- Timestamp:
- 09/29/09 18:53:07 (3 years ago)
- Location:
- elixir/trunk
- Files:
-
- 3 modified
-
CHANGES (modified) (2 diffs)
-
elixir/relationships.py (modified) (3 diffs)
-
tests/test_m2m.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/CHANGES
r477 r478 18 18 - Added (or rather fixed and documented) a "table" argument on ManyToMany 19 19 relationships to allow using a manually-defined Table (closes #44). 20 - Added a "schema" argument on ManyToMany relationships to be able to create 21 the ManyToMany table in a custom schema and not necessarily the same schema 20 - Added a "schema" argument on ManyToMany relationships to be able to create 21 the ManyToMany table in a custom schema and not necessarily the same schema 22 22 as the table of the "source" entity (patch from Diez B. Roggisch). 23 23 - Added a "table_kwargs" argument on ManyToMany relationships to pass any … … 55 55 - Made manually defined mapper options take precedence over Elixir-generated 56 56 ones. Not very useful yet since most are expecting Column objects. 57 - Default table_options (defined in options_defaults['table_options']) are now 58 also used for ManyToMany tables. 57 59 58 60 Bug fixes: -
elixir/trunk/elixir/relationships.py
r477 r478 915 915 return 916 916 917 # compute table_kwargs 918 complete_kwargs = options.options_defaults['table_options'].copy() 919 complete_kwargs.update(self.table_kwargs) 920 917 921 #needs: table_options['schema'], autoload, tablename, primary_keys, 918 922 #entity.__name__, table_fullname … … 982 986 983 987 self.table = Table(tablename, e1_desc.metadata, autoload=True, 984 ** self.table_kwargs)988 **complete_kwargs) 985 989 if 'primaryjoin' not in self.kwargs or \ 986 990 'secondaryjoin' not in self.kwargs: … … 1086 1090 1087 1091 self.table = Table(tablename, e1_desc.metadata, 1088 schema=schema, *args, ** self.table_kwargs)1092 schema=schema, *args, **complete_kwargs) 1089 1093 if DEBUG: 1090 1094 print self.table.repr2() -
elixir/trunk/tests/test_m2m.py
r477 r478 58 58 def test_table_kwargs(self): 59 59 class A(Entity): 60 using_options(shortnames=True)61 name = Field(String(60))62 60 bs_ = ManyToMany('B', table_kwargs={'info': {'test': True}}) 63 61 64 62 class B(Entity): 65 using_options(shortnames=True)66 name = Field(String(60))67 63 as_ = ManyToMany('A') 68 64 … … 71 67 72 68 assert A.bs_.property.secondary.info['test'] is True 69 70 def test_table_default_kwargs(self): 71 options_defaults['table_options'] = {'info': {'test': True}} 72 73 class A(Entity): 74 bs_ = ManyToMany('B') 75 76 class B(Entity): 77 as_ = ManyToMany('A') 78 79 setup_all(True) 80 A.mapper.compile() 81 82 options_defaults['table_options'] = {} 83 84 assert A.bs_.property.secondary.info['test'] is True 85 assert A.table.info['test'] is True 86 assert B.table.info['test'] is True 73 87 74 88 def test_custom_global_column_nameformat(self):
