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. I have also tried to implement
__setstate__,
but not sure what I should be doing in there.
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---