Changeset 477
- Timestamp:
- 09/29/09 18:12:03 (4 years ago)
- Location:
- elixir/trunk
- Files:
-
- 3 modified
-
CHANGES (modified) (1 diff)
-
elixir/relationships.py (modified) (5 diffs)
-
tests/test_m2m.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/CHANGES
r469 r477 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 relationship to be able to create the 21 ManyToMany table in a custom schema and not necessarily the same schema as 22 the table of the "source" entity (patch from Diez B. Roggisch). 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 as the table of the "source" entity (patch from Diez B. Roggisch). 23 - Added a "table_kwargs" argument on ManyToMany relationships to pass any 24 extra keyword arguments to the underlying Table object (ticket #94). 23 25 - Added a new "target_column" argument on ManyToOne relationships so that you 24 26 can target unique but non-primary key columns. At the moment, this only works -
elixir/trunk/elixir/relationships.py
r476 r477 301 301 | | ``set null``, or ``set default``. | 302 302 +--------------------+--------------------------------------------------------+ 303 | ``column_format`` | DEPRECATED. Specify an alternate format string for | 303 | ``table_kwargs`` | A dictionary holding any other keyword argument you | 304 | | might want to pass to the underlying Table object. | 305 +--------------------+--------------------------------------------------------+| ``column_format`` | DEPRECATED. Specify an alternate format string for | 304 306 | | naming the | 305 307 | | columns in the mapping table. The default value is | … … 839 841 column_format=None, 840 842 filter=None, 843 table_kwargs=None, 841 844 *args, **kwargs): 842 845 self.user_tablename = tablename … … 880 883 if 'viewonly' not in kwargs: 881 884 kwargs['viewonly'] = True 885 886 self.table_kwargs = table_kwargs or {} 882 887 883 888 self.primaryjoin_clauses = [] … … 976 981 self.target.__name__)) 977 982 978 self.table = Table(tablename, e1_desc.metadata, autoload=True) 983 self.table = Table(tablename, e1_desc.metadata, autoload=True, 984 **self.table_kwargs) 979 985 if 'primaryjoin' not in self.kwargs or \ 980 986 'secondaryjoin' not in self.kwargs: … … 1080 1086 1081 1087 self.table = Table(tablename, e1_desc.metadata, 1082 schema=schema, *args )1088 schema=schema, *args, **self.table_kwargs) 1083 1089 if DEBUG: 1084 1090 print self.table.repr2() -
elixir/trunk/tests/test_m2m.py
r475 r477 55 55 assert a in b.as_ 56 56 assert b in a.bs_ 57 58 def test_table_kwargs(self): 59 class A(Entity): 60 using_options(shortnames=True) 61 name = Field(String(60)) 62 bs_ = ManyToMany('B', table_kwargs={'info': {'test': True}}) 63 64 class B(Entity): 65 using_options(shortnames=True) 66 name = Field(String(60)) 67 as_ = ManyToMany('A') 68 69 setup_all(True) 70 A.mapper.compile() 71 72 assert A.bs_.property.secondary.info['test'] is True 57 73 58 74 def test_custom_global_column_nameformat(self):
