I just upgrade to the last version of SQLAlchemy and Elixir.
Have a strange problem (I think it just a bug).
If add a row in a table with a Pickle attribute, keep this row and
modify the value of this attribute, there is no problem.
If add a row in a table, search this row and modify the value of this
attribute, my modification is not apply in commit.
Here is a example script:
----------------------------------------------
from elixir import __version__
print 'Elixir: ' + __version__
from sqlalchemy import __version__
print 'SQLAlchemy: ' + __version__
print "Start test..."
from elixir import *
class Category(Entity):
name = Field(PickleType)
metadata.bind = 'sqlite:///test.db'
setup_all()
create_all()
def test(cat):
cat.name['a'] = 'a'
assert cat.name == {'a': 'a'}
print "OK1"
session.commit()
assert cat.name == {'a': 'a'}
print "OK2"
print "test 1"
cat = Category(name={})
test(cat)
#reinit
cat.delete()
session.commit()
print "test 2"
Category(name={})
cat = Category.query.all()[0]
test(cat)
----------------------------------------------
Results:
# rm test.db; python test.py
Elixir: 0.7.1
SQLAlchemy: 0.7.2
Start test...
test 1
OK1
OK2
test 2
OK1
Traceback (most recent call last):
File "test.py", line 33, in <module>
test(cat)
File "test.py", line 21, in test
assert cat.name == {'a': 'a'}
AssertionError
----------------------------------------------
I don't have this behavior with other attribut type.
Regards,
--
Reply to myself ... I think it's a sqlalchemy change not a elixir
change.
>
--