[Zope3-checkins] CVS: Zope3/src/zope/app/content - configure.zcml:1.17.2.1 dtmlpage.py:1.3.24.1 file.py:1.9.2.1 folder.py:1.11.10.1 fssync.py:1.6.2.1 i18nfile.py:1.2.26.1 i18nimage.py:1.3.10.1 image.py:1.7.14.1 sql.py:1.4.10.1 xmldocument.py:1.3.14.1 zpt.py:1.10.12.1
Grégoire Weber
zope@i-con.ch
Sun, 22 Jun 2003 10:23:58 -0400
Update of /cvs-repository/Zope3/src/zope/app/content
In directory cvs.zope.org:/tmp/cvs-serv24874/src/zope/app/content
Modified Files:
Tag: cw-mail-branch
configure.zcml dtmlpage.py file.py folder.py fssync.py
i18nfile.py i18nimage.py image.py sql.py xmldocument.py zpt.py
Log Message:
Synced up with HEAD
=== Zope3/src/zope/app/content/configure.zcml 1.17 => 1.17.2.1 ===
--- Zope3/src/zope/app/content/configure.zcml:1.17 Thu May 15 13:31:43 2003
+++ Zope3/src/zope/app/content/configure.zcml Sun Jun 22 10:22:56 2003
@@ -49,6 +49,13 @@
/>
<adapter
+ for="zope.app.interfaces.content.folder.IRootFolder"
+ provides="zope.app.interfaces.file.IDirectoryFactory"
+ factory="zope.app.content.folder.RootDirectoryFactory"
+ permission="zope.ManageContent"
+ />
+
+<adapter
for="zope.app.interfaces.content.folder.IFolder"
provides="zope.app.interfaces.file.IFileFactory"
factory="zope.app.content.image.FileFactory"
@@ -62,6 +69,47 @@
permission="zope.View"
/>
+
+<!-- Copy/Paste/Move support -->
+<!-- We declare only for folders at this point because we don't yet
+ properly handle copy/cut/paste accross container types
+ -->
+
+<adapter
+ provides="zope.app.interfaces.container.ICopySource"
+ for="zope.app.interfaces.content.folder.IFolder"
+ permission="zope.ManageContent"
+ factory="zope.app.container.copypastemove.CopySource"
+ />
+
+<adapter
+ provides="zope.app.interfaces.container.INoChildrenCopySource"
+ for="zope.app.interfaces.content.folder.IFolder"
+ permission="zope.ManageContent"
+ factory="zope.app.container.copypastemove.NoChildrenCopySource"
+ />
+
+<adapter
+ provides="zope.app.interfaces.container.IMoveSource"
+ for="zope.app.interfaces.content.folder.IFolder"
+ permission="zope.ManageContent"
+ factory="zope.app.container.copypastemove.MoveSource"
+ />
+
+<adapter
+ provides="zope.app.interfaces.container.IPasteTarget"
+ for="zope.app.interfaces.content.folder.IFolder"
+ permission="zope.ManageContent"
+ factory="zope.app.container.copypastemove.PasteTarget"
+ />
+
+<adapter
+ provides="zope.app.interfaces.container.IPasteNamesChooser"
+ for="zope.app.interfaces.content.folder.IFolder"
+ permission="zope.ManageContent"
+ factory="zope.app.container.copypastemove.PasteNamesChooser"
+ />
+
<!-- XXX Do we really need RootFolder? -->
<content class="zope.app.content.folder.RootFolder">
@@ -215,6 +263,14 @@
</content>
+<adapter
+ for="zope.app.interfaces.content.folder.IFolder"
+ provides="zope.app.interfaces.file.IFileFactory"
+ name=".dtml"
+ factory=".dtmlpage.DTMLFactory"
+ permission="zope.ManageContent"
+ />
+
<content class="zope.app.content.file.File">
@@ -373,26 +429,6 @@
<fssync:adapter class=".zpt.ZPTPage" factory=".fssync.ZPTPageAdapter" />
<fssync:adapter class=".dtmlpage.DTMLPage" factory=".fssync.DTMLPageAdapter" />
-
- <!-- zope:adapter directives -->
-
-<adapter
- for="zope.app.interfaces.content.file.IFile"
- factory=".fssync.FileAdapter"
- provides="zope.app.interfaces.fssync.IObjectFile"
- />
-
-<adapter
- for="zope.app.interfaces.content.folder.IFolder"
- factory=".fssync.DirectoryAdapter"
- provides="zope.app.interfaces.fssync.IObjectDirectory"
- />
-
-<adapter
- for="zope.app.interfaces.content.zpt.IZPTPage"
- factory=".fssync.FileAdapter"
- provides="zope.app.interfaces.fssync.IObjectFile"
- />
<!-- Further Directives -->
=== Zope3/src/zope/app/content/dtmlpage.py 1.3 => 1.3.24.1 ===
--- Zope3/src/zope/app/content/dtmlpage.py:1.3 Mon Jan 6 10:46:26 2003
+++ Zope3/src/zope/app/content/dtmlpage.py Sun Jun 22 10:22:56 2003
@@ -19,9 +19,11 @@
from zope.app.interfaces.annotation import IAnnotatable
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.proxy.context import ContextMethod
-from zope.proxy.context import getWrapperContainer
+from zope.context import ContextMethod
+from zope.context import getWrapperContainer
from zope.security.proxy import ProxyFactory
from zope.documenttemplate.dt_html import HTML
@@ -29,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)
@@ -62,3 +64,15 @@
source = property(getSource, setSource, None,
"""Source of the DTML Page.""")
+
+class DTMLFactory(object):
+
+ implements(IFileFactory)
+
+ def __init__(self, context):
+ self.context = context
+
+ def __call__(self, name, content_type, data):
+ r = DTMLPage()
+ r.setSource(data, content_type or 'text/html')
+ return r
=== Zope3/src/zope/app/content/file.py 1.9 => 1.9.2.1 ===
--- Zope3/src/zope/app/content/file.py:1.9 Mon May 19 17:25:07 2003
+++ Zope3/src/zope/app/content/file.py Sun Jun 22 10:22:56 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/folder.py 1.11 => 1.11.10.1 ===
--- Zope3/src/zope/app/content/folder.py:1.11 Thu May 1 15:35:10 2003
+++ Zope3/src/zope/app/content/folder.py Sun Jun 22 10:22:57 2003
@@ -18,12 +18,12 @@
ICloneWithoutChildren
from zope.app.services.servicecontainer import ServiceManagerContainer
from zope.exceptions import DuplicationError
-
+from zope.interface import implements
class Folder(Persistent, ServiceManagerContainer):
"""The standard Zope Folder implementation."""
- __implements__ = IFolder, ICloneWithoutChildren
+ implements(IFolder, ICloneWithoutChildren)
def __init__(self):
self.data = OOBTree()
@@ -107,8 +107,15 @@
class RootFolder(Folder):
"""The standard Zope root Folder implementation."""
- __implements__ = Folder.__implements__, IRootFolder
+ implements(IRootFolder)
+
+
+class RootDirectoryFactory:
+ def __init__(self, context):
+ pass
+ def __call__(self, name):
+ return Folder()
# Adapter to provide a file-system rendition of folders
@@ -152,6 +159,5 @@
return [(key, get(key)) for key in self.keys()]
def __contains__(self, key):
- return self.get(key) is not None
-
+ return self.get(key) is not None
=== Zope3/src/zope/app/content/fssync.py 1.6 => 1.6.2.1 ===
--- Zope3/src/zope/app/content/fssync.py:1.6 Thu May 15 17:28:25 2003
+++ Zope3/src/zope/app/content/fssync.py Sun Jun 22 10:22:57 2003
@@ -16,17 +16,15 @@
$Id$
"""
-from zope.app.content.file import File
-from zope.app.content.folder import Folder
-from zope.app.content.zpt import ZPTPage
from zope.app.fssync.classes import ObjectEntryAdapter, AttrMapping
from zope.app.interfaces.fssync import IObjectFile, IContentDirectory
-from zope.proxy.context import ContextWrapper
+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()
@@ -40,7 +38,7 @@
class DirectoryAdapter(ObjectEntryAdapter):
"""Folder adapter to provide a file-system representation."""
- __implements__ = IContentDirectory
+ implements(IContentDirectory)
def contents(self):
result = []
@@ -52,17 +50,20 @@
class ZPTPageAdapter(ObjectEntryAdapter):
"""ObjectFile adapter for ZPT page objects."""
- __implements__ = IObjectFile
+ implements(IObjectFile)
def getBody(self):
return self.context.getSource()
def setBody(self, data):
- self.context.setSource(data)
+ # Convert the data to Unicode, since that's what ZPTPage wants;
+ # it's normally read from a file so it'll be bytes.
+ # XXX This will die if it's not ASCII. Guess encoding???
+ self.context.setSource(unicode(data))
class DTMLPageAdapter(ObjectEntryAdapter):
- __implements__ = IObjectFile
+ implements(IObjectFile)
def getBody(self):
return self.context.getSource()
=== Zope3/src/zope/app/content/i18nfile.py 1.2 => 1.2.26.1 ===
--- Zope3/src/zope/app/content/i18nfile.py:1.2 Wed Dec 25 09:12:48 2002
+++ Zope3/src/zope/app/content/i18nfile.py Sun Jun 22 10:22:57 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.3.10.1 ===
--- Zope3/src/zope/app/content/i18nimage.py:1.3 Thu May 1 15:35:10 2003
+++ Zope3/src/zope/app/content/i18nimage.py Sun Jun 22 10:22:57 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.7.14.1 ===
--- Zope3/src/zope/app/content/image.py:1.7 Mon Apr 14 13:15:20 2003
+++ Zope3/src/zope/app/content/image.py Sun Jun 22 10:22:57 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.4 => 1.4.10.1 ===
--- Zope3/src/zope/app/content/sql.py:1.4 Thu May 1 15:35:10 2003
+++ Zope3/src/zope/app/content/sql.py Sun Jun 22 10:22:57 2003
@@ -157,13 +157,13 @@
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.proxy.context import ContextMethod
+from zope.context import ContextMethod, ContextProperty
from zope.app.cache.caching import getCacheForObj, getLocationForCache
from zope.app.interfaces.content.file import IFileContent
-from zope.app.interfaces.content.sql import ISQLScript
-from zope.app.interfaces.annotation import IAttributeAnnotatable
+from zope.app.interfaces.content.sql import ISQLScript, MissingInput
from zope.app.rdb import SQLCommand
from zope.app.rdb import queryForResults
@@ -181,7 +181,7 @@
class Arguments(PersistentDict):
"""Hold arguments of SQL Script"""
- __implements__ = IEnumerableMapping
+ implements(IEnumerableMapping)
def parseArguments(text, result=None):
@@ -325,25 +325,24 @@
v = md[expr]
else:
v = expr(md)
- except:
+ except (KeyError, ValueError):
if args.has_key('optional') and args['optional']:
return 'null'
if not isinstance(expr, StringTypes):
raise
- raise ('Missing Input',
- 'Missing input variable, **%s**' % name)
+ raise MissingInput, 'Missing input variable, **%s**' % name
- # XXX Shrug, should these tyoes be really hard coded? What about
+ # XXX Shrug, should these types be really hard coded? What about
# Dates and other types a DB supports; I think we should make this
# a plugin.
+ # We might be able to reuse some of the widget conversion code. (SR)
if t == 'int':
try:
if isinstance(v, StringTypes):
int(v)
else:
v = str(int(v))
- # XXX Bare except!
- except:
+ except ValueError:
if not v and args.has_key('optional') and args['optional']:
return 'null'
raise ValueError, (
@@ -355,8 +354,7 @@
float(v)
else:
v = str(float(v))
- # XXX Bare except!
- except:
+ except ValueError:
if not v and args.has_key('optional') and args['optional']:
return 'null'
raise ValueError, (
@@ -447,10 +445,9 @@
int(v)
else:
v = str(int(v))
- # XXX Bare except!
- except:
+ except ValueError:
raise ValueError, (
- 'Invalid integer value for **%s**' % name)
+ 'Invalid integer value for **%s**' %name)
elif t == 'float':
if not v and isinstance(v, str):
@@ -460,10 +457,9 @@
float(v)
else:
v = str(float(v))
- # XXX Bare except!
- except:
+ except ValueError:
raise ValueError, (
- 'Invalid floating-point value for **%s**' % name)
+ 'Invalid floating-point value for **%s**' %name)
else:
v = str(v)
v = self.sql_quote__(v)
@@ -473,8 +469,7 @@
if not vs:
if self.optional:
return ''
- raise 'Missing Input', (
- 'No input was provided for **%s**' % name)
+ raise MissingInput, 'No input was provided for **%s**' %name
if len(vs) > 1:
vs = ', '.join(map(str, vs))
@@ -575,14 +570,12 @@
v = md[expr]
else:
v = expr(md)
- # XXX Bare except!
- except:
+ except (KeyError, ValueError):
if args.has_key('optional') and args['optional']:
return 'null'
if not isinstance(expr, StringTypes):
raise
- raise ('Missing Input',
- 'Missing input variable, **%s**' % name)
+ raise MissingInput, 'Missing input variable, **%s**' %name
# XXX Shrug, should these tyoes be really hard coded? What about
# Dates and other types a DB supports; I think we should make this
@@ -605,8 +598,7 @@
float(v)
else:
v = str(float(v))
- # XXX Bare except!
- except:
+ except ValueError:
if not v and args.has_key('optional') and args['optional']:
return 'null'
raise ValueError, (
@@ -645,16 +637,15 @@
class SQLScript(SQLCommand, Persistent):
- __implements__ = ISQLScript, IFileContent, IAttributeAnnotatable
+ implements(ISQLScript, IFileContent)
def __init__(self, connectionName='', source='', arguments=''):
self.template = SQLDTML(source)
- self.setConnectionName(connectionName)
+ self.connectionName = connectionName
# In our case arguments should be a string that is parsed
- self.setArguments(arguments)
+ self.arguments = arguments
def setArguments(self, arguments):
- 'See ISQLScript'
assert isinstance(arguments, StringTypes), (
'"arguments" argument of setArguments() must be a string'
)
@@ -662,163 +653,29 @@
self._arguments = parseArguments(arguments)
def getArguments(self):
- 'See ISQLScript'
+ 'See zope.app.interfaces.content.sql.ISQLScript'
return self._arguments
def getArgumentsString(self):
- 'See ISQLScript'
return self._arg_string
- def setSource(self, source):
- 'See ISQLScript'
- self.template.munge(source)
-
- def getSource(self):
- 'See ISQLScript'
- return self.template.read_raw()
-
- def getTemplate(self):
- 'See ISQLScript'
- return self.template
-
- def setConnectionName(self, name):
- 'See ISQLScript'
- self._connectionName = name
- cache = getCacheForObj(self)
- location = getLocationForCache(self)
-
- if cache and location:
- cache.invalidate(location)
-
- setConnectionName = ContextMethod(setConnectionName)
-
- def getConnectionName(self):
- 'See ISQLScript'
- return self._connectionName
-
- def getConnection(self):
- 'See ISQLCommand'
- connection_service = getService(self, "SQLDatabaseConnections")
- connection = connection_service.getConnection(self.connectionName)
- return connection
-
- getConnection = ContextMethod(getConnection)
-
- def __call__(self, **kw):
- 'See ISQLCommand'
-
- # Try to resolve arguments
- arg_values = {}
- missing = []
- for name in self._arguments.keys():
- name = name.encode('UTF-8')
- try:
- # Try to find argument in keywords
- arg_values[name] = kw[name]
- # XXX Bare except!
- except:
- # Okay, the first try failed, so let's try to find the default
- arg = self._arguments[name]
- try:
- arg_values[name] = arg['default']
- # XXX Bare except!
- except:
- # Now the argument might be optional anyways; let's check
- try:
- if not arg['optional']:
- missing.append(name)
- # XXX Bare except!
- except:
- missing.append(name)
-
- try:
- connection = self.getConnection()
- except AttributeError:
- raise AttributeError, (
- "The database connection **%s** cannot be found." % (
- self.connectionName))
-
- if connection is None:
- raise 'Database Error', (
- '%s is not connected to a database' %'foo')# self.id)
-
- query = apply(self.template, (), arg_values)
- cache = getCacheForObj(self)
- location = getLocationForCache(self)
- if cache and location:
- _marker = []
- result = cache.query(location, {'query': query}, default=_marker)
- if result is not _marker:
- return result
- result = queryForResults(connection, query)
- if cache and location:
- cache.set(result, location, {'query': query})
- return result
-
- __call__ = ContextMethod(__call__)
-
-
- # See ISQLScript
- arguments = property(getArgumentsString, setArguments, None,
- "Set the arguments that are used for the SQL Script.")
- source = property(getSource, setSource, None,
- "Set the SQL template source.")
- connectionName = property(getConnectionName, setConnectionName, None,
- "Connection Name for the SQL scripts.")
-
-class SQLDTML(HTML):
- __name__ = 'SQLDTML'
-
- commands = {}
-
- for k, v in HTML.commands.items():
- commands[k]=v
-
- # add the new tags to the DTML
- commands['sqlvar'] = SQLVar
- commands['sqltest'] = SQLTest
- commands['sqlgroup'] = SQLGroup
-
-
-class SQLScript(SQLCommand, Persistent):
-
- __implements__ = ISQLScript, IFileContent, IAttributeAnnotatable
-
- def __init__(self, connectionName='', source='', arguments=''):
- self.template = SQLDTML(source)
- self.setConnectionName(connectionName)
- # In our case arguments should be a string that is parsed
- self.setArguments(arguments)
-
- def setArguments(self, arguments):
- 'See ISQLScript'
- assert isinstance(arguments, StringTypes), \
- '"arguments" argument of setArguments() must be a string'
- self._arg_string = arguments
- self._arguments = parseArguments(arguments)
-
- def getArguments(self):
- 'See ISQLScript'
- return self._arguments
-
- def getArgumentsString(self):
- 'See ISQLScript'
- return self._arg_string
+ # See zope.app.interfaces.content.sql.ISQLScript
+ arguments = property(getArgumentsString, setArguments)
def setSource(self, source):
- 'See ISQLScript'
self.template.munge(source)
def getSource(self):
- 'See ISQLScript'
return self.template.read_raw()
+ # See zope.app.interfaces.content.sql.ISQLScript
+ source = property(getSource, setSource)
+
def getTemplate(self):
- 'See ISQLScript'
+ 'See zope.app.interfaces.content.sql.ISQLScript'
return self.template
- def setConnectionName(self, name):
- 'See ISQLScript'
+ def _setConnectionName(self, name):
self._connectionName = name
cache = getCacheForObj(self)
location = getLocationForCache(self)
@@ -826,22 +683,23 @@
if cache and location:
cache.invalidate(location)
- setConnectionName = ContextMethod(setConnectionName)
-
- def getConnectionName(self):
- 'See ISQLScript'
+ def _getConnectionName(self):
return self._connectionName
def getConnection(self):
- 'See ISQLCommand'
connection_service = getService(self, "SQLDatabaseConnections")
connection = connection_service.getConnection(self.connectionName)
return connection
getConnection = ContextMethod(getConnection)
+ # See zope.app.interfaces.content.sql.ISQLScript
+ # We need to preserve the context for connectionName, so we make it
+ # a ContextProperty instead of a property
+ connectionName = ContextProperty(_getConnectionName, _setConnectionName)
+
def __call__(self, **kw):
- 'See ISQLCommand'
+ 'See zope.app.interfaces.rdb'
# Try to resolve arguments
arg_values = {}
@@ -851,38 +709,31 @@
try:
# Try to find argument in keywords
arg_values[name] = kw[name]
- # XXX Bare Except!
- except:
+ except KeyError:
# Okay, the first try failed, so let's try to find the default
arg = self._arguments[name]
try:
arg_values[name] = arg['default']
- # XXX Bare except!
- except:
+ except KeyError:
# Now the argument might be optional anyways; let's check
try:
if not arg['optional']:
missing.append(name)
- # XXX Bare except!
- except:
+ except KeyError:
missing.append(name)
try:
connection = self.getConnection()
- except AttributeError:
+ except KeyError:
raise AttributeError, (
- "The database connection **%s** cannot be found." % (
+ "The database connection '%s' cannot be found." % (
self.connectionName))
- if connection is None:
- raise 'Database Error', (
- '%s is not connected to a database' %'foo')# self.id)
-
query = apply(self.template, (), arg_values)
cache = getCacheForObj(self)
location = getLocationForCache(self)
if cache and location:
- _marker = []
+ _marker = object()
result = cache.query(location, {'query': query}, default=_marker)
if result is not _marker:
return result
@@ -892,15 +743,6 @@
return result
__call__ = ContextMethod(__call__)
-
-
- # See ISQLScript
- arguments = property(getArgumentsString, setArguments, None,
- "Set the arguments that are used for the SQL Script.")
- source = property(getSource, setSource, None,
- "Set the SQL template source.")
- connectionName = property(getConnectionName, setConnectionName, None,
- "Connection Name for the SQL scripts.")
-
+
valid_type = {'int':1, 'float':1, 'string':1, 'nb': 1}.has_key
=== Zope3/src/zope/app/content/xmldocument.py 1.3 => 1.3.14.1 ===
--- Zope3/src/zope/app/content/xmldocument.py:1.3 Fri Apr 11 10:44:27 2003
+++ Zope3/src/zope/app/content/xmldocument.py Sun Jun 22 10:22:57 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.10 => 1.10.12.1 ===
--- Zope3/src/zope/app/content/zpt.py:1.10 Fri Apr 18 14:45:01 2003
+++ Zope3/src/zope/app/content/zpt.py Sun Jun 22 10:22:57 2003
@@ -19,9 +19,9 @@
from persistence import Persistent
-from zope.proxy.context import ContextMethod
-from zope.proxy.context import getWrapperContainer
-from zope.proxy.introspection import removeAllProxies
+from zope.context import ContextMethod
+from zope.context import getWrapperContainer
+from zope.proxy import removeAllProxies
from zope.security.proxy import ProxyFactory
from zope.pagetemplate.pagetemplate import PageTemplate
@@ -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):