Changeset 490 for elixir/trunk
- Timestamp:
- 10/02/09 12:06:14 (3 years ago)
- Location:
- elixir/trunk
- Files:
-
- 5 removed
- 26 modified
-
CHANGES (modified) (1 diff)
-
elixir/__init__.py (modified) (1 diff)
-
elixir/collection.py (modified) (2 diffs)
-
elixir/entity.py (modified) (9 diffs)
-
elixir/ext/list.py (deleted)
-
elixir/options.py (modified) (2 diffs)
-
elixir/py23compat.py (deleted)
-
elixir/relationships.py (modified) (4 diffs)
-
tests/test_acts_as_list.py (deleted)
-
tests/test_associable.py (modified) (2 diffs)
-
tests/test_autoload.py (modified) (5 diffs)
-
tests/test_autosetup.py (deleted)
-
tests/test_class_methods.py (modified) (1 diff)
-
tests/test_collections.py (modified) (1 diff)
-
tests/test_custombase.py (modified) (3 diffs)
-
tests/test_dict.py (modified) (2 diffs)
-
tests/test_encryption.py (modified) (4 diffs)
-
tests/test_events.py (modified) (2 diffs)
-
tests/test_fields.py (modified) (2 diffs)
-
tests/test_inherit.py (modified) (3 diffs)
-
tests/test_m2m.py (modified) (12 diffs)
-
tests/test_m2o.py (modified) (7 diffs)
-
tests/test_o2m.py (modified) (9 diffs)
-
tests/test_o2o.py (modified) (1 diff)
-
tests/test_options.py (modified) (3 diffs)
-
tests/test_order_by.py (modified) (2 diffs)
-
tests/test_packages.py (modified) (1 diff)
-
tests/test_properties.py (modified) (8 diffs)
-
tests/test_py23compat.py (deleted)
-
tests/test_sa_integration.py (modified) (4 diffs)
-
tests/test_versioning.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/CHANGES
r486 r490 1 0.8.0 2 3 Changes: 4 Dropped support for python 2.3, SQLAlchemy 0.4 and deprecated stuff from Elixir 5 0.7 6 7 1 8 0.7.0 - 2009-10-01 2 9 -
elixir/trunk/elixir/__init__.py
r416 r490 86 86 '''Setup the table and mapper of all entities in the default entity 87 87 collection. 88 89 This is called automatically if any entity of the collection is configured90 with the `autosetup` option and it is first accessed,91 instanciated (called) or the create_all method of a metadata containing92 tables from any of those entities is called.93 88 ''' 94 89 setup_entities(entities) -
elixir/trunk/elixir/collection.py
r439 r490 3 3 ''' 4 4 import sys 5 6 from elixir.py23compat import rsplit7 5 8 6 # default entity collection … … 33 31 "source" entity when resolving relationship targets. 34 32 ''' 35 path = rsplit(key,'.', 1)33 path = key.rsplit('.', 1) 36 34 classname = path.pop() 37 35 if path: -
elixir/trunk/elixir/entity.py
r480 r490 3 3 ``EntityMeta``. 4 4 ''' 5 6 from py23compat import sorted7 5 8 6 import sys … … 499 497 self.has_pk = True 500 498 501 # Autosetup triggers shouldn't be active anymore at this point, so we 502 # can theoretically access the entity's table safely. But the problem 503 # is that if, for some reason, the trigger removal phase didn't 504 # happen, we'll get an infinite loop. So we just make sure we don't 505 # get one in any case. 506 table = type.__getattribute__(self.entity, 'table') 499 table = self.entity.table 507 500 if table is not None: 508 501 if check_duplicate and col.key in table.columns.keys(): … … 691 684 692 685 693 class TriggerProxy(object):694 """695 A class that serves as a "trigger" ; accessing its attributes runs696 the setup_all function.697 698 Note that the `setup_all` is called on each access of the attribute.699 """700 701 def __init__(self, class_, attrname):702 self.class_ = class_703 self.attrname = attrname704 705 def __getattr__(self, name):706 elixir.setup_all()707 #FIXME: it's possible to get an infinite loop here if setup_all doesn't708 #remove the triggers for this entity. This can happen if the entity is709 #not in the `entities` list for some reason.710 proxied_attr = getattr(self.class_, self.attrname)711 return getattr(proxied_attr, name)712 713 def __repr__(self):714 proxied_attr = getattr(self.class_, self.attrname)715 return "<TriggerProxy (%s)>" % (self.class_.__name__)716 717 718 class TriggerAttribute(object):719 720 def __init__(self, attrname):721 self.attrname = attrname722 723 def __get__(self, instance, owner):724 #FIXME: it's possible to get an infinite loop here if setup_all doesn't725 #remove the triggers for this entity. This can happen if the entity is726 #not in the `entities` list for some reason.727 elixir.setup_all()728 return getattr(owner, self.attrname)729 730 686 def is_entity(cls): 731 687 """ … … 774 730 prop.attach(cls, name) 775 731 776 # Process mutators. Needed before _install_autosetup_triggers so that 777 # we know of the metadata (and whether the entity is autosetuped or not). 732 # Process mutators 778 733 process_mutators(cls) 779 734 780 735 # setup misc options here (like tablename etc.) 781 736 desc.setup_options() 782 783 # create trigger proxies784 # TODO: support entity_name... It makes sense only for autoloaded785 # tables for now, and would make more sense if we support "external"786 # tables787 if desc.autosetup:788 _install_autosetup_triggers(cls)789 737 790 738 … … 808 756 instrument_class(cls) 809 757 810 def __call__(cls, *args, **kwargs):811 if cls._descriptor.autosetup and not hasattr(cls, '_setup_done'):812 elixir.setup_all()813 return type.__call__(cls, *args, **kwargs)814 815 758 def __setattr__(cls, key, value): 816 759 if isinstance(value, Property): … … 824 767 825 768 826 def _install_autosetup_triggers(cls, entity_name=None):827 #TODO: move as much as possible of those "_private" values to the828 # descriptor, so that we don't mess the initial class.829 warnings.warn("The 'autosetup' option on entities is deprecated. "830 "Please call setup_all() manually after all your entities have been "831 "declared.", DeprecationWarning, stacklevel=4)832 tablename = cls._descriptor.tablename833 schema = cls._descriptor.table_options.get('schema', None)834 cls._table_key = sqlalchemy.schema._get_table_key(tablename, schema)835 836 table_proxy = TriggerProxy(cls, 'table')837 838 md = cls._descriptor.metadata839 md.tables[cls._table_key] = table_proxy840 841 # We need to monkeypatch the metadata's table iterator method because842 # otherwise it doesn't work if the setup is triggered by the843 # metadata.create_all().844 # This is because ManyToMany relationships add tables AFTER the list845 # of tables that are going to be created is "computed"846 # (metadata.tables.values()).847 # see:848 # - table_iterator method in MetaData class in sqlalchemy/schema.py849 # - visit_metadata method in sqlalchemy/ansisql.py850 if SA05orlater:851 warnings.warn(852 "The automatic setup via metadata.create_all() through "853 "the autosetup option doesn't work with SQLAlchemy 0.5 and later!")854 else:855 # SA 0.6 does not use table_iterator anymore (it was already deprecated856 # since SA 0.5.0)857 original_table_iterator = md.table_iterator858 if not hasattr(original_table_iterator,859 '_non_elixir_patched_iterator'):860 def table_iterator(*args, **kwargs):861 elixir.setup_all()862 return original_table_iterator(*args, **kwargs)863 table_iterator.__doc__ = original_table_iterator.__doc__864 table_iterator._non_elixir_patched_iterator = \865 original_table_iterator866 md.table_iterator = table_iterator867 868 #TODO: we might want to add all columns that will be available as869 #attributes on the class itself (in SA 0.4+). This is a pretty870 #rare usecase, as people will normally hit the query attribute before the871 #column attributes, but I've seen people hitting this problem...872 for name in ('c', 'table', 'mapper', 'query'):873 setattr(cls, name, TriggerAttribute(name))874 875 cls._has_triggers = True876 877 878 def _cleanup_autosetup_triggers(cls):879 if not hasattr(cls, '_has_triggers'):880 return881 882 for name in ('table', 'mapper'):883 setattr(cls, name, None)884 885 for name in ('c', 'query'):886 delattr(cls, name)887 888 desc = cls._descriptor889 md = desc.metadata890 891 # the fake table could have already been removed (namely in a892 # single table inheritance scenario)893 md.tables.pop(cls._table_key, None)894 895 # restore original table iterator if not done already896 if not SA05orlater:897 if hasattr(md.table_iterator, '_non_elixir_patched_iterator'):898 md.table_iterator = \899 md.table_iterator._non_elixir_patched_iterator900 901 del cls._has_triggers902 903 904 769 def setup_entities(entities): 905 770 '''Setup all entities in the list passed as argument''' … … 912 777 if isinstance(attr, Property): 913 778 delattr(entity, name) 914 915 if entity._descriptor.autosetup:916 _cleanup_autosetup_triggers(entity)917 779 918 780 for method_name in ( … … 940 802 """ 941 803 Try to revert back the list of entities passed as argument to the state 942 they had just before their setup phase. It will not work entirely for 943 autosetup entities as we need to remove the autosetup triggers. 804 they had just before their setup phase. 944 805 945 806 As of now, this function is *not* functional in that it doesn't revert to … … 953 814 for entity in entities: 954 815 desc = entity._descriptor 955 if desc.autosetup:956 _cleanup_autosetup_triggers(entity)957 816 958 817 if hasattr(entity, '_setup_done'): -
elixir/trunk/elixir/options.py
r484 r490 116 116 | | that module. | 117 117 +---------------------+-------------------------------------------------------+ 118 | ``autosetup`` | DEPRECATED. Specify whether that entity will contain |119 | | automatic setup triggers. |120 | | That is if this entity will be |121 | | automatically setup (along with all other entities |122 | | which were already declared) if any of the following |123 | | condition happen: some of its attributes are accessed |124 | | ('c', 'table', 'mapper' or 'query'), instanciated |125 | | (called) or the create_all method of this entity's |126 | | metadata is called. Defaults to ``False``. |127 +---------------------+-------------------------------------------------------+128 118 | ``allowcoloverride``| Specify whether it is allowed to override columns. | 129 119 | | By default, Elixir forbids you to add a column to an | … … 214 204 # 215 205 options_defaults = dict( 216 autosetup=False,217 206 inheritance='single', 218 207 polymorphic=True, -
elixir/trunk/elixir/relationships.py
r488 r490 303 303 | ``table_kwargs`` | A dictionary holding any other keyword argument you | 304 304 | | might want to pass to the underlying Table object. | 305 +--------------------+--------------------------------------------------------+| ``column_format`` | DEPRECATED. Specify an alternate format string for |306 | | naming the |307 | | columns in the mapping table. The default value is |308 | | defined in ``elixir.options.M2MCOL_NAMEFORMAT``. You |309 | | will be passed ``tablename``, ``key``, and ``entity`` |310 | | as arguments to the format string. |311 305 +--------------------+--------------------------------------------------------+ 312 306 … … 839 833 ondelete=None, onupdate=None, 840 834 table=None, schema=None, 841 column_format=None,842 835 filter=None, 843 836 table_kwargs=None, … … 858 851 self.schema = schema 859 852 860 if column_format: 861 warnings.warn("The 'column_format' argument on ManyToMany " 862 "relationships is deprecated. Please use the 'local_colname' " 863 "and/or 'remote_colname' arguments if you want custom " 864 "column names for this table only, or modify " 865 "options.M2MCOL_NAMEFORMAT if you want a custom format for " 866 "all ManyToMany tables", DeprecationWarning, stacklevel=3) 867 self.column_format = column_format or options.M2MCOL_NAMEFORMAT 853 #TODO: this can probably be simplified/moved elsewhere since the 854 #argument disappeared 855 self.column_format = options.M2MCOL_NAMEFORMAT 868 856 if not hasattr(self.column_format, '__call__'): 869 857 # we need to store the format in a variable so that the … … 890 878 891 879 super(ManyToMany, self).__init__(of_kind, *args, **kwargs) 892 893 def get_table(self):894 warnings.warn("The secondary_table attribute on ManyToMany objects is "895 "deprecated. You should rather use the table attribute.",896 DeprecationWarning, stacklevel=2)897 return self.table898 secondary_table = property(get_table)899 880 900 881 def match_type_of(self, other): -
elixir/trunk/tests/test_associable.py
r485 r490 74 74 75 75 session.commit() 76 session. clear()76 session.expunge_all() 77 77 78 78 # Queries using the added helpers … … 110 110 111 111 session.commit() 112 session. clear()112 session.expunge_all() -
elixir/trunk/tests/test_autoload.py
r474 r490 62 62 63 63 session.commit() 64 session. clear()64 session.expunge_all() 65 65 66 66 homer = Person.get_by(name="Homer") … … 97 97 98 98 session.commit() 99 session. clear()99 session.expunge_all() 100 100 101 101 p = Person.get_by(name="Homer") … … 143 143 144 144 session.commit() 145 session. clear()145 session.expunge_all() 146 146 147 147 c = Category.get_by(name="Simpson") … … 177 177 178 178 session.commit() 179 session. clear()179 session.expunge_all() 180 180 181 181 homer = Person.get_by(name="Homer") … … 251 251 252 252 session.commit() 253 session. clear()253 session.expunge_all() 254 254 255 255 res = A.query.all() -
elixir/trunk/tests/test_class_methods.py
r467 r490 23 23 24 24 session.commit() 25 session. clear()25 session.expunge_all() 26 26 27 27 assert A.get(1).name == "a1" -
elixir/trunk/tests/test_collections.py
r467 r490 21 21 class Person(Entity): 22 22 name = Field(String(30)) 23 using_options( autosetup=False,tablename='person', collection=None)23 using_options(tablename='person', collection=None) 24 24 25 25 # global collection should be empty -
elixir/trunk/tests/test_custombase.py
r467 r490 30 30 31 31 session.commit() 32 session. clear()32 session.expunge_all() 33 33 34 34 a = A.query.filter_by(name="a1").one() … … 49 49 50 50 session.commit() 51 session. clear()51 session.expunge_all() 52 52 53 53 b = A.query.filter_by(name="b1").one() … … 72 72 73 73 session.commit() 74 session. clear()74 session.expunge_all() 75 75 76 76 a = A.query.filter_by(name="a1").one() -
elixir/trunk/tests/test_dict.py
r485 r490 158 158 def setup(self): 159 159 metadata.bind = 'sqlite://' 160 session. clear()160 session.expunge_all() 161 161 162 162 def teardown(self): … … 174 174 assert a.name == 'Aye' 175 175 session.commit() 176 session. clear()176 session.expunge_all() 177 177 -
elixir/trunk/tests/test_encryption.py
r467 r490 53 53 54 54 session.commit() 55 session. clear()55 session.expunge_all() 56 56 57 57 p = Person.get_by(name='Jonathan LaCour') … … 66 66 67 67 session.commit() 68 session. clear()68 session.expunge_all() 69 69 70 70 p = Person.get_by(name='Jonathan LaCour') … … 78 78 ) 79 79 session.commit() 80 session. clear()80 session.expunge_all() 81 81 82 82 p = Person.get_by(name='Jonathan LaCour') … … 94 94 95 95 session.commit() 96 session. clear()96 session.expunge_all() 97 97 98 98 p = Person.get_by(name='Jonathan LaCour') -
elixir/trunk/tests/test_events.py
r467 r490 79 79 80 80 d = Document(name='My Document') 81 session.commit(); session. clear()81 session.commit(); session.expunge_all() 82 82 83 83 d = Document.query.one() 84 84 d.name = 'My Document Updated' 85 session.commit(); session. clear()85 session.commit(); session.expunge_all() 86 86 87 87 d = Document.query.one() 88 88 d.delete() 89 session.commit(); session. clear()89 session.commit(); session.expunge_all() 90 90 91 91 def checkCount(name, value): … … 134 134 135 135 a1 = A(name='a1') 136 session.commit(); session. clear()136 session.commit(); session.expunge_all() 137 137 138 138 a = A.query.one() 139 139 a.name = 'a1 updated' 140 session.commit(); session. clear()140 session.commit(); session.expunge_all() 141 141 142 142 assert a.update_count == 1 -
elixir/trunk/tests/test_fields.py
r467 r490 23 23 24 24 session.commit() 25 session. clear()25 session.expunge_all() 26 26 27 27 p = Person.get_by(firstname="Homer") … … 40 40 41 41 session.commit() 42 session. clear()42 session.expunge_all() 43 43 44 44 p = Person.get_by(firstname="Homer") -
elixir/trunk/tests/test_inherit.py
r467 r490 5 5 from elixir import * 6 6 import elixir 7 from elixir.py23compat import sort_list8 7 9 8 def setup(): … … 50 49 51 50 session.commit() 52 session. clear()51 session.expunge_all() 53 52 54 53 res = {} 55 54 for class_ in (A, B, C, D, E): 56 55 res[class_.__name__] = class_.query.all() 57 sort_list(res[class_.__name__],key=lambda o: o.__class__.__name__)56 res[class_.__name__].sort(key=lambda o: o.__class__.__name__) 58 57 59 58 for query_class in ('A', 'B', 'C', 'D', 'E'): … … 171 170 172 171 session.commit() 173 session. clear()172 session.expunge_all() 174 173 175 174 for a in A.query.all(): -
elixir/trunk/tests/test_m2m.py
r485 r490 48 48 49 49 session.commit() 50 session. clear()50 session.expunge_all() 51 51 52 52 a = A.query.one() … … 159 159 160 160 session.commit() 161 session. clear()161 session.expunge_all() 162 162 163 163 del A … … 232 232 233 233 session.commit() 234 session. clear()234 session.expunge_all() 235 235 236 236 del A … … 267 267 assert a2.is_linked_from == [a1] 268 268 269 def test_manual_column_format(self):270 class A(Entity):271 using_options(tablename='aye')272 name = Field(String(60))273 bs_ = ManyToMany('B', column_format='%(entity)s_%(key)s')274 275 class B(Entity):276 using_options(tablename='bee')277 name = Field(String(60))278 as_ = ManyToMany('A', column_format='%(entity)s_%(key)s')279 280 setup_all(True)281 282 # check column names were generated correctly283 A.mapper.compile()284 m2m_cols = A.bs_.property.secondary.columns285 assert 'a_id' in m2m_cols286 assert 'b_id' in m2m_cols287 288 # check the relationships work as expected289 b1 = B(name='b1', as_=[A(name='a1')])290 291 session.commit()292 session.clear()293 294 a = A.query.one()295 b = B.query.one()296 297 assert a in b.as_298 assert b in a.bs_299 300 269 def test_multi_pk_in_target(self): 301 270 class A(Entity): … … 314 283 315 284 session.commit() 316 session. clear()285 session.expunge_all() 317 286 318 287 a = A.query.one() … … 339 308 340 309 session.commit() 341 session. clear()310 session.expunge_all() 342 311 343 312 a1 = A.query.one() … … 363 332 364 333 session.commit() 365 session. clear()334 session.expunge_all() 366 335 367 336 homer = Person.get_by(name="Homer") … … 390 359 391 360 session.commit() 392 session. clear()361 session.expunge_all() 393 362 394 363 homer = Person.get_by(name="Homer") … … 419 388 420 389 session.commit() 421 session. clear()390 session.expunge_all() 422 391 423 392 a1 = A.get_by(name='a1') … … 452 421 453 422 session.commit() 454 session. clear()423 session.expunge_all() 455 424 456 425 a = A.query.one() … … 487 456 488 457 session.commit() 489 session. clear()458 session.expunge_all() 490 459 491 460 a = A.query.one() … … 524 493 525 494 session.commit() 526 session. clear()495 session.expunge_all() 527 496 528 497 a = A.query.one() -
elixir/trunk/tests/test_m2o.py
r467 r490 25 25 26 26 session.commit() 27 session. clear()27 session.expunge_all() 28 28 29 29 b = B.query.one() … … 46 46 47 47 session.commit() 48 session. clear()48 session.expunge_all() 49 49 50 50 b = B.query.one() … … 72 72 b = B(a=a) 73 73 session.commit() 74 session. clear()74 session.expunge_all() 75 75 76 76 assert B.query.first().a == A.query.first() … … 94 94 95 95 session.commit() 96 session. clear()96 session.expunge_all() 97 97 98 98 homer = Person.get_by(name="Homer") … … 191 191 192 192 session.commit() 193 session. clear()193 session.expunge_all() 194 194 195 195 a1 = A.get_by(name="a1") … … 219 219 220 220 session.commit() 221 session. clear()221 session.expunge_all() 222 222 223 223 b = B.query.one() … … 239 239 240 240 session.commit() 241 session. clear()241 session.expunge_all() 242 242 243 243 assert "Claus" in Animal.get_by(name="Rudolph").owner.name -
elixir/trunk/tests/test_o2m.py
r485 r490 32 32 33 33 session.commit() 34 session. clear()34 session.expunge_all() 35 35 36 36 b = B.query.one() … … 58 58 59 59 session.commit() 60 session. clear()60 session.expunge_all() 61 61 62 62 p = Person.get_by(name="Homer") … … 88 88 89 89 session.commit() 90 session. clear()90 session.expunge_all() 91 91 92 92 root = TreeNode.get_by(name='rootnode') … … 118 118 119 119 session.commit() 120 session. clear()120 session.expunge_all() 121 121 122 122 user = User.get(1) … … 146 146 147 147 session.commit() 148 session. clear()148 session.expunge_all() 149 149 150 150 user = User.get(1) … … 173 173 174 174 session.commit() 175 session. clear()175 session.expunge_all() 176 176 177 177 user = User.get(1) … … 197 197 # 198 198 # session.commit() 199 # session. clear()199 # session.expunge_all() 200 200 # 201 201 # b = B.query.one() … … 221 221 222 222 session.commit() 223 session. clear()223 session.expunge_all() 224 224 225 225 b = B.query.one() … … 244 244 245 245 session.commit() 246 session. clear()246 session.expunge_all() 247 247 248 248 santa = Person.get_by(name="Santa Claus") -
elixir/trunk/tests/test_o2o.py
r467 r490 22 22 23 23 session.commit() 24 session. clear()24 session.expunge_all() 25 25 26 26 b = B.query.one() -
elixir/trunk/tests/test_options.py
r480 r490 26 26 p1 = Person(name='Daniel') 27 27 session.commit() 28 session. clear()28 session.expunge_all() 29 29 30 30 person = Person.query.first() … … 32 32 session.commit() 33 33 assert person.row_version == 2 34 session. clear()34 session.expunge_all() 35 35 36 36 person = Person.query.first() … … 38 38 session.commit() 39 39 assert person.row_version == 3 40 session. clear()40 session.expunge_all() 41 41 42 42 # check that a concurrent modification raises exception -
elixir/trunk/tests/test_order_by.py
r467 r490 52 52 53 53 session.commit() 54 session. clear()54 session.expunge_all() 55 55 56 56 … … 61 61 class TestOrderBy(object): 62 62 def teardown(self): 63 session. clear()63 session.expunge_all() 64 64 65 65 def test_mapper_order_by(self): -
elixir/trunk/tests/test_packages.py
r467 r490 38 38 39 39 session.commit() 40 session. clear()40 session.expunge_all() 41 41 42 42 a = A.query.one() -
elixir/trunk/tests/test_properties.py
r467 r490 39 39 40 40 session.commit() 41 session. clear()41 session.expunge_all() 42 42 43 43 for tag in Tag.query.all(): … … 57 57 58 58 session.commit() 59 session. clear()59 session.expunge_all() 60 60 61 61 for tag in Tag.query.all(): … … 99 99 100 100 session.commit() 101 session. clear()101 session.expunge_all() 102 102 103 103 category = Category.query.one() … … 122 122 123 123 session.commit() 124 session. clear()124 session.expunge_all() 125 125 126 126 for tag in Tag.query.all(): … … 166 166 167 167 session.commit() 168 session. clear()168 session.expunge_all() 169 169 170 170 # test the synonym itself (ie querying) … … 195 195 ) 196 196 197 session.commit(); session. clear()197 session.commit(); session.expunge_all() 198 198 199 199 p = Person.get_by(name='Alexandre da Silva') … … 204 204 205 205 u.email_address = 'new@z.com' 206 session.commit(); session. clear()206 session.commit(); session.expunge_all() 207 207 208 208 p = Person.get_by(name='Johann Felipe Voigt') … … 219 219 a1 = A(name='a1') 220 220 221 session.commit(); session. clear()221 session.commit(); session.expunge_all() 222 222 223 223 a = A.query.one() -
elixir/trunk/tests/test_sa_integration.py
r467 r490 42 42 session.add(b1) 43 43 session.commit() 44 session. clear()44 session.expunge_all() 45 45 46 46 b = session.query(B).one() … … 80 80 session.add(b1) 81 81 session.commit() 82 session. clear()82 session.expunge_all() 83 83 84 84 b = B.query.one() … … 114 114 115 115 session.commit() 116 session. clear()116 session.expunge_all() 117 117 118 118 b = B.query.one() … … 143 143 # 144 144 # session.commit() 145 # session. clear()145 # session.expunge_all() 146 146 # 147 147 # b = B.query.one() -
elixir/trunk/tests/test_versioning.py
r485 r490 62 62 description='draft description', director=gilliam) 63 63 bruce = Actor(name='Bruce Willis', movies=[monkeys]) 64 session.commit(); session. clear()64 session.commit(); session.expunge_all() 65 65 66 66 time.sleep(1) … … 74 74 assert movie.autoupd == 2, movie.autoupd 75 75 movie.description = 'description two' 76 session.commit(); session. clear()76 session.commit(); session.expunge_all() 77 77 78 78 time.sleep(1) … … 82 82 movie = Movie.get_by(title='12 Monkeys') 83 83 movie.description = 'description three' 84 session.commit(); session. clear()84 session.commit(); session.expunge_all() 85 85 86 86 # Edit the ignored field, this shouldn't change the version 87 87 monkeys = Movie.get_by(title='12 Monkeys') 88 88 monkeys.ignoreme = 1 89 session.commit(); session. clear()89 session.commit(); session.expunge_all() 90 90 91 91 time.sleep(1) … … 129 129 130 130 movie.revert_to(2) 131 session.commit(); session. clear()131 session.commit(); session.expunge_all() 132 132 133 133 movie = Movie.get_by(title='12 Monkeys') … … 137 137 138 138 movie.description = "description 3" 139 session.commit(); session. clear()139 session.commit(); session.expunge_all() 140 140 141 141 movie = Movie.get_by(title='12 Monkeys') 142 142 movie.description = "description 4" 143 session.commit(); session. clear()143 session.commit(); session.expunge_all() 144 144 145 145 movie = Movie.get_by(title='12 Monkeys') … … 147 147 movie.revert_to(movie.versions[-2]) 148 148 movie.description = "description 5" 149 session.commit(); session. clear()149 session.commit(); session.expunge_all() 150 150 151 151 movie = Movie.get_by(title='12 Monkeys')
