Hi,
I am having problems with saving/restoring mapped objects from a pylons
session.
I am getting the "no attribute" on a list attribute (which is a one-many
relationship) error when pylons tries to unpickle the object.
I've read a previous post where Michael explains why this happens.
I have turned off all lazy loaders.
This is my example:
class Invoice: pass
class InvoiceLine: pass
db.mapper(InvoiceLine, db.invoice_line_table)
db.mapper(Invoice, db.invoice_table,
properties = {
'client': relation(Client, lazy=True),
'lines': relation(InvoiceLine, lazy=True),
}
)
This works:
import pickle
i = Invoice()
pickle.dump(i, file('test', 'w'))
i = pickle.load(file('test'))
if I then do this
il = InvoiceLine()
i.lines.append(il)
pickle.dump(i, file('test', 'w'))
I get this:
File "/home/huy/apps/sqlalchemy/lib/sqlalchemy/orm/attributes.py", line
452, in __setstate__
AttributeError: type object 'Invoice' has no attribute 'lines'
How can I get around this problem ?
Thanks
Huy
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users