~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/xmlrpc/RemoteScript.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: iso-8859-1 -*-
 
2
"""
 
3
    MoinMoin - Remote Script Execution Server part
 
4
 
 
5
    @copyright: 2006 MoinMoin:ThomasWaldmann
 
6
    @license: GNU GPL, see COPYING for details.
 
7
"""
 
8
 
 
9
from MoinMoin import log
 
10
logging = log.getLogger(__name__)
 
11
 
 
12
from MoinMoin.script import MoinScript
 
13
 
 
14
def execute(xmlrpcobj, their_secret, argv):
 
15
    request = xmlrpcobj.request
 
16
    their_secret = xmlrpcobj._instr(their_secret)
 
17
 
 
18
    our_secret = request.cfg.remote_script_secret
 
19
    if not our_secret:
 
20
        return u"No password set"
 
21
 
 
22
    if our_secret != their_secret:
 
23
        return u"Invalid password"
 
24
 
 
25
    try:
 
26
        logging.info("RemoteScript argv: %r" % argv)
 
27
        MoinScript(argv).run(showtime=0)
 
28
    except Exception, err:
 
29
        logging.exception('An exception occurred.')
 
30
        return xmlrpcobj._outstr(str(err))
 
31
    return xmlrpcobj._outstr(u"OK")
 
32