[Zope] persistence

jiri stepan zope@etnetera.cz
Tue, 06 Jul 1999 13:09:56 +0200


Hello
I'm trying to work with persistent objects in a PickleDictionary. The
objects are not writen into database file - they exists only in memory
and they are not persistent. I don't know how to commit new changes.

Python code:

...

db=BoboPOS.PickleDictionary(db_loc+"databaze2")
if db.has_key('customers_db'):
	customers=db['customers_db']
else:
	customers=db['customers_db']=Customers() 
	customers.addCustomer('hu','sdf','dsf','sdf','df') #this is test 
							   # -works-
	get_transaction().commit()

#ok - this works customer, which is added here is persistent

..but later ..

class AdressBook(
    OFS.SimpleItem.Item,
    Persistent,
    Acquisition.Implicit,
    AccessControl.Role.RoleManager,
    ):
    ....
    def manage_addZakaznik(self,id,firstname,surname,tel,note,
REQUEST=None):
	""" adds a new customer into persistent storage 
	    and writes the message
	"""
	
	if REQUEST is not None:      	
    	    
	    customers.addZakaznik(id,firstname,surname,tel,note)
	    get_transaction().commit()

	    return MessageDialog(
		title='Added',
		message='zakaznik byl pridan.' ,
		action ='./manage_main',
		)
#this customer is added into the object 'customers' and I can work with
it, but it isn't persistent - after Zope's restart is lost.

------------

Thank's for any informations


Jiri Stepan
(zope@etnetera.cz)