From e217698ed37ae0a2178f0dacbfcf54a32823f191 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Wed, 9 Apr 2008 09:00:52 +0000
Subject: [PATCH] Add missing cached_mime, replace hasattr by getattr

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

diff --git a/product/ERP5/Document/Document.py b/product/ERP5/Document/Document.py
index 84c8e9b981..8fab228333 100644
--- a/product/ERP5/Document/Document.py
+++ b/product/ERP5/Document/Document.py
@@ -136,16 +136,19 @@ class ConversionCacheMixin:
     self._cached_time = PersistentMapping()
     self._cached_data = PersistentMapping()
     self._cached_size = PersistentMapping()
+    self._cached_mime = PersistentMapping()
 
   security.declareProtected(Permissions.View, 'updateConversionCache')
   def updateConversionCache(self):
     aself = aq_base(self)
-    if not hasattr(aself, '_cached_time') or self._cached_time is None:
+    if getattr(aself, '_cached_time', None) is None or self._cached_time is None:
       self._cached_time = PersistentMapping()
-    if not hasattr(aself, '_cached_data') or self._cached_data is None:
+    if getattr(aself, '_cached_data', None) is None or self._cached_data is None:
       self._cached_data = PersistentMapping()
-    if not hasattr(aself, '_cached_size') or self._cached_size is None:
+    if getattr(aself, '_cached_size', None) is None or self._cached_size is None:
       self._cached_size = PersistentMapping()
+    if getattr(aself, '_cached_mime', None) is None or self._cached_mime is None:
+      self._cached_mime = PersistentMapping()
 
   security.declareProtected(Permissions.View, 'hasConversion')
   def hasConversion(self, **format):
-- 
2.30.9