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

« back to all changes in this revision

Viewing changes to MoinMoin/xmlrpc/ProcessMail.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 - This plugin is used for multi-tier mail processing
 
4
 
 
5
    @copyright: 2006 MoinMoin:AlexanderSchremmer
 
6
    @license: GNU GPL, see COPYING for details.
 
7
"""
 
8
 
 
9
from MoinMoin import log
 
10
logging = log.getLogger(__name__)
 
11
 
 
12
from MoinMoin.mail import mailimport
 
13
 
 
14
def execute(xmlrpcobj, secret, mail):
 
15
    request = xmlrpcobj.request
 
16
    secret = xmlrpcobj._instr(secret)
 
17
    mail = str(mail)
 
18
 
 
19
    if not request.cfg.mail_import_secret:
 
20
        return u"No password set"
 
21
 
 
22
    if request.cfg.mail_import_secret != secret:
 
23
        return u"Invalid password"
 
24
 
 
25
    try:
 
26
        mailimport.import_mail_from_string(request, mail)
 
27
    except mailimport.ProcessingError, e:
 
28
        err = u"An error occured while processing the message: " + str(e.args)
 
29
        logging.error(err)
 
30
        return xmlrpcobj._outstr(err)
 
31
    return xmlrpcobj._outstr(u"OK")