genPersist (version 1.4.1, 18 August 2004) | index m:\projects\genesis-python\1.4.1\genpersist.py |
Modules for joining Genesis 2000 scripting and the Python scripting language.
This module provides a persistency framework for the Genesis-Python interface.
Arbitrary Python objects may be stored directly into the Genesis job structure...placed
into a storage bucket, which ends up being the misc directory...
This arbitrary Python object can then be read back into memory during a later
session, thus providing a simple multi-session persistency model. One of the storage
formats is XML, used if the bucket is instantiated as an instance of XmlBucket.
By default, the XmlBucket is used if gnosis.xml.pickle is installed. You may choose
to modify that behaviour, however.
This model provides NO concurrency control, as it should generally not be needed.
Usage:
>>> job = genClasses.Job('test_job')
>>> job.open()
>>> myDict = {'thiskey': 22.354, 'thatkey': 16.402, 'otherkey': (1,0,0,3)}
>>> job.bucket.put(myDict, 'map_dict')
... days later ...
>>> job = genClasses.Job('test_job')
>>> job.open()
>>> myDict = job.bucket.get('map_dict')
>>> print myDict
{'thiskey': 22.354, 'thatkey': 16.402, 'otherkey': (1,0,0,3)}
NOTES:
- Some special Python objects are not supported by this persistence model...specifically,
genClasses.Job objects cannot be saved due to their special handling of __getattr__ calls.
- In order to use the XmlBucket class, the gnosis.xml modules must be installed. You can get
them from http://www.gnosis.cx/download/Gnosis_Utils-current.tar.gz and installed using distutils.
(
e.g. untar the stuff, cd to the directory and run
python setup.py build
python setup.py install
)
Modules | ||||||
|
Classes | ||||||||||||||||||
|
Data | ||
ENGINE = 'XML' __author__ = 'Mike J. Hopkins' __credits__ = ' Guido ... and David Mertz for gnosis.xml.pickle' __date__ = '18 August 2004' __version__ = '$Revision: 1.4.1 $' |
Author | ||
Mike J. Hopkins |
Credits | ||
Guido ... and David Mertz for gnosis.xml.pickle |