librelist archives

« back to archive

flask sqlalchemy fixtures error.

flask sqlalchemy fixtures error.

From:
maplye
Date:
2012-05-23 @ 23:12
I according to the demo: https://gist.github.com/824472
But I got the below errors:
flask version: 0.8


======================================================================
ERROR: test_spam (__main__.ModelsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_models.py", line 21, in setUp
    fixtures.install(self.app, *fixtures.all_data)
  File "D:\Develop\Python\opensource\Flask\testing-fixtures\fixtures.py",
line 1
1, in install
    data.setup()
  File "D:\Develop\Python\env\flask\lib\site-packages\fixture\base.py",
line 71,
 in setup
    self.loader.load(self.data)
  File
"D:\Develop\Python\env\flask\lib\site-packages\fixture\loadable\loadable.
py", line 193, in load
    self.wrap_in_transaction(loader, unloading=False)
  File
"D:\Develop\Python\env\flask\lib\site-packages\fixture\loadable\loadable.
py", line 315, in wrap_in_transaction
    self.commit()
  File
"D:\Develop\Python\env\flask\lib\site-packages\fixture\loadable\sqlalchem
y_loadable.py", line 149, in commit
    self.session.flush()
  File
"D:\Develop\Python\env\flask\lib\site-packages\sqlalchemy\orm\session.py"
, line 1587, in flush
    self._flush(objects)
  File
"D:\Develop\Python\env\flask\lib\site-packages\sqlalchemy\orm\session.py"
, line 1658, in _flush
    flush_context.execute()
  File
"D:\Develop\Python\env\flask\lib\site-packages\sqlalchemy\orm\unitofwork.
py", line 331, in execute
    rec.execute(self)
  File
"D:\Develop\Python\env\flask\lib\site-packages\sqlalchemy\orm\unitofwork.
py", line 475, in execute
    uow
  File
"D:\Develop\Python\env\flask\lib\site-packages\sqlalchemy\orm\persistence
.py", line 67, in save_obj
    states_to_insert, states_to_update)
  File
"D:\Develop\Python\env\flask\lib\site-packages\sqlalchemy\orm\persistence
.py", line 702, in _finalize_insert_update_commands
    mapper.dispatch.after_insert(mapper, connection, state)
  File "D:\Develop\Python\env\flask\lib\site-packages\sqlalchemy\event.py",
line
 291, in __call__
    fn(*args, **kw)
  File
"D:\Develop\Python\env\flask\lib\site-packages\sqlalchemy\orm\events.py",
 line 363, in wrap
    return wrapped_fn(*arg, **kw)
  File "D:\Develop\Python\env\flask\lib\site-packages\flask_sqlalchemy.py",
line
 163, in after_insert
    return self._record(mapper, instance, 'insert')
  File "D:\Develop\Python\env\flask\lib\site-packages\flask_sqlalchemy.py",
line
 170, in _record
    orm.object_session(model)._model_changes[pk] = (model, operation)
AttributeError: 'SessionMaker' object has no attribute '_model_changes'

----------------------------------------------------------------------
Ran 2 tests in 0.578s

FAILED (errors=2)