annotate MoinMoin/xmlrpc/RemoteScript.py @ 6106:b59ee217581c

remove MoinMoin.support.HeaderFixed assuming it is fixed in 2.7. no idea what the problem was, comments unhelpful.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 06 Sep 2016 01:52:01 +0200
parents e5a9570d3001
children
rev   line source
934
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - Remote Script Execution Server part
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 934
diff changeset
5 @copyright: 2006 MoinMoin:ThomasWaldmann
934
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 """
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8
3127
ea5383222f2f refactored misc. modules to use own logger instead of request.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
9 from MoinMoin import log
ea5383222f2f refactored misc. modules to use own logger instead of request.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
10 logging = log.getLogger(__name__)
ea5383222f2f refactored misc. modules to use own logger instead of request.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
11
934
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 from MoinMoin.script import MoinScript
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 def execute(xmlrpcobj, their_secret, argv):
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 request = xmlrpcobj.request
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16 their_secret = xmlrpcobj._instr(their_secret)
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17
3873
e5a9570d3001 secrets configuration refactored - see the snippet for an example usage
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3157
diff changeset
18 our_secret = request.cfg.secrets['xmlrpc/RemoteScript']
934
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 if our_secret != their_secret:
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 return u"Invalid password"
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 try:
3127
ea5383222f2f refactored misc. modules to use own logger instead of request.log
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
24 logging.info("RemoteScript argv: %r" % argv)
934
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25 MoinScript(argv).run(showtime=0)
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26 except Exception, err:
3157
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3127
diff changeset
27 logging.exception('An exception occurred.')
b8cb12fa571b logging: using more logging.exception
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3127
diff changeset
28 return xmlrpcobj._outstr(str(err))
934
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 return xmlrpcobj._outstr(u"OK")
9dcfb8f36524 call scripts remotely, ScriptRequest infrastructure (unfinished)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30