Publishing XML with Plone

Integrating Plone with external systems always seems to cost more effort than it really should. In the past I have integrated Plone with ERP systems using CSV exports, IBM DB2 databases with text dumps, VCARD import’s from a CRM system and also some relational databases. Fortunately the story for relation databases is improving. Of course this only works with databases you can access directly.

Because writing synchronisation scripts is not only very tedious but also very error prone I wanted to fix this once and for all. One of the lessons I learned from previous experiences is not to try to sync everything in one step. Converting the data to an intermediate format you understand and is under your own control gives a lot of advantages.

This post is not going to go on with complaining about all the troubles with external systems. The reason is I made something which should solve it (or solves it for me). You can take a look at the code in the collective. What enables you to do is create a simple piece of content in Plone. In this content you can specify a location on the filesystem you want to publish. When you traverse the piece of content it reads the XML with the same name from the filesystem and wrap it in a proxy. This proxy is then decorated with a view ready for publishing. And the nice thing is it can publish any piece of XML you can think of.

Well that is not completely true, there has to be one little thing in there. The XML must have declare an interface. This interface is an identifier for an Zope 3 interface. It is this interface that is used when looking up views etc.

Another nice thing is that the proxy can also delegate calls it does not understand. This allows it to play nice with the ZCatalog by diverting all queries for Title etc. to a specific adapter.

One word of caution is order before you get to excited, this code is not used in production. It is not finished yet and last but not least there is a problem running all tests simultaniosly. This has to do with a hack I stuck in to make PloneTestCase work with Zope 2.9 and pythonproducts. They should work without failing if you run them one at a time.

Comments on the architecture, system as a whole etc. are greatly appreciated. I hope some more people will find a use for this (or tell me why I am going at it the wrong way). Oh, before I forget it, tips for a better name are also welcome (it is called xmlcontent for now).


1 comment so far

  1. miziodel on

    I found your work wondering about in collective, and it looks really very promising.. hope to have some time to go deeply into it, giving you some feedback!

    please, create a product on for this, to let people discover your work šŸ™‚

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: