From 9cf141c291924245d6a5740ace95d58942c269f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 7 Sep 2007 17:06:11 +0000
Subject: [PATCH] make sure that File.__init__ will call
 OFS.Image.File.__init__, otherwise viewing an empty file will result in an
 'AttributeError data'.

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

diff --git a/product/ERP5/Document/File.py b/product/ERP5/Document/File.py
index 4ed832d2f2..bef6b53489 100644
--- a/product/ERP5/Document/File.py
+++ b/product/ERP5/Document/File.py
@@ -37,6 +37,7 @@ from Products.ERP5.Document.Document import Document
 from Products.ERP5.Document.Document import ConversionCacheMixin
 from Products.ERP5Type.Base import Base
 from Products.CMFDefault.File import File as CMFFile
+import OFS
 from zLOG import LOG
 from DateTime import DateTime
 
@@ -105,6 +106,15 @@ class File(Document, CMFFile, ConversionCacheMixin):
 
   # Declarative interfaces
   #__implements__ = ( , )
+  
+  def __init__(self, id, *args, **kw):
+    """Initialize the underlying File. """
+    Document.__init__(self, id, *args, **kw)
+    # We don't call CMFFile.__init__, because it calls DefaultDublinCoreImpl,
+    # which calls some setters that will not work on an ERP5Type.Base object
+    # before beeing in the database. 
+    OFS.Image.File.__init__(self, id, title=None, file='')
+    
 
   ### Special edit method
   security.declarePrivate( '_edit' )
-- 
2.30.9