[Zope-CMF] Re: GenericSetup and Zope 2.8.5
Tres Seaver
tseaver at palladion.com
Sun Mar 26 14:14:41 EST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
robert rottermann wrote:
> Hi there,
> I started to look into GenerigSetup.
> Wat I would like to to is to replace functionalities we have in a
> similar product of our own (RedPick)
> with GernericSetup.
>
> Now my first question:
> Does GenericSetup work with Zope 2.8.5 at all?
>
> If yes:
> in an instance of class of which the the relevant part is attach at the
> end of this email
> I call XX.exportSiteToFile(..)
> It works insofar as I can call it from our tool (in a Plone 2.1.2 Site)
> and it
> does not generate any errors. However it does not produce any output.
>
> I debugged it as far as
> GenericSetup.utils.exportObjects
> ..
> exporter = zapi.queryMultiAdapter((obj, context), IBody)
> ..
> body = exporter.body
>
> body is None therefor nothing happens.
>
> Now my question:
> what do I have to do to get an exporter with a body?
>
>
> thanks
> robert
>
> Here the class definition:
>
> has_setup_tool = 0
> *try*:
> from Products import GenericSetup
> *try*:
> from Products.CMCore.exportimport import actions
> from Products.CMCore.exportimport import typeinfo
> has_setup_tool = 1
> *except*:
> /# verbatim copy of exportimport from/
> /# Plone.2.5 CMFCore /
> *try*:
> from Products.RedPick.exportimport import actions
> from Products.RedPick.exportimport import typeinfo
> has_setup_tool = 1
> *except*:
> *pass*
> *except*:
> *pass*
>
>
> *class* handle_action_properties( handle_base ):
> "RedPick handler for action properties."
>
> /# interface to CMFSetup/
> *def* exportSiteToFile( self, **kwargs ):
> "Export current site information to external file."
> /#return self.writeToFile( self.getFromSite( **kwargs ) )/
> *if* has_setup_tool:
> context =
> GenericSetup.context.DirectoryExportContext(self.portal.red_pick_tool,
> os.path.split(self.filename)[0])
> actions.exportActionProviders(context)
>
You need to register the IBody adapter for your content object. For
example, see the GenericSetup/PythonScripts/configure.zcml, which has:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
>
<adapter
factory=".exportimport.PythonScriptBodyAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for=".interfaces.IPythonScript
Products.GenericSetup.interfaces.ISetupEnviron"
/>
...
Tres.
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEJugh+gerLs4ltQ4RAsDlAKCFm2OYpD64cBm8ME93i9LiijFdaACgn3Cw
syxnyyMr4bRCBNP4hC7Pjss=
=G/Q+
-----END PGP SIGNATURE-----
More information about the Zope-CMF
mailing list