[Zope] Automatically import a zexp

Florent Guillaume fg@nuxeo.com
Mon, 28 Jan 2002 00:03:32 +0000 (UTC)


> 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.

You could simply use something like what load_site is doing, namely:

    import ZPublisher.Client
    ob=ZPublisher.Client.Object(url, username=user, password=password)
    ob.manage_somethingOrOther(id=name, file=open(fname, 'rb'))

Or even, without starting Zope:

    import Zope
    root = Zope.app()
    ob = root.path.to.your.object
    ob.manage_blabla
    get_transaction().commit()

All untested of course :-)


Florent
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 10  http://nuxeo.com  mailto:fg@nuxeo.com