view MoinMoin/script/xmlrpc/ @ 3108:2572688e031a

improved moin script's builtin help function, thanks to Federico Lorenzi (ported from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 23 Feb 2008 23:40:48 +0100
parents 3d08f1cb4429
children a20de9383481
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
MoinMoin - MailImport script

@copyright: 2006 MoinMoin:AlexanderSchremmer
@license: GNU GPL, see COPYING for details.

import sys
import xmlrpclib

from MoinMoin.script import MoinScript, fatal

input = sys.stdin

class PluginScript(MoinScript):
This tool allows you to import mail into the wiki.

Detailed Instructions:
General syntax: moin [options] maint mailimport [mailimport-options]

[options] usually should be:

[mailimport-options] see below:
    0. Verify that you have a configuration file.

    1. To import mail from the file '/mymail'
       moin ... xmlrpc mailimport << /mymail
       cat /mymail | moin ... xmlrpc mailimport

    def __init__(self, argv, def_values):
        MoinScript.__init__(self, argv, def_values)

    def mainloop(self):
            import mailimportconf
        except ImportError:
            fatal("Could not find the file Maybe you want to use the --config-dir=... option?")

        secret = mailimportconf.mail_import_secret
        url = mailimportconf.mail_import_url

        s = xmlrpclib.ServerProxy(url)

        result = s.ProcessMail(secret, xmlrpclib.Binary(

        if result != "OK":
            print >> sys.stderr, result