changeset 696:0d16d47c6d02

Small clean ups
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Tue, 16 May 2006 10:40:11 +0200
parents 82e482f6eb13
children 699f9301ede0
files MoinMoin/mailimport.py
diffstat 1 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/mailimport.py	Tue May 16 01:25:35 2006 +0200
+++ b/MoinMoin/mailimport.py	Tue May 16 10:40:11 2006 +0200
@@ -8,6 +8,10 @@
     @license: GNU GPL, see COPYING for details.
 """
 
+# known bugs:
+# does not generate a table on the parent page
+# HTML does not really work because it should retain the <body> only     
+
 import os
 import re
 import sys
@@ -69,17 +73,6 @@
         chunks_decoded.append(i[0].decode(i[1] or 'ascii'))
     return u''.join(chunks_decoded).strip()
 
-def generate_unique_name(name, old_names):
-    """ Is used to generate unique names among attachments. """
-    if name not in old_names:
-        return name
-    i = 0
-    while 1:
-        i += 1
-        new_name = name + "-" + str(i)
-        if new_name not in old_names:
-            return new_name
-
 def process_message(message):
     """ Processes the read message and decodes attachments. """
     attachments = []
@@ -118,7 +111,7 @@
             elif ct == 'text/html':
                 html_data.append(payload.decode(cs))
             elif not part.is_multipart():
-                print "Unknown mail part", repr((part.get_charsets(), part.get_content_charset(), part.get_content_type(), part.is_multipart(), ))
+                log("Unknown mail part", repr((part.get_charsets(), part.get_content_charset(), part.get_content_type(), part.is_multipart(), )))
 
     return {'text': u"".join(text_data), 'html': u"".join(html_data),
             'attachments': attachments, 'to_addr': to_addr, 'from_addr': from_addr,
@@ -222,7 +215,7 @@
     # assemble old page content and new mail body together
     old_content = Page(request, pagename).get_raw_body()
     if old_content:
-        new_content = u"%s-----\n%s" % (old_content, d['content'], )
+        new_content = u"%s\n-----\n%s" % (old_content, d['content'], )
     else:
         new_content = d['content']
     new_content += u"\n".join(attachment_table)