[Zope3-checkins] CVS: Zope3/src/zope/app/content - dtmlpage.py:1.6 file.py:1.10 fssync.py:1.11 i18nfile.py:1.3 i18nimage.py:1.4 image.py:1.8 sql.py:1.6 xmldocument.py:1.4 zpt.py:1.13
Steve Alexander
steve@cat-box.net
Sat, 7 Jun 2003 02:37:54 -0400
Update of /cvs-repository/Zope3/src/zope/app/content
In directory cvs.zope.org:/tmp/cvs-serv4294/src/zope/app/content
Modified Files:
dtmlpage.py file.py fssync.py i18nfile.py i18nimage.py
image.py sql.py xmldocument.py zpt.py
Log Message:
updated to use new-style interface declarations
=== Zope3/src/zope/app/content/dtmlpage.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/content/dtmlpage.py:1.5 Thu May 29 12:48:16 2003
+++ Zope3/src/zope/app/content/dtmlpage.py Sat Jun 7 02:37:23 2003
@@ -20,6 +20,7 @@
from zope.app.interfaces.content.file import IFileContent
from zope.app.interfaces.content.dtmlpage import IDTMLPage, IRenderDTMLPage
from zope.app.interfaces.file import IFileFactory
+from zope.interface import implements
from zope.context import ContextMethod
from zope.context import getWrapperContainer
@@ -30,7 +31,7 @@
class DTMLPage(Persistent):
# XXX Putting IFileContent at the end gives an error!
- __implements__ = IFileContent, IDTMLPage, IRenderDTMLPage, IAnnotatable
+ implements(IFileContent, IDTMLPage, IRenderDTMLPage, IAnnotatable)
def __init__(self, source=''):
self.setSource(source)
@@ -66,7 +67,7 @@
class DTMLFactory(object):
- __implements__ = IFileFactory
+ implements(IFileFactory)
def __init__(self, context):
self.context = context
=== Zope3/src/zope/app/content/file.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/content/file.py:1.9 Mon May 19 17:25:07 2003
+++ Zope3/src/zope/app/content/file.py Sat Jun 7 02:37:23 2003
@@ -20,6 +20,7 @@
from persistence import Persistent
from transaction import get_transaction
+from zope.interface import implements
from zope.publisher.browser import FileUpload
from zope.app.interfaces.content.file import IFile, IReadFile, IFileContent
@@ -28,7 +29,7 @@
MAXCHUNKSIZE = 1 << 16
class File(Persistent):
- __implements__ = IFileContent, IFile
+ implements(IFileContent, IFile)
def __init__(self, data='', contentType=''):
self.data = data
@@ -171,7 +172,7 @@
class SearchableText:
- __implements__ = ISearchableText
+ implements(ISearchableText)
__used_for__ = IReadFile
def __init__(self, file):
=== Zope3/src/zope/app/content/fssync.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/content/fssync.py:1.10 Tue Jun 3 18:46:18 2003
+++ Zope3/src/zope/app/content/fssync.py Sat Jun 7 02:37:23 2003
@@ -19,11 +19,12 @@
from zope.app.fssync.classes import ObjectEntryAdapter, AttrMapping
from zope.app.interfaces.fssync import IObjectFile, IContentDirectory
from zope.app.context import ContextWrapper
+from zope.interface import implements
class FileAdapter(ObjectEntryAdapter):
"""ObjectFile adapter for file objects."""
- __implements__ = IObjectFile
+ implements(IObjectFile)
def getBody(self):
return self.context.getData()
@@ -37,7 +38,7 @@
class DirectoryAdapter(ObjectEntryAdapter):
"""Folder adapter to provide a file-system representation."""
- __implements__ = IContentDirectory
+ implements(IContentDirectory)
def contents(self):
result = []
@@ -49,7 +50,7 @@
class ZPTPageAdapter(ObjectEntryAdapter):
"""ObjectFile adapter for ZPT page objects."""
- __implements__ = IObjectFile
+ implements(IObjectFile)
def getBody(self):
return self.context.getSource()
@@ -62,7 +63,7 @@
class DTMLPageAdapter(ObjectEntryAdapter):
- __implements__ = IObjectFile
+ implements(IObjectFile)
def getBody(self):
return self.context.getSource()
=== Zope3/src/zope/app/content/i18nfile.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/content/i18nfile.py:1.2 Wed Dec 25 09:12:48 2002
+++ Zope3/src/zope/app/content/i18nfile.py Sat Jun 7 02:37:23 2003
@@ -19,6 +19,7 @@
import persistence
from zope.app.interfaces.content.i18nfile import II18nFile
from zope.app.content.file import File
+from zope.interface import implements
# XXX We shouldn't be dependent on Browser here! Aaaargh.
from zope.publisher.browser import FileUpload
@@ -28,7 +29,7 @@
one for each language.
"""
- __implements__ = II18nFile
+ implements(II18nFile)
def __init__(self, data='', contentType=None, defaultLanguage='en'):
""" """
=== Zope3/src/zope/app/content/i18nimage.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/content/i18nimage.py:1.3 Thu May 1 15:35:10 2003
+++ Zope3/src/zope/app/content/i18nimage.py Sat Jun 7 02:37:23 2003
@@ -19,19 +19,18 @@
from zope.app.content.image import Image, getImageInfo
from zope.app.content.i18nfile import I18nFile
from zope.app.interfaces.content.i18nimage import II18nImage
+from zope.interface import implements
class I18nImage(I18nFile):
"""An internationalized Image object. Note that images of all
languages share the same content type.
"""
- __implements__ = II18nImage
-
+ implements(II18nImage)
def _create(self, data):
return Image(data)
-
def setData(self, data, language=None):
'''See interface IFile'''
super(I18nImage, self).setData(data, language)
@@ -43,7 +42,6 @@
contentType = getImageInfo(self.getData(language))[0]
if contentType:
self.setContentType(contentType)
-
def getImageSize(self, language=None):
'''See interface IImage'''
=== Zope3/src/zope/app/content/image.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/content/image.py:1.7 Mon Apr 14 13:15:20 2003
+++ Zope3/src/zope/app/content/image.py Sat Jun 7 02:37:23 2003
@@ -22,11 +22,12 @@
from zope.app.size import byteDisplay
from zope.app.content_types import guess_content_type
+from zope.interface import implements
__metaclass__ = type
class Image(File):
- __implements__ = IImage
+ implements(IImage)
def __init__(self, data=''):
'''See interface IFile'''
@@ -51,7 +52,7 @@
class ImageSized:
- __implements__ = ISized
+ implements(ISized)
def __init__(self, image):
self._image = image
=== Zope3/src/zope/app/content/sql.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/content/sql.py:1.5 Tue May 27 10:18:14 2003
+++ Zope3/src/zope/app/content/sql.py Sat Jun 7 02:37:23 2003
@@ -157,6 +157,7 @@
from zope.documenttemplate.dt_util import ParseError, parse_params, name_param
from zope.interface.common.mapping import IEnumerableMapping
+from zope.interface import implements
from zope.component import getService
from zope.context import ContextMethod
@@ -181,7 +182,7 @@
class Arguments(PersistentDict):
"""Hold arguments of SQL Script"""
- __implements__ = IEnumerableMapping
+ implements(IEnumerableMapping)
def parseArguments(text, result=None):
@@ -645,7 +646,7 @@
class SQLScript(SQLCommand, Persistent):
- __implements__ = ISQLScript, IFileContent, IAttributeAnnotatable
+ implements(ISQLScript, IFileContent, IAttributeAnnotatable)
def __init__(self, connectionName='', source='', arguments=''):
self.template = SQLDTML(source)
@@ -782,7 +783,7 @@
class SQLScript(SQLCommand, Persistent):
- __implements__ = ISQLScript, IFileContent, IAttributeAnnotatable
+ implements(ISQLScript, IFileContent, IAttributeAnnotatable)
def __init__(self, connectionName='', source='', arguments=''):
self.template = SQLDTML(source)
=== Zope3/src/zope/app/content/xmldocument.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/content/xmldocument.py:1.3 Fri Apr 11 10:44:27 2003
+++ Zope3/src/zope/app/content/xmldocument.py Sat Jun 7 02:37:23 2003
@@ -16,19 +16,19 @@
"""
from persistence import Persistent
from zope.app.interfaces.content.xmldocument import IXMLDocument
-from zope.app.xml.w3cschemalocations import\
- setInstanceInterfacesForXMLText
+from zope.app.xml.w3cschemalocations import setInstanceInterfacesForXMLText
+from zope.interface import implements
class XMLDocument(Persistent):
- __implements__ = IXMLDocument
-
+ implements(IXMLDocument)
+
def __init__(self, source='<doc/>'):
self.source = source
-
+
def _setSource(self, value):
self._source = value
-
+
# XXX for now, parse the document and lift the W3C XML schema
# locations from it to identify which schemas are used
# this dependency on W3C XML schema should go away at some point,
@@ -40,5 +40,5 @@
def _getSource(self):
return self._source
-
+
source = property(_getSource, _setSource)
=== Zope3/src/zope/app/content/zpt.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/content/zpt.py:1.12 Wed May 28 11:46:06 2003
+++ Zope3/src/zope/app/content/zpt.py Sat Jun 7 02:37:23 2003
@@ -31,12 +31,13 @@
from zope.app.interfaces.content.zpt import IZPTPage, IRenderZPTPage
from zope.app.interfaces.file import IReadFile, IWriteFile, IFileFactory
+from zope.interface import implements
__metaclass__ = type
class ZPTPage(AppPT, PageTemplate, Persistent):
- __implements__ = IZPTPage, IRenderZPTPage
+ implements(IZPTPage, IRenderZPTPage)
expand = False
@@ -84,7 +85,7 @@
class SearchableText:
__used_for__ = IZPTPage
- __implements__ = ISearchableText
+ implements(ISearchableText)
def __init__(self, page):
self.page = page
@@ -106,7 +107,7 @@
class Sized:
- __implements__ = ISized
+ implements(ISized)
def __init__(self, page):
self.num_lines = len(page.getSource().splitlines())
@@ -125,7 +126,7 @@
class ZPTReadFile:
- __implements__ = IReadFile
+ implements(IReadFile)
def __init__(self, context):
self.context = context
@@ -138,7 +139,7 @@
class ZPTWriteFile:
- __implements__ = IWriteFile
+ implements(IWriteFile)
def __init__(self, context):
self.context = context
@@ -149,7 +150,7 @@
class ZPTFactory:
- __implements__ = IFileFactory
+ implements(IFileFactory)
def __init__(self, context):