changeset 3991:42c243588d64

fix cancel gui editor occur error because of empty parameter on max function. and replace list append code with efficient one
author Byeongweon [tasyblue@gmail.com]
date Fri, 01 Aug 2008 16:41:25 +0900
parents 645d031f4eab
children 513613f25bbf
files MoinMoin/converter/text_html_text_moin_wiki.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/converter/text_html_text_moin_wiki.py	Fri Aug 01 09:38:06 2008 +0900
+++ b/MoinMoin/converter/text_html_text_moin_wiki.py	Fri Aug 01 16:41:25 2008 +0900
@@ -924,7 +924,9 @@
             for i in node.childNodes:
                 if i.nodeType == Node.TEXT_NODE:
                     # get longest pre tag({{{) from content
-                    longest_inner_formater = max([longest_inner_formater, max(re.compile("(?u){+").findall(i.data))])
+                    delimiters = re.compile("(?u){+").findall(i.data)
+                    if delimiters:
+                        longest_inner_formater = max([longest_inner_formater, max(delimiters)])
                     content_buffer.append(i.data)
                     #print "'%s'" % i.data
                 elif i.localName == 'br':
@@ -935,11 +937,11 @@
 
             if (len(longest_inner_formater) >= 3):
                 self.text.extend(["{" * (len(longest_inner_formater) + 1), self.new_line])
-                map(lambda item : self.text.append(item), content_buffer)
+                self.text.extend(content_buffer)
                 self.text.extend(["}" * (len(longest_inner_formater) + 1), self.new_line])
             else:                
                 self.text.extend(["{{{", self.new_line])
-                map(lambda item : self.text.append(item), content_buffer)
+                self.text.extend(content_buffer)
                 self.text.extend(["}}}", self.new_line])
 
     _alignment = {"left": "(",