view MoinMoin/script/xmlrpc/ @ 5437:a20de9383481

fix --wiki-url examples, needs http:// now
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 16 Jan 2010 13:10:50 +0100
parents 2572688e031a
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
MoinMoin - remote command execution, client part

@copyright: 2006 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details.

import sys
import xmlrpclib

from MoinMoin.script import MoinScript, fatal

class PluginScript(MoinScript):
This tool allows you to execute moin scripts remotely.

Detailed Instructions:
General syntax: moin [options] xmlrpc remote [remote-options]

[options] usually should be:
    --config-dir=/path/to/my/cfg/ --wiki-url=

[remote-options] see below:
    0. Verify that you have a configuration file.

    1. To run the script 'account check' remotely.
       moin ... xmlrpc remote account check

    def __init__(self, argv, def_values):
        MoinScript.__init__(self, argv, def_values)
        self.argv = argv

    def mainloop(self):
            import remotescriptconf as conf
        except ImportError:
            fatal("Could not find the file Maybe you want to use the config param?")

        secret = conf.remotescript_secret
        url = conf.remotescript_url
        print url, secret, self.argv

        s = xmlrpclib.ServerProxy(url)

        # TODO handle stdin
        # xmlrpclib.Binary(
        result = s.RemoteScript(secret, self.argv)
        # TODO handle stdout, stderr

        if result != "OK":
            print >> sys.stderr, result