[Zope] Filtered exportObjects

Peter Bengtsson mail@peterbe.com
Mon, 28 May 2001 18:13:21 +0200


On my site I have quite a lot of Photo's meta_type=['Photo'] and they cause
the zexp file to become very very very big (currently 86 Mb for 180 Photos).
I would like to export my whole site but skip certain paths or meta types.

The best way would be to write a little External Method or Python Script
that calls manage_exportObjects() with a filtered object.

I just need help to create the new copied object.
I tried something like this:
copy_of_self = self.copy.__deepcopy__()
self.manage_exportObjects(filterbymetatypes(copy_of_self, ['Photo']) )

but copy woun't let me do that.

if I had a copy of the object to be specially exported I could...:

def fliterbymetatypes(object, metatypes=[]):
    objects = object.objectValues()
    for obj in objects:
        if obj is isPrincipiaFolderish():
           # go further
           filterbymetatypes(obj, metatypes)
        elif obj.meta_type in meta_types:
            object.manage_delObjects([str(obj.id)])

...or something like that (syntax might be bad, but you get the idea)

Does anybody have a good solution? Or something to give me a better start.

Peter