[Erp5-report] r16164 - /erp5/trunk/products/ERP5/Document/File.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Sep 7 19:06:12 CEST 2007


Author: jerome
Date: Fri Sep  7 19:06:11 2007
New Revision: 16164

URL: http://svn.erp5.org?rev=16164&view=rev
Log:
make sure that File.__init__ will call OFS.Image.File.__init__, otherwise
viewing an empty file will result in an 'AttributeError data'.


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

Modified: erp5/trunk/products/ERP5/Document/File.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/File.py?rev=16164&r1=16163&r2=16164&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/File.py (original)
+++ erp5/trunk/products/ERP5/Document/File.py Fri Sep  7 19:06:11 2007
@@ -37,6 +37,7 @@
 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 @@
 
   # 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' )




More information about the Erp5-report mailing list