Back to index

moin  1.9.0~rc2
RemoteScript.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - Remote Script Execution Server part
00004 
00005     @copyright: 2006 MoinMoin:ThomasWaldmann
00006     @license: GNU GPL, see COPYING for details.
00007 """
00008 
00009 from MoinMoin import log
00010 logging = log.getLogger(__name__)
00011 
00012 from MoinMoin.script import MoinScript
00013 
00014 def execute(xmlrpcobj, their_secret, argv):
00015     request = xmlrpcobj.request
00016     their_secret = xmlrpcobj._instr(their_secret)
00017 
00018     our_secret = request.cfg.secrets['xmlrpc/RemoteScript']
00019 
00020     if our_secret != their_secret:
00021         return u"Invalid password"
00022 
00023     try:
00024         logging.info("RemoteScript argv: %r" % argv)
00025         MoinScript(argv).run(showtime=0)
00026     except Exception, err:
00027         logging.exception('An exception occurred.')
00028         return xmlrpcobj._outstr(str(err))
00029     return xmlrpcobj._outstr(u"OK")
00030