view MoinMoin/scripts/xmlrpc-tools/get_es_pages.py @ 491:be33ecd58d4e

add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc imported from: moin--main--1.5--patch-495
author Thomas Waldmann <tw@waldmann-edv.de>
date Wed, 22 Mar 2006 09:55:32 +0000
parents 77665d8e2254
children
line wrap: on
line source
""" get some pages from another wiki """

def run():
    import sys, os, xmlrpclib, codecs

    sys.path.insert(0, "..")
    from MoinMoin import wikiutil

    s = xmlrpclib.ServerProxy("http://wainu.ii.uned.es/wainuki/?action=xmlrpc2")
    index = open("index")

    for l in index:
        d = l.split('||')
        pn = d[3].strip()
        pd = s.getPage(pn)
        dn = wikiutil.quoteWikinameFS(pn.decode("utf-8"))
        os.mkdir(dn)
        cn = os.path.join(dn,'current')
        f = open(cn,'w')
        f.write('00000001\n')
        f.close()
        dn2 = os.path.join(dn, 'revisions')
        os.mkdir(dn2)
        fn = os.path.join(dn2,'00000001')
        f = codecs.open(fn,"wb","utf-8")
        pd = pd.replace('\n','\r\n')
        f.write(pd)
        f.close()

if __name__ == "__main__":
    run()