I have a situation wherein a change made to an attribute(a list) of a ZODB
obj, is not being recognized.I have set the _p_changed = 1.
But still the ZODB doesnt recognize the change.On debugging i realised that
the obj has the change and then i do a transaction.commit() and close the
database.But on reaccessing the database i realise that the change hasnt
been registered.
Could someone please help me out on this one

The code is ::::
s=open_zodb()
root=s[0]
if not root.has_key("Clubs"):
    root["Clubs"] = {}
ClubRoot=root["Clubs"]
if not root.has_key("Managers"):
    root["Managers"] = {}
ManagerRoot=root["Managers"]
if not root.has_key("Players"):
    root["Players"]={}
PlayerRoot=root["Players"]
if not root.has_key("Count"):
    root["Count"] = {}
CountRoot=root["Count"]


club=findclubsbyname(ClubRoot, 'MI')



print club.Players
list=addplayers(PlayerRoot, CountRoot, "b", 99, 100)
PlayerRoot=list[1]
CountRoot=list[0]
player=findplayerbyname(PlayerRoot, "b")
player.Club=club
playerset=[]
playerset.append(player)
playerset.append(player)
#club.Players.append(player)
club.makeclubplayerassociation(playerset)
ClubRoot[club.ClubID]=club

root['Players']=PlayerRoot
root['Clubs']=ClubRoot

transaction.commit()
close_zodb(s)


//open_zodb() is a function which just opens connection to the databse.
findclubsbyname returns a club object .
addplayers is a function which adds a player and returns PlayerRoot and
CountRoot
findplayerbyname returns a player object

every club object has an attribte Players which is a list.
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to