changeset 1686:b010f7260ab6

mailimport: minor refactoring
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 26 Nov 2006 13:01:56 +0100
parents 8078e7b39a2b
children 1d358ccc0f2f
files MoinMoin/mail/mailimport.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/mail/mailimport.py	Mon Nov 20 21:41:30 2006 +0100
+++ b/MoinMoin/mail/mailimport.py	Sun Nov 26 13:01:56 2006 +0100
@@ -123,12 +123,17 @@
             'from_addr': from_addr,
             'subject': subject, 'date': date}
 
-def get_pagename_content(request, msg, email_pagename_envelope, email_subpage_template, wiki_addrs):
+def get_pagename_content(request, msg):
     """ Generates pagename and content according to the specification
         that can be found on MoinMoin:FeatureRequests/WikiEmailintegration """
     generate_summary = False
     choose_html = True
 
+    cfg = request.cfg
+    email_subpage_template = cfg.mail_import_subpage_template
+    email_pagename_envelope = cfg.mail_import_pagename_envelope
+    wiki_addrs = cfg.mail_import_wiki_addrs
+
     pagename_tpl = ""
     for addr in msg['target_addrs']:
         if addr[1].strip().lower() in wiki_addrs:
@@ -201,8 +206,6 @@
     _ = request.getText
     msg = process_message(message)
 
-    email_subpage_template = request.cfg.mail_import_subpage_template
-    email_pagename_envelope = request.cfg.mail_import_pagename_envelope
     wiki_addrs = request.cfg.mail_import_wiki_addrs
 
     request.user = user.get_by_email_address(request, msg['from_addr'][1])
@@ -210,7 +213,7 @@
     if not request.user:
         raise ProcessingError("No suitable user found for mail address %r" % (msg['from_addr'][1], ))
 
-    d = get_pagename_content(request, msg, email_pagename_envelope, email_subpage_template, wiki_addrs)
+    d = get_pagename_content(request, msg)
     pagename = d['pagename']
     generate_summary = d['generate_summary']