From ca6b0902b8fb638794467b5ba42f8a729c189c08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 10 Mar 2009 12:29:48 +0000
Subject: [PATCH] move _guessEncoding as a class method, and change a bit
 docstring, as it's no longer an EmailDocument method.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25939 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Document.py | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/product/ERP5/Document/Document.py b/product/ERP5/Document/Document.py
index d0710edde5..57f808e1b4 100644
--- a/product/ERP5/Document/Document.py
+++ b/product/ERP5/Document/Document.py
@@ -1273,22 +1273,22 @@ class Document(PermanentURLMixIn, XMLObject, UrlMixIn, ConversionCacheMixin, Sna
     mime, html = self.convert(**kw)
     return self._stripHTML(str(html))
 
+  def _guessEncoding(self, string):
+    """
+      Try to guess the encoding for this string.
+      Returns None if no encoding can be guessed.
+    """
+    try:
+      import chardet
+    except ImportError:
+      return None
+    return chardet.detect(string).get('encoding', None)
+
   def _stripHTML(self, html, charset=None):
     """
       A private method which can be reused by subclasses
       to strip HTML content
     """
-    def _guessEncoding(self, string):
-      """
-        Some Email Clients indicate wrong encoding
-        This method try to guess which encoding is used.
-      """
-      try:
-        import chardet
-      except ImportError:
-        return None
-      return chardet.detect(string).get('encoding', None)
-
     body_list = re.findall(self.body_parser, str(html))
     if len(body_list):
       stripped_html = body_list[0]
-- 
2.30.9