~ubuntu-branches/ubuntu/gutsy/moin/gutsy

« back to all changes in this revision

Viewing changes to MoinMoin/script/old/xmlrpc-tools/wikirestore.py

  • Committer: Bazaar Package Importer
  • Author(s): Sivan Greenberg
  • Date: 2006-07-09 19:28:02 UTC
  • Revision ID: james.westby@ubuntu.com-20060709192802-oaeuvt4v3e9300uj
Tags: 1.5.3-1ubuntu1
* Merge new debian version.
* Reapply Ubuntu changes:
    + debian/rules:
      - Comment out usage of control.ubuntu.in (doesn't fit!).
    + debian/control.in:
      - Dropped python2.3 binary package.
    + debian/control:
      - Dropped python2.3 binary, again.
      - Dropped python2.3-dev from Build-Depends-Indep.
    + debian/patches/001-attachment-xss-fix.patch:
      - Dropped this patch. It's now in upstream's distribution.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
"""
 
3
This script reads a wikibackup.pickle file and puts
 
4
all Pages contained there into a wiki via xmlrpc.
 
5
We use wiki rpc v2 here.
 
6
 
 
7
Important note:
 
8
 
 
9
This script ONLY handles the current versions of the wiki pages.
 
10
 
 
11
It does NOT handle:
 
12
    * event or edit logs (page history)
 
13
    * old versions of pages
 
14
    * attachments
 
15
    * user account data
 
16
    * MoinMoin code or config running the wiki
 
17
    
 
18
So this is definitely NOT a complete restore.
 
19
 
 
20
GPL software, 2003-10-24 Thomas Waldmann
 
21
"""
 
22
def run():
 
23
    import xmlrpclib
 
24
    from MoinMoin.support.BasicAuthTransport import BasicAuthTransport
 
25
 
 
26
    user = "ThomasWaldmann"
 
27
    password = "xxxxxxxxxxxx"
 
28
    dsttrans = BasicAuthTransport(user,password)
 
29
    dstwiki = xmlrpclib.ServerProxy("http://devel.linuxwiki.org/moin--cvs/__xmlrpc/?action=xmlrpc2", transport=dsttrans)
 
30
    #dstwiki = xmlrpclib.ServerProxy("http://devel.linuxwiki.org/moin--cvs/?action=xmlrpc2")
 
31
 
 
32
    try:
 
33
        import cPickle as pickle
 
34
    except ImportError:
 
35
        import pickle
 
36
 
 
37
    backupfile = open("wikibackup.pickle","r")
 
38
    backup = pickle.load(backupfile)
 
39
    backupfile.close()
 
40
 
 
41
    allpages = backup.keys()
 
42
    for pagename in allpages:
 
43
        pagedata = backup[pagename]
 
44
        dstwiki.putPage(pagename, pagedata) # TODO: add error check
 
45
        print "Put %s." % pagename
 
46
 
 
47
if __name__ == "__main__":
 
48
    run()
 
49