Package: collective.plone.gsxml
collective.plone.gsxmlAn XML import/export add-on forPlone.Installationcollective.plone.gsxmlis a egg, so installation is easy
if you use buildout.  You just need to addcollective.plone.gsxmlto your plone part’seggsANDzcmloption.A example buildout is available here:https://svn.plone.org/svn/collective/gsxml/buildout/trunkThis package needslxml, see the buildout example.UsageAfter installation, you’ll get two new items in Plone’sactionmenu, one forimport, and one forexport.  For additional stuff,
please see the detailled documentation below.FeaturesExports virtually all Archetypes-based documentsexports and keeps referencesexports binary data as separate fileworks with ZOPE blobssends custom events which you can subscribe to prior and after
import/exportuses the ZCA to fetch a serializer for a content type – the default
adapter uses the Plone MarshallerCaveatsThis package relies pretty much on theMarshallproduct for plone
(which is shipped with Plone).  This product, is, while offering great
functionality, a bit convoluted and does not allow to hook in using
the ZCA.Also, this package tries to exportreferences, and this is
currently done using pickles, which is not safe.  References should be
exported by using adapters defined by those who actually use the
references and know how to export them (it’s impossible to do this in
a generic way IMHO).Bugsexports references using picklesmesses with the internals of the Marshal product due to lack of
hooksuses pickles, this is not securemanifest XML is not yet parsedAnnoyancesconvoluted code. The code of this package needs cleanup. This will
be done in due course.CaveatsThis package out-of-the-box export AT based content only, but you
can provide your own serializer as adapterThis package does NOT export dynamically marked interfacesThis package does NOT export annotations on contentProducts.PoiYou need the branch version of Products.Marshall to handle the DataGridFieldshttps://svn.plone.org/svn/archetypes/Products.Marshall/branches/use-zca-in-atnsProducts.eXtremeManagementchange line 44 of Products.eXtremeManagement.content.PoiTask to:def getAssignees(self):
     managers = set()
     try:
         for issue in self.getRefs('task_issues'):
             managers.add(issue.getResponsibleManager())
     except:
         pass
     return sorted(list(managers))because the references to the POI issues are fixed on the end of import and arenotavailable when the object is recreated::vim: set ft=rst ts=4 sw=4 expandtab tw=78 :Change historyHEAD0.4.7 (2008-12-19)Fixed reference handling after import [ramonski]0.4.6 (2008-12-16)Fixed tests and moved them into the source package. [seletz]Added fix forPloneArticle.
Thanks to Freshmilk Entertainment GmbH for sponsoring this.
[seletz]Added a events notified forObjectWillBeExportedEvent,ObjectExportedEvent,ObjectWillBeImportedEventandObjectImportedEvent.
[seletz]Addedlxmlandlibxml2-pythonto the buildout.  Added ZOPE-enabled
ipython to the buildout. [seletz]Changes package layout to have the sources undersrc– this
allows to have the buildout include development packages during
development [seletz]Fix bug wrt. handling of blob fields.  These are now treated like the file
fields. [seletz]Addedplone.app.blobto buildout to test for #10 [seletz]Switched buildout to plone 3.2a1 [seletz]0.4.5 (2008-06-23)More importview work. [seletz]Added missing file. [seletz]Fix typo [seletz]Detailed DocumentationExporting contentTo test exporting some content, we’ll create content:>>> _ = self.folder.invokeFactory("Folder", "content")
>>> folder = self.folder["content"]
>>> _ = folder.invokeFactory("Document", "doc1", title="A Document")
>>> _ = folder.invokeFactory("Document", "doc2", title="A second Document")
>>> folder.keys()
['doc1', 'doc2']Now we create aexport context– this will act like a container
holding the exported data.  We’ll use theTarballExportContexthere:>>> from collective.plone.gsxml.context import TarballExportContext
>>> export_context = TarballExportContext()Now we create a exporter object, which will use the export context
created above to store the export data, and use the Marshaller to
actually marshall content.  We initialize the exporter with therootfolder which we want to export:>>> from collective.plone.gsxml.content import XMLContentFSExporter
>>> exporter = XMLContentFSExporter(folder)Now we’re able to start the export.  We supply theexport contextand a folderinside the export context(thus, one export context can
be used multiple times by supplying different root folders).  We also
specify that this is a root-level export:>>> exporter.export(export_context, "structure", True)Ok, that’s it.  The archive stream may now be fetched from the export
context:>>> archive = export_context.getArchiveStream()
>>> archive.seek(0)Importing contentTo test importing, we’ll delete the objects exported above:>>> folder.manage_delObjects(['doc1', 'doc2'])
>>> folder.keys()
[]Now we create aimport context, which will hold our exported
stream, and a importer, which will use that import context to read
marshalled data from:>>> from collective.plone.gsxml.context import TarballImportContext
>>> import_context = TarballImportContext(archive)The importer – we initialize the importer with thetargetfolder:>>> from collective.plone.gsxml.content import XMLContentFSImporter
>>> importer = XMLContentFSImporter(folder)Now we start the import. We supply theimport contextand the root
folderwithinthe import context.  Also, we indicate that this is
indeed a root-level import:>>> importer.import_(import_context, "structure", True)We’re now able to get the documents again:>>> folder.keys()
['doc1', 'doc2']
>>> folder.doc1.Title()
'A Document'Contributors(in no particular order. These are the nicks on #plone)fschulzemagnonramonskiseletzhannoschwitschDownload