Archive for November, 2006|Monthly archive page

Crossing Alaska for KiKa

Crossing Alaska for KiKaCancer has devastating effects on people. Children are not spared from its horrors. Fortunately organisations like KiKa exist which try to make a difference. To raise money for KiKa a team is going to cross Alaska. They maintain their website using our favorite CMS; Plone. It is nice to work at a company which helps to make nice sites like this come into existence. Check out the site: Crossing Alaska for KiKa.

Advertisements

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

PAS human sniffer plugin

After the Seattle Plone Conf I had an idea how to implement a simple Pluggable Auth Service plugin to make authenticated RSS feeds accessible to desktop clients. The main problem with desktop RSS readers is that they need something like basic auth instead of a login form.

My first attempt was writing a challenger plugin which differentiated on user agent headers. This was not the most optimal sollution according to wiggy.

He advised me to create a protocol sniffer. So of I went and changed the plugin. It is now a proper protocol sniffer. This adds a protocol named Human Browser to the set of protocols. Using the challenger chooser you can set this protocol to use cookie auth. The normal browser protocol should then be set to http auth.

The plugin still uses the user agent header to detect if it is dealing with a human controlled browser. You can add browsers to this using a subscriber (look at detectors.py).