Commit 9cf141c2 authored by Jérome Perrin's avatar Jérome Perrin

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
parent 76305dd7
...@@ -37,6 +37,7 @@ from Products.ERP5.Document.Document import Document ...@@ -37,6 +37,7 @@ from Products.ERP5.Document.Document import Document
from Products.ERP5.Document.Document import ConversionCacheMixin from Products.ERP5.Document.Document import ConversionCacheMixin
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.CMFDefault.File import File as CMFFile from Products.CMFDefault.File import File as CMFFile
import OFS
from zLOG import LOG from zLOG import LOG
from DateTime import DateTime from DateTime import DateTime
...@@ -106,6 +107,15 @@ class File(Document, CMFFile, ConversionCacheMixin): ...@@ -106,6 +107,15 @@ class File(Document, CMFFile, ConversionCacheMixin):
# Declarative interfaces # Declarative interfaces
#__implements__ = ( , ) #__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 ### Special edit method
security.declarePrivate( '_edit' ) security.declarePrivate( '_edit' )
def _edit(self, **kw): def _edit(self, **kw):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment