Filtered exportObjects
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
On Mon, May 28, 2001 at 06:13:21PM +0200, Peter Bengtsson wrote:
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.
... Does anybody have a good solution? Or something to give me a better start.
Just use ZShell: find / --type Photo --exec "export {}" then all your photos will in in Zope's var directory as .zexp files. man export man find bye, PS: The CVS code works fine with such a command, just tell me if yours doesn't. Jerome Alet
On Mon, May 28, 2001 at 06:13:21PM +0200, Peter Bengtsson wrote:
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.
... Does anybody have a good solution? Or something to give me a better start.
Just use ZShell:
find / --type Photo --exec "export {}"
No that did not work. I created a folder called "dummy". Filled it with Images and DTML Documents and subfolders with Images. Command: find /dummy --type Image --exec "export {}" Results: Object /dummy/subfolder/Athlete.jpg exported to server as Athlete.jpg.zexp Object /dummy/Apap.jpg exported to server as Apap.jpg.zexp But this is not true. In my <zope>/var directory these ZEXP files don't exist. BUT, dummy.zexp and subfolder.zexp do. Importing these and you get back to what you had before, except that dummy.zexp already contains the subfolder object. ZShell v1.0pre3 Should I upgrade? Can you suggest a different command? Peter
then all your photos will in in Zope's var directory as .zexp files.
man export man find
bye,
PS: The CVS code works fine with such a command, just tell me if yours doesn't.
Jerome Alet
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Tue, 29 May 2001, Peter Bengtsson wrote:
Just use ZShell:
find / --type Photo --exec "export {}"
No that did not work. I created a folder called "dummy". Filled it with Images and DTML Documents and subfolders with Images.
Command: find /dummy --type Image --exec "export {}" Results: Object /dummy/subfolder/Athlete.jpg exported to server as Athlete.jpg.zexp Object /dummy/Apap.jpg exported to server as Apap.jpg.zexp
But this is not true.
You're right, I've tested with the same version and this didn't work. In fact it worked, sometimes... Now it works fine, I've tested it here with no problem and the same command, just download ZShell v1.1 which I've just put online at: http://cortex.unice.fr/~jerome/zshell/
Should I upgrade? Can you suggest a different command?
yes. no. I've tried it here, seems to be ok with ZShell 1.1 This has made me think about adding "NOTarguments", I'll do that in a future version, so you will be able to export all objects which are NOT Images (for example). hoping this will help. Jerome Alet
This has made me think about adding "NOTarguments", I'll do that in a future version, so you will be able to export all objects which are NOT Images (for example).
Yeah, this is very important, otherwise I would have to list all meta_types that are not Photos or Images or whatever. When can I expect to see this? peter
hoping this will help.
Jerome Alet
On Tue, 29 May 2001, Peter Bengtsson wrote:
This has made me think about adding "NOTarguments", I'll do that in a future version, so you will be able to export all objects which are NOT Images (for example).
Yeah, this is very important, otherwise I would have to list all meta_types that are not Photos or Images or whatever. When can I expect to see this?
soon, but not very. probably by the end of this week or beginning of next week. I've already done similar things in C in a previous life, so this should be easy. Unfortunately I've got something important to do these days... bye, Jerome Alet
participants (2)
-
Jerome Alet -
Peter Bengtsson