Hi all,
I've just commited in Soya's Subversion a full support for Cerealizer, a secure
pickle-like module (http://home.gna.org/oomadness/en/cerealizer/index.html).
One can now use Cerealizer everywhere Soya was using cPickle.
However cPickle is still the default (although this will probably change in
futur version; to enable Cerealizer you must do:
import cerealizer, soya.cerealizer4soya
soya.set_file_format(cerealizer.dumps)
Then, any file saved by calling the "save()" method will be saved by Cerealizer
(you can verify that by opening the file and check if it starts by "cereal1").
In addition, Soya is currently able to read BOTH cPickle and Cerealizer files
(however this may not be the default in future version). To convert all your
files from cPickle to Cerealizer, you just have to load and save them (I'm
going to write a script for that).
If you want to be sure that cPickle is used, you should do:
import cPickle
soya.set_file_format(cPickle.dumps)
There are 2 noticeable differences between cPickle and Cerealizer:
* Cerealizer is safe, and thus you have to declare which classes are safe for
saving, as following:
cerealizer.register(YourSafeClass)
(for Soya classes, such as Volume or World, importing soya.cerealizer4soya
does the job for you)
* When using Cerealizer, Soya doesn't save textures in Materials (contrary to
what soya does with cPickle), but only the texture's image filename. It results
in much smaller Material files, but you have to distribute the image files as
well.
I've also modified blender2soya.py so as it can export to Cerealizer
(auto-exporter takes care of file format automagically).
Finally, loading Cerealizer file is safe as long as the registered classes'
__new__, __del__, __getstate__ and __setstate__ are safe. I'm thus going to
review all soya's __new__, __del__, __getstate__ and __setstate__ in order to
be sure that they are really safe (as usually, any help is welcome :-).
Jiba
_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user