view MoinMoin/scripts/xmlrpc-tools/UpdateGroupTest.py @ 491:be33ecd58d4e

add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc imported from: moin--main--1.5--patch-495
author Thomas Waldmann <tw@waldmann-edv.de>
date Wed, 22 Mar 2006 09:55:32 +0000
parents 77665d8e2254
children
line wrap: on
line source
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script is just an example how to update a group definition page using xmlrpc.

GPL software, 2005 Thomas Waldmann
"""
def run():
    import sys
    sys.path.insert(0, '../../..')

    import xmlrpclib
    from MoinMoin.support.BasicAuthTransport import BasicAuthTransport

    user = "XmlRpc"
    password = "wrong"
    dsttrans = BasicAuthTransport(user, password)
    mywiki = xmlrpclib.ServerProxy("http://enterprise.wikiwikiweb.de:8888/?action=xmlrpc2", transport=dsttrans)

    groupname = "TestGroup"
    groupdesc = "This is just a test."
    groupmembers = ["TestUser1", "TestUser2",]
    print mywiki.UpdateGroup(groupname, groupdesc, groupmembers)

    groupname = "TestAclGroup"
    groupdesc = "This is just a test."
    groupmembers = ["TestUser3",]
    print mywiki.UpdateGroup(groupname, groupdesc, groupmembers, "All:read,write,delete,revert")

    del mywiki
    del dsttrans

    user = "XmlRpc"
    password = "completelywrong"
    dsttrans = BasicAuthTransport(user, password)
    mywiki = xmlrpclib.ServerProxy("http://enterprise.wikiwikiweb.de:8888/?action=xmlrpc2", transport=dsttrans)

    groupname = "TestGroup"
    groupdesc = "This is just a test."
    groupmembers = ["WrongUser1", "WrongUser2",]
    print mywiki.UpdateGroup(groupname, groupdesc, groupmembers)


if __name__ == "__main__":
    run()