Changeset 448
- Timestamp:
- 03/23/09 11:56:17 (4 years ago)
- Location:
- elixir/trunk
- Files:
-
- 3 modified
-
CHANGES (modified) (2 diffs)
-
elixir/entity.py (modified) (1 diff)
-
tests/test_dict.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/CHANGES
r447 r448 9 9 subclasses. For example, this makes it possible to have all classes 10 10 inheriting from your custom base class use some custom options without 11 having to set it individually on each entity, nor modify 11 having to set it individually on each entity, nor modify 12 12 options.options_defaults. 13 13 - The local_colname and remote_colname arguments on ManyToMany relationships … … 81 81 - Fixed filter argument on OneToMany relationship leaking the filter to the 82 82 unfiltered relationship. 83 - Fixed using to_dict with a ManyToOne relationship in the "deep" set and that 84 relationship being None in the entity being converted. 83 85 84 86 0.6.1 - 2008-08-18 -
elixir/trunk/elixir/entity.py
r443 r448 1035 1035 fks = self.mapper.get_property(rname).remote_side 1036 1036 exclude = [c.name for c in fks] 1037 if isinstance(dbdata, list): 1037 if dbdata is None: 1038 data[rname] = None 1039 elif isinstance(dbdata, list): 1038 1040 data[rname] = [o.to_dict(rdeep, exclude) for o in dbdata] 1039 1041 else: -
elixir/trunk/tests/test_dict.py
r361 r448 26 26 tbl1 = ManyToOne(Table1) 27 27 28 setup_all( True)28 setup_all() 29 29 30 30 def teardown(): 31 cleanup_all( True)31 cleanup_all() 32 32 33 33 class TestDeepSet(object): 34 def setup(self): 35 create_all() 36 37 def teardown(self): 38 session.close() 39 drop_all() 40 34 41 def test_set_attr(self): 35 42 t1 = Table1() … … 88 95 session.commit() 89 96 try: 90 t1.from_dict(dict(tbl2s=[{'t2id': t2.t2id+1}]))97 t1.from_dict(dict(tbl2s=[{'t2id': t2.t2id+1}])) 91 98 assert False 92 99 except: … … 97 104 assert t1.to_dict() == {'t1id': 50, 'name': 'test1'} 98 105 106 def test_to_deep_m2o(self): 107 t1 = Table1(t1id=1, name='test1') 108 t2 = Table2(t2id=1, name='test2', tbl1=t1) 109 session.flush() 110 assert t2.to_dict(deep={'tbl1': {}}) == \ 111 {'t2id': 1, 'name': 'test2', 'tbl1_t1id': 1, 112 'tbl1': {'name': 'test1'}} 113 114 def test_to_deep_m2o_none(self): 115 t2 = Table2(t2id=1, name='test2') 116 session.flush() 117 assert t2.to_dict(deep={'tbl1': {}}) == \ 118 {'t2id': 1, 'name': 'test2', 'tbl1_t1id': None, 'tbl1': None} 119 99 120 def test_to_deep(self): 100 121 t1 = Table1(t1id=51, name='test2') 101 assert t1.to_dict(deep={'tbl2s': {}}) == \122 assert t1.to_dict(deep={'tbl2s': {}}) == \ 102 123 {'t1id': 51, 'name': 'test2', 'tbl2s': []} 103 124 … … 116 137 t1.tbl3 = Table3(t3id=50, name='wobble') 117 138 session.commit() 118 assert t1.to_dict(deep={'tbl3': {}}) == \139 assert t1.to_dict(deep={'tbl3': {}}) == \ 119 140 {'t1id': 53, 120 141 'name': 'test2',
