[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/File - File.py:1.8 IFile.py:1.3 NaiveFile.py:1.4 configure.zcml:1.8 SFile.py:NONE

Martijn Faassen m.faassen@vet.uu.nl
Thu, 25 Jul 2002 18:10:01 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/File
In directory cvs.zope.org:/tmp/cvs-serv32308/Zope/App/OFS/Content/File

Modified Files:
	File.py IFile.py NaiveFile.py configure.zcml 
Removed Files:
	SFile.py 
Log Message:
Got rid of separate Schema class; just use interfaces now. Updated
Forms and content objects to reflect this change.


=== Zope3/lib/python/Zope/App/OFS/Content/File/File.py 1.7 => 1.8 ===
 from Zope.Publisher.Browser.BrowserRequest import FileUpload
 
 from Zope.App.OFS.Annotation.IAnnotatable import IAnnotatable
-from Zope.App.OFS.Content.File.SFile import SFile
 from Zope.App.OFS.Content.File.IFile import IFile
 
 # set the size of the chunks
 MAXCHUNKSIZE = 1 << 16
 
 class File(Persistent):
-    __implements__ = SFile, IFile, IAnnotatable
+    __implements__ = IFile, IAnnotatable
 
     def __init__(self, data='', contentType=''):
         self.data = data
@@ -167,8 +166,6 @@
         '''See interface Zope.App.OFS.Content.File.IFile.IFile'''
         return self._size
 
-
-    # See schema Zope.App.OFS.File.SFile.SFile
     data = property(getData, setData, None,
                     """Contains the data of the file.""")
 


=== Zope3/lib/python/Zope/App/OFS/Content/File/IFile.py 1.2 => 1.3 ===
 
 from Interface import Interface
 from Zope.App.OFS.Content.IFileContent import IFileContent
+import Schema
 
 class IReadFile(IFileContent):
     
+    contentType = Schema.Str(
+        id = 'contentType',
+        title = 'Content Type',
+        description = 'The content type identifies the type of data.',
+        default = 'text/plain',
+        )
+
+
+    data = Schema.Str(
+        id = 'data',
+        title = 'Data',
+        description = 'The actual content of the object.',
+        )
 
     def getData():
         """Returns the bits (data) of the File itself."""


=== Zope3/lib/python/Zope/App/OFS/Content/File/NaiveFile.py 1.3 => 1.4 ===
 """
 from Persistence import Persistent
 from Zope.App.OFS.Content.File.IFile import IFile
-from Zope.App.OFS.Content.File.SFile import SFile
 from Zope.App.OFS.Annotation.IAnnotatable import IAnnotatable
 
 
@@ -26,7 +25,7 @@
     WARNING: This implementation should not be used to save large amounts
              of Data.
     """
-    __implements__ = IFile, SFile, IAnnotatable
+    __implements__ = IFile, IAnnotatable
 
     def __init__(self, data='', contentType=''):
         self.setData(data)
@@ -40,7 +39,7 @@
         
     def setContentType(self, contentType):
         '''See interface Zope.App.OFS.File.IFile.IFile'''
-        SFile.getDescriptionFor('contentType').validate(contentType)
+        IFile.getDescriptionFor('contentType').validate(contentType)
         self._contentType = contentType
     
     def getContentType(self):
@@ -59,7 +58,7 @@
 
     def setData(self, data):
         '''See interface Zope.App.OFS.File.IFile.IFile'''
-        SFile.getDescriptionFor('data').validate(data)
+        IFile.getDescriptionFor('data').validate(data)
         if data is not None:
             self._size = len(data)
             self._data = data
@@ -68,7 +67,6 @@
         '''See interface Zope.App.OFS.File.IFile.IFile'''
         return self._size
 
-    # See schema Zope.App.OFS.File.SFile.SFile
     data = property(getData, setData, None,
                     """Contains the data of the file.""")
 


=== Zope3/lib/python/Zope/App/OFS/Content/File/configure.zcml 1.7 => 1.8 ===
       description="A File" />
   <require
       permission="Zope.View"
-      interface=".SFile.SFile" />
-  <require
-      permission="Zope.View"
       interface=".IFile.IReadFile" />
   <require
       permission="Zope.ManageContent"

=== Removed File Zope3/lib/python/Zope/App/OFS/Content/File/SFile.py ===