Hi,
I will try to expose my scenario:
I'am using sqlalchemy 0.3.10, Firebird 2.0.x and PyGtk for build a
desktop application in Windows XP.
I've a window form which contains a gtk TreeView (and many other
widgets). This is used for data entry in a master/detail structure.
Then, I've a mapper like this:
mapper(Detail, detail_table)
mapper(Master, master_table, properties={
'items': relation(Detail, cascade="all, delete-orphan")
}
)
Now, I input data in my form and items detail in my TreeView list.
This form have two options to access, insert and edit. When I use this
for insert I haven't problem here, because are all new objects (which
don't exists in database).
But, how can manage this for edit ?
How can I synch my Detail list object (Master.items) with my TreeView
object?
When I access by edit, I must do insert or delete on my TreeView.
Here, a little "pseudocode" like example:
# for insert:
master = Master()
# assign some data to master, reading from my form widgets
# load detail
for row in my_gtk_tree_list:
det = Detail()
# assign some data to det
master.items.append(det)
#------------------------------------------------
# for edit:
I can delete items on my tree view, and I must synchronize this with
my Master.items list
How can do it?
Because, if I do master.items = [], before re-load from tree list and
I populate all details all time, For instance,
# load detail
master.items = []
for row in my_gtk_tree_list:
det = Detail()
# assign some data to det from row
master.items.append(det)
But I get this exception when I do session.save.
ConcurrentModificationError: Updated rowcount 1 does not match number
of objects updated 6
----
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---