~ubuntu-branches/ubuntu/intrepid/moin/intrepid-updates

« back to all changes in this revision

Viewing changes to MoinMoin/wikixml/wikiexport.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-02-14 16:09:24 UTC
  • mfrom: (0.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20060214160924-fyrx3gvknzqvt4vj
Tags: 1.5.2-1ubuntu1
Drop python2.3 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: iso-8859-1 -*-
2
 
"""
3
 
    MoinMoin - XML Export
4
 
 
5
 
    This module exports all data stored for a wiki.
6
 
 
7
 
    @copyright: 2001-2004 by J�rgen Hermann <jh@web.de>
8
 
    @license: GNU GPL, see COPYING for details.
9
 
"""
10
 
 
11
 
from MoinMoin import wikixml
12
 
import MoinMoin.wikixml.util
13
 
 
14
 
#############################################################################
15
 
### XML Generator
16
 
#############################################################################
17
 
 
18
 
class ExportGenerator(wikixml.util.XMLGenerator):
19
 
    default_xmlns = {
20
 
        None: "http://purl.org/wiki/moin/export",
21
 
    }
22
 
 
23
 
    def __init__(self, out):
24
 
        wikixml.util.XMLGenerator.__init__(self, out=out)
25
 
 
26
 
    def startDocument(self):
27
 
        wikixml.util.XMLGenerator.startDocument(self)
28
 
        self.startElementNS((None, 'export'), 'export', {})
29
 
 
30
 
    def endDocument(self):
31
 
        self.endElementNS((None, 'export'), 'export')
32
 
        wikixml.util.XMLGenerator.endDocument(self)
33
 
 
34
 
 
35
 
#############################################################################
36
 
### WikiExport class
37
 
#############################################################################
38
 
 
39
 
class WikiExport:
40
 
    """ Create an XML document containing all information stored in a wiki.
41
 
    """
42
 
 
43
 
    def __init__(self, out, **kw):
44
 
        """ Write wiki data to stream `out`.
45
 
 
46
 
            Keywords:
47
 
                public - true when this is a public export (no userdata etc.)
48
 
        """
49
 
        self._out = out
50
 
        self._public = kw.get('public', 1)
51
 
 
52
 
    def run(self):
53
 
        """ Start the export process.
54
 
        """
55
 
        self.doc = ExportGenerator(self._out)
56
 
        self.doc.startDocument()
57
 
        # TODO: pages, users, attachments
58
 
        self.doc.endDocument()
59