Hello,
I would like to break the dep cycle between zope.container and
zope.filerepresentation. I already prepared the two patches (attached to
this e-mail), but I'm not confident enough with the zope3 repository to
check in them without asking for comments.
Is this the right way to break the dependency? I think nobody really uses
zope.filerepresentation, so transforming it into a dummy package which just
imports things from zope.container.interface is ok.
Thanks in advance,
Fabio
Index: src/zope/filerepresentation/interfaces.py
===================================================================
--- src/zope/filerepresentation/interfaces.py (revisione 101720)
+++ src/zope/filerepresentation/interfaces.py (copia locale)
@@ -86,59 +86,7 @@
"""
__docformat__ = 'restructuredtext'
-from zope.interface import Interface
-from zope.container.interfaces import IReadContainer, IWriteContainer
+### BBB: these interfaces have been moved to zope.container.interfaces
+from zope.container.interfaces import IReadFile, IWriteFile, IReadDirectory, \
+ IWriteDirectory, IDirectoryFactory, IFileFactory
-class IReadFile(Interface):
- """Provide read access to file data
- """
-
- def read():
- """Return the file data
- """
-
- def size():
- """Return the data length
- """
-
-class IWriteFile(Interface):
-
- def write(data):
- """Update the file data
- """
-
-# TODO: We will add ILargeReadFile and ILargeWriteFile to efficiently
-# handle large data.
-
-class IReadDirectory(IReadContainer):
- """Objects that should be treated as directories for reading
- """
-
-class IWriteDirectory(IWriteContainer):
- """Objects that should be treated as directories for writing
- """
-
-class IDirectoryFactory(Interface):
-
- def __call__(name):
- """Create a directory
-
- where a directory is an object with adapters to IReadDirectory
- and IWriteDirectory.
-
- """
-
-class IFileFactory(Interface):
-
- def __call__(name, content_type, data):
- """Create a file
-
- where a file is an object with adapters to `IReadFile`
- and `IWriteFile`.
-
- The file `name`, content `type`, and `data` are provided to help
- create the object.
- """
-
-# TODO: we will add additional interfaces for WebDAV and File-system
-# synchronization.
Index: setup.py
===================================================================
--- setup.py (revisione 101720)
+++ setup.py (copia locale)
@@ -51,8 +51,7 @@
test=['zope.testing',
]),
install_requires=['setuptools',
- 'zope.interface',
- 'zope.container'
+ 'zope.container >= 3.8.3'
],
include_package_data=True,
zip_safe=True,
Index: CHANGES.txt
===================================================================
--- CHANGES.txt (revisione 101720)
+++ CHANGES.txt (copia locale)
@@ -5,8 +5,10 @@
3.8.3 (unreleased)
------------------
-- ...
+- Moved interfaces from zope.filerepresentation to zope.container.interfaces.
+- Removed dependency on zope.filerepresentation.
+
3.8.2 (2009-05-17)
------------------
Index: src/zope/container/configure.zcml
===================================================================
--- src/zope/container/configure.zcml (revisione 101720)
+++ src/zope/container/configure.zcml (copia locale)
@@ -13,26 +13,26 @@
<adapter
for=".interfaces.IReadContainer"
- provides="zope.filerepresentation.interfaces.IReadDirectory"
+ provides=".interfaces.IReadDirectory"
factory=".directory.noop"
/>
<adapter
for=".interfaces.IWriteContainer"
- provides="zope.filerepresentation.interfaces.IWriteDirectory"
+ provides=".interfaces.IWriteDirectory"
factory=".directory.noop"
/>
<adapter
for=".interfaces.IContentContainer"
- provides="zope.filerepresentation.interfaces.IDirectoryFactory"
+ provides=".interfaces.IDirectoryFactory"
factory=".directory.Cloner"
permission="zope.ManageContent"
/>
<adapter
for=".interfaces.IContentContainer"
- provides="zope.filerepresentation.interfaces.IReadDirectory"
+ provides=".interfaces.IReadDirectory"
factory=".directory.ReadDirectory"
permission="zope.View"
/>
Index: src/zope/container/directory.py
===================================================================
--- src/zope/container/directory.py (revisione 101720)
+++ src/zope/container/directory.py (copia locale)
@@ -27,9 +27,9 @@
from zope.interface import implements
+from zope.container.interfaces import IDirectoryFactory
from zope.location.interfaces import ISite
from zope.security.proxy import removeSecurityProxy
-import zope.filerepresentation.interfaces
MARKER = object()
@@ -49,7 +49,7 @@
of the same class as it's context.
"""
- implements(zope.filerepresentation.interfaces.IDirectoryFactory)
+ implements(IDirectoryFactory)
def __init__(self, context):
self.context = context
Index: src/zope/container/interfaces.py
===================================================================
--- src/zope/container/interfaces.py (revisione 101720)
+++ src/zope/container/interfaces.py (copia locale)
@@ -291,3 +291,129 @@
def matches(id):
"""Return True if the id matches the filter criteria."""
+
+
+##############################################################################
+# File-system representation interfaces
+#
+# The interfaces defined here are used for file-system and
+# file-system-like representations of objects, such as file-system
+# synchronization, FTP, PUT, and WebDAV.
+#
+# There are three issues we need to deal with:
+#
+# File system representation
+#
+# Every object is either a directory or a file.
+#
+# Properties
+#
+# There are two kinds of proprties:
+#
+# - Data properties
+#
+# Data properties are handled directly by the object implementation.
+#
+# - Meta-data properties
+#
+# Meta data properties are handled via annotations.
+#
+# Completeness
+#
+# We must have a complete lossless data representation for file-system
+# synchronization. This is achieved through serialization of:
+#
+# - All annotations (not just properties, and
+#
+# - Extra data.
+#
+# Strategies for common access mechanisms:
+#
+# FTP
+#
+# - For getting directory info (statish) information:
+#
+# - Use Zope DublinCore to get modification times
+#
+# - Show as readable if we can access a read method.
+#
+# - Show as writable if we can access a write method.
+#
+# FTP and WebDAV
+#
+# - Treat as a directory if there is an adapter to `IReadDirectory`.
+# Treat as a file otherwise.
+#
+# - For creating objects:
+#
+# - Directories:
+#
+# Look for an `IDirectoryFactory` adapter.
+#
+# - Files
+#
+# First lookj for a `IFileFactory` adapter with a name that is
+# the same as the extention (e.g. ".pt").
+#
+# Then look for an unnamed `IFileFactory` adapter.
+#
+#
+# File-system synchronization
+#
+# Because this must be lossless, we will use class-based adapters
+# for this, but we want to make it as easy as possible to use other
+# adapters as well.
+#
+# For reading, there must be a class adapter to `IReadSync`. We will
+# then apply rules similar to those above.
+
+
+class IReadFile(Interface):
+ """Provide read access to file data
+ """
+
+ def read():
+ """Return the file data
+ """
+
+ def size():
+ """Return the data length
+ """
+
+class IWriteFile(Interface):
+
+ def write(data):
+ """Update the file data
+ """
+
+
+class IReadDirectory(IReadContainer):
+ """Objects that should be treated as directories for reading
+ """
+
+class IWriteDirectory(IWriteContainer):
+ """Objects that should be treated as directories for writing
+ """
+
+
+class IDirectoryFactory(Interface):
+
+ def __call__(name):
+ """Create a directory
+
+ where a directory is an object with adapters to IReadDirectory
+ and IWriteDirectory.
+
+ """
+
+class IFileFactory(Interface):
+
+ def __call__(name, content_type, data):
+ """Create a file
+
+ where a file is an object with adapters to `IReadFile`
+ and `IWriteFile`.
+
+ The file `name`, content `type`, and `data` are provided to help
+ create the object.
+ """
Index: setup.py
===================================================================
--- setup.py (revisione 101720)
+++ setup.py (copia locale)
@@ -74,7 +74,6 @@
'zope.security',
'zope.lifecycleevent>=3.5.2',
'zope.i18nmessageid',
- 'zope.filerepresentation',
'zope.size',
'zope.traversing',
'zope.publisher',
_______________________________________________
Zope-Dev maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )