Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.i18n.tools.po2wiki Namespace Reference

Functions

def run

Variables

string master_url = "http://master19.moinmo.in/?action=xmlrpc2"
string user = "ThomasWaldmann"
tuple password = os.environ.get("PASS", "")

Function Documentation

Definition at line 17 of file po2wiki.py.

00017 
00018 def run():
00019     excluded = ["en", ] # languages managed in repository, not in wiki
00020 
00021     lang = sys.argv[1]
00022 
00023     data = sys.stdin.read()
00024 
00025     if lang in excluded:
00026         f = open("%s.MoinMoin.po" % lang, "w")
00027         f.write(data)
00028         f.close()
00029         sys.exit(0)
00030 
00031     data = data.decode('utf-8')
00032 
00033     cutpos = data.index(u"msgid")
00034     data = data[cutpos:] # remove comments at top
00035 
00036     data = u"""\
00037 ## Please edit system and help pages ONLY in the master wiki!
00038 ## For more information, please see MoinMoin:MoinDev/Translation.
00039 ##master-page:None
00040 ##master-date:None
00041 #acl -All:write Default
00042 #format gettext
00043 #language %s
00044 
00045 #
00046 # MoinMoin %s system text translation
00047 #
00048 %s""" % (lang, lang, data)
00049 
00050 
00051     pagename = "MoinI18n/%s" % lang
00052     pagedata = data.encode('utf-8')
00053 
00054     wiki = xmlrpclib.ServerProxy(master_url)
00055     token = wiki.getAuthToken(user, password)
00056     mc = xmlrpclib.MultiCall(wiki)
00057     mc.applyAuthToken(token)
00058     mc.WhoAmI() # then we see in the result if auth worked correctly!
00059     mc.putPage(pagename, pagedata)
00060     mc.deleteAuthToken(token)
00061     result = mc()
00062     print "Page: %s rc=%r" % (pagename, list(result))


Variable Documentation

string MoinMoin.i18n.tools.po2wiki.master_url = "http://master19.moinmo.in/?action=xmlrpc2"

Definition at line 8 of file po2wiki.py.

tuple MoinMoin.i18n.tools.po2wiki.password = os.environ.get("PASS", "")

Definition at line 14 of file po2wiki.py.

string MoinMoin.i18n.tools.po2wiki.user = "ThomasWaldmann"

Definition at line 9 of file po2wiki.py.