38
38
interface. This is because IBuddy hasn't been defined yet. When we
39
39
define IBuddy, we can use IBuddyFolder directly:
41
>>> class IBuddy(IContained):
42
... containers(IBuddyFolder)
41
>>> class IBuddy(IContained):
42
... containers(IBuddyFolder)
45
45
Now, with these interfaces in place, we can define Buddy and
46
46
BuddyFolder classes and verify that we can put buddies in buddy
49
>>> from zope import interface
52
... interface.implements(IBuddy)
54
>>> class BuddyFolder:
55
... interface.implements(IBuddyFolder)
57
>>> from zope.container.constraints import checkObject, checkFactory
58
>>> from zope.component.factory import Factory
60
>>> checkObject(BuddyFolder(), 'x', Buddy())
61
>>> checkFactory(BuddyFolder(), 'x', Factory(Buddy))
49
>>> from zope import interface
52
... interface.implements(IBuddy)
54
>>> class BuddyFolder:
55
... interface.implements(IBuddyFolder)
57
>>> from zope.container.constraints import checkObject, checkFactory
58
>>> from zope.component.factory import Factory
60
>>> checkObject(BuddyFolder(), 'x', Buddy())
61
>>> checkFactory(BuddyFolder(), 'x', Factory(Buddy))
64
64
If we try to use other containers or folders, we'll get errors:
67
... interface.implements(IContainer)
70
... interface.implements(IContained)
72
>>> checkObject(Container(), 'x', Buddy())
73
... # doctest: +ELLIPSIS
74
Traceback (most recent call last):
75
InvalidContainerType: ...
77
>>> checkFactory(Container(), 'x', Factory(Buddy))
80
>>> checkObject(BuddyFolder(), 'x', Contained())
81
... # doctest: +ELLIPSIS
82
Traceback (most recent call last):
85
>>> checkFactory(BuddyFolder(), 'x', Factory(Contained))
67
... interface.implements(IContainer)
70
... interface.implements(IContained)
72
>>> checkObject(Container(), 'x', Buddy())
73
... # doctest: +ELLIPSIS
74
Traceback (most recent call last):
75
InvalidContainerType: ...
77
>>> checkFactory(Container(), 'x', Factory(Buddy))
80
>>> checkObject(BuddyFolder(), 'x', Contained())
81
... # doctest: +ELLIPSIS
82
Traceback (most recent call last):
85
>>> checkFactory(BuddyFolder(), 'x', Factory(Contained))
88
88
In the example, we defined the container first and then the items. We
89
89
could have defined these in the opposite order:
91
>>> class IContact(IContained):
92
... containers('.IContacts')
94
>>> class IContacts(IContainer):
95
... contains(IContact)
98
... interface.implements(IContact)
101
... interface.implements(IContacts)
103
>>> checkObject(Contacts(), 'x', Contact())
105
>>> checkFactory(Contacts(), 'x', Factory(Contact))
108
>>> checkObject(Contacts(), 'x', Buddy())
109
... # doctest: +ELLIPSIS
110
Traceback (most recent call last):
113
>>> checkFactory(Contacts(), 'x', Factory(Buddy))
91
>>> class IContact(IContained):
92
... containers('.IContacts')
94
>>> class IContacts(IContainer):
95
... contains(IContact)
98
... interface.implements(IContact)
101
... interface.implements(IContacts)
103
>>> checkObject(Contacts(), 'x', Contact())
105
>>> checkFactory(Contacts(), 'x', Factory(Contact))
108
>>> checkObject(Contacts(), 'x', Buddy())
109
... # doctest: +ELLIPSIS
110
Traceback (most recent call last):
113
>>> checkFactory(Contacts(), 'x', Factory(Buddy))
116
The constraints prevent us from moving a container beneath itself (either into
117
itself or another folder beneath it):
119
>>> container = Container()
120
>>> checkObject(container, 'x', container)
121
Traceback (most recent call last):
122
TypeError: Cannot add an object to itself or its children.
124
>>> import zope.location.interfaces
125
>>> import zope.interface
126
>>> subcontainer = Container()
127
>>> zope.interface.directlyProvides(subcontainer,
128
... zope.location.interfaces.ILocation)
129
>>> subcontainer.__parent__ = container
130
>>> checkObject(subcontainer, 'x', container)
131
Traceback (most recent call last):
132
TypeError: Cannot add an object to itself or its children.
124
140
-------------------
126
- Added not declared, but needed test dependency on `zope.testing`.
142
- Fix detection of moving folders into itself or a subfolder of itself.
145
- Fixed ZCML-related tests and dependencies.
147
- Added ``zcml`` extra dependencies.
129
149
3.11.1 (2010-04-30)
130
150
-------------------
178
198
------------------
180
200
- Previous releases should be versioned 3.9.0 as they are not pure bugfix
181
releases and worth a "feature" release, increasing feature version.
183
Packages that depend on any changes introduced in version 3.8.2 or 3.8.3
184
should depend on version 3.9 or greater.
201
releases and worth a "feature" release, increasing feature version.
203
Packages that depend on any changes introduced in version 3.8.2 or 3.8.3
204
should depend on version 3.9 or greater.
186
206
3.8.3 (2009-08-27)
187
207
------------------
189
209
- Move IXMLRPCPublisher ZCML registrations for containers from
190
zope.app.publisher.xmlrpc to zope.container for now.
210
zope.app.publisher.xmlrpc to zope.container for now.
192
212
3.8.2 (2009-05-17)
193
213
------------------
195
215
- Rid ourselves of ``IContained`` interface. This interface was moved
196
to ``zope.location.interfaces``. A b/w compat import still exists
197
to keep old code running. Depend on ``zope.location``>=3.5.4.
216
to ``zope.location.interfaces``. A b/w compat import still exists
217
to keep old code running. Depend on ``zope.location``>=3.5.4.
199
219
- Rid ourselves of the implementations of ``IObjectMovedEvent``,
200
``IObjectAddedEvent``, ``IObjectRemovedEvent`` interfaces and
201
``ObjectMovedEvent``, ``ObjectAddedEvent`` and
202
``ObjectRemovedEvent`` classes. B/w compat imports still exist.
203
All of these were moved to ``zope.lifecycleevent``. Depend on
204
``zope.lifecycleevent``>=3.5.2.
220
``IObjectAddedEvent``, ``IObjectRemovedEvent`` interfaces and
221
``ObjectMovedEvent``, ``ObjectAddedEvent`` and
222
``ObjectRemovedEvent`` classes. B/w compat imports still exist.
223
All of these were moved to ``zope.lifecycleevent``. Depend on
224
``zope.lifecycleevent``>=3.5.2.
206
226
- Fix a bug in OrderedContainer where trying to set the value for a
207
key that already exists (duplication error) would actually delete the
208
key from the order, leaving a dangling reference.
227
key that already exists (duplication error) would actually delete the
228
key from the order, leaving a dangling reference.
210
230
- Partially break dependency on ``zope.traversing`` by disusing
211
zope.traversing.api.getPath in favor of using
212
ILocationInfo(object).getPath(). The rest of the runtime
213
dependencies on zope.traversing are currently interface
231
zope.traversing.api.getPath in favor of using
232
ILocationInfo(object).getPath(). The rest of the runtime
233
dependencies on zope.traversing are currently interface
216
236
- Break runtime dependency on ``zope.app.dependable`` by using a zcml
217
condition on the qsubscriber ZCML directive that registers the
218
CheckDependency handler for IObjectRemovedEvent. If
219
``zope.app.dependable`` is not installed, this subscriber will never
220
be registered. ``zope.app.dependable`` is now a testing dependency
237
condition on the qsubscriber ZCML directive that registers the
238
CheckDependency handler for IObjectRemovedEvent. If
239
``zope.app.dependable`` is not installed, this subscriber will never
240
be registered. ``zope.app.dependable`` is now a testing dependency
223
243
3.8.1 (2009-04-03)
224
244
------------------
230
250
------------------
232
252
- Change configure.zcml to not depend on zope.app.component.
233
Fixes: https://bugs.launchpad.net/bugs/348329
253
Fixes: https://bugs.launchpad.net/bugs/348329
235
255
- Moved the declaration of ``IOrderedContainer.updateOrder`` to a new, basic
236
``IOrdered`` interface and let ``IOrderedContainer`` inherit it. This allows
237
easier reuse of the declaration.
256
``IOrdered`` interface and let ``IOrderedContainer`` inherit it. This allows
257
easier reuse of the declaration.
239
259
3.7.2 (2009-03-12)
240
260
------------------
242
- Fix: added missing ComponentLookupError, missing since revision 95429 and
243
missing in last release.
262
- Fix: added missing ComponentLookupError, missing since revision 95429 and
263
missing in last release.
245
265
- Adapt to the move of IDefaultViewName from zope.component.interfaces
246
to zope.publisher.interfaces.
266
to zope.publisher.interfaces.
248
268
- Add support for reserved names for containers. To specify reserved
249
names for some container, you need to provide an adapter from the
250
container to the ``zope.container.interfaces.IReservedNames`` interface.
251
The default NameChooser is now also aware of reserved names.
269
names for some container, you need to provide an adapter from the
270
container to the ``zope.container.interfaces.IReservedNames`` interface.
271
The default NameChooser is now also aware of reserved names.
253
273
3.7.1 (2009-02-05)
254
274
------------------
256
276
- Raise more "Pythonic" errors from ``__setitem__``, losing the dependency
257
on ``zope.exceptions``:
259
o ``zope.exceptions.DuplicationError`` -> ``KeyError``
261
o ``zope.exceptions.UserError`` -> ``ValueError``
277
on ``zope.exceptions``:
279
o ``zope.exceptions.DuplicationError`` -> ``KeyError``
281
o ``zope.exceptions.UserError`` -> ``ValueError``
263
283
- Moved import of ``IBroken`` interface to use new ``zope.broken``
264
package, which has no dependencies beyond ``zope.interface``.
284
package, which has no dependencies beyond ``zope.interface``.
266
286
- Made ``test`` part pull in the extra test requirements of this package.
268
288
- Split the ``z3c.recipe.compattest`` configuration out into a new file,
269
``compat.cfg``, to reduce the burden of doing standard unit tests.
289
``compat.cfg``, to reduce the burden of doing standard unit tests.
271
291
- Stripped out bogus develop eggs from ``buildout.cfg``.