[Erp5-report] r34378 nicolas - /erp5/trunk/products/ERP5/Document/TextDocument.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 8 13:24:08 CEST 2010


Author: nicolas
Date: Thu Apr  8 13:24:05 2010
New Revision: 34378

URL: http://svn.erp5.org?rev=34378&view=rev
Log:
Handle case when text_content does not match pattern

Modified:
    erp5/trunk/products/ERP5/Document/TextDocument.py

Modified: erp5/trunk/products/ERP5/Document/TextDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TextDocument.py?rev=34378&r1=34377&r2=34378&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] Thu Apr  8 13:24:05 2010
@@ -230,7 +230,9 @@
             mime_type = 'text/x-html-safe'
             if charset is None:
               # find charset
-              charset = self.charset_parser.search(text_content).group('charset')
+              re_match = self.charset_parser.search(text_content)
+              if re_match is not None:
+                charset = re_match.group('charset')
             if charset and charset not in ('utf-8', 'UTF-8'):
               try:
                 text_content = text_content.decode(charset).encode('utf-8')




More information about the Erp5-report mailing list