[Zope] Automatically import a zexp

entheos@entheossoft.com entheos@entheossoft.com
Tue, 22 Jan 2002 09:56:57 -800


Andreas,
To do this, zope needs to be running.  If that is the case, then just copy the .zexp or xml file to the imports directory and make the appropriate xml-rpc call:
http://www.zope.org/Members/Amos/XML-RPC

To make an xml-rpc call without using python look at the bottom of this page:
http://developer.kde.org/documentation/kde2arch/xmlrpc.html

You'll also need to figure out how to do base64 encoding for the password, which is described in Amos' HOWTO above.  Using perl for that would make it more debianish, since dpkg (or is it apt) depends on perl.

To bad you aren't doing this TTW - you could use the ZImporter :)
http://www.zope.org/Members/tfarrell/ZImporter/
(It even works with 2.4.3 - I just imported an 18MB xml file TTW)

Any method of doing this when zope is not running will need access to the ZODB code in the Zope/lib/python directory, so that will need to be in the python path, unless you choose to rewrite the ZODB access code for scratch :)

A few thoughts.
Troy
--
Troy Farrell
Developer
Entheos Software
mailto:troy@entheossoft.com
http://www.entheossoft.com

> Hello,
> 
> as a Debian maintainer I wonder if there is any clean method to import
> zexp products by a script (not using the import method from a browser).
> The idea is that installing Python products is simple by copying the
> python code to the right place and restart zope.  Works fine in the
> Debian postinst script.
> But what to do with zexp products.  I tried a very dirty hack like
> 
> 
> 
> ZOPEUSER="<place the name of Zope administrator here>"
> PASSWD="<and his password>"
> ## For sure this is insecure.
> ## You should find a secure way using debconf to maintain this!!!!
> 
> IMPORT=<product-name>.zexp
> 
> LC_ALL=en_EN
> 
> HOST=localhost
> PORT=9673
> 
> wget --proxy=off --http-user=${ZOPEUSER} --http-pass=${PASSWD} \
>    
> http://${HOST}:${PORT}/Control_Panel/Products/${prod}/manage_importObject?f
> ile=${IMPORT}
> 
> 
> but I think I really do not have to tell you that this can not be the
> recommended way to go.
> 
> Any other idea?
> 
> Kind regards
> 
>          Andreas.