Updating a Confluence Wiki with a script
In the process of creating a wikified version of the LKSF, i had the problem of importing all those files into the Wiki. As wikis.sun.com is based on the Atlassian Confluence i couldn´t use the already available scripts for Mediawiki for example . I wasn´t really fond of the idea to do this manually, thus i´ve asked via Twitter for a solution and i´ve got a hint for the xmlrpc interface. At the end, i´ve created a script with stolen … sorry … copied components of many other scripts (like this one or this one). My script compares the current version with the new version, uploads the new version and creates new pages if nescessary.It takes three command line parameters: the name of the Wikipage, the name of the space (something like a subwiki or a administrative domain in Confluence) and the file you want to upload. Sorry for the programming style … python isn´t really my native programming language, but the xmlrpc is solved really good in python and it was a good reason to refresh my really rusty python skills.
Okay … let´s get to the usage. For example:
This uploads the file sat/lksf_sat_crashcore.tex.wikified
into the space lksf
with the page name sat.lksf_sat_crashcore.tex
>. This leads to the wiki page http://wikis.sun.com/display/lksf/sat.lksf_sat_crashcore.texNow to the source of the script export.py
:
Just in case you wonder because of this “BREAKBREAKBREAK” line. It´s just for debugging purposes. As i wrote yesterday, the xmlrpc is a little bit bitchy about charsets and the error message wasn´t helpful. It was easier to find the problem by bisecting the file again and again. And this was done by the “BREAKBREAKBREAK” line ;)