changeset 3389:df4f538f8e8f

moin xmlrpc write command: improve builtin docs, auto-append ?action=xmlrpc2
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 21 Mar 2008 12:51:01 +0100
parents 8ff8bc7dea20
children f1ba94b7913d
files MoinMoin/script/xmlrpc/write.py
diffstat 1 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/xmlrpc/write.py	Fri Mar 21 11:59:02 2008 +0100
+++ b/MoinMoin/script/xmlrpc/write.py	Fri Mar 21 12:51:01 2008 +0100
@@ -1,6 +1,6 @@
 # -*- coding: iso-8859-1 -*-
 """
-MoinMoin - page contents writer
+    MoinMoin - page contents writer
 
     @copyright: 2007 MoinMoin:JohannesBerg
     @license: GNU GPL, see COPYING for details.
@@ -21,18 +21,18 @@
 
 Detailed Instructions:
 ======================
-General syntax: moin [options] xmlrpc write [write-options]
-
-[options] usually should be:
-    --config-dir=/path/to/my/cfg/ --wiki-url=wiki.example.org/
+General syntax: moin xmlrpc write <targeturl> <username> <password> <pagename>
 
-[write-options] see below:
-    0. To edit the page 'FrontPage' on '192.168.0.1' using the username
-       'JohnSmith' and the password 'MyPass', changing the page contents
-       to 'This will be the new contents of the page!'
-       moin ... xmlrpc write 192.168.0.1 JohnSmith MyPass FrontPage
-       This will be the new contents of the page!
-       ^D
+Example:
+    To edit the page 'FrontPage' on 'http://wiki.example.org/' using the username
+    'JohnSmith' and the password 'MyPass', changing the page contents
+    to 'This will be the new contents of the page!' use:
+    moin xmlrpc write http://wiki.example.org/ JohnSmith MyPass FrontPage
+    This will be the new contents of the page!
+    ^D
+
+Note: we automatically append ?action=xmlrpc2 to the target url given.
+
 """
 
     def __init__(self, argv, def_values):
@@ -42,7 +42,7 @@
     # script entrypoint
     def mainloop(self):
         # grab parameters
-        url = self.argv[0]
+        url = self.argv[0] + '?action=xmlrpc2'
         user = self.argv[1]
         passwd = self.argv[2]
         pagename = self.argv[3]
@@ -51,7 +51,7 @@
         s = xmlrpclib.ServerProxy(url)
         token = s.getAuthToken(user, passwd)
 
-        if token == '':
+        if not token:
             print 'Invalid username/password'
             return