Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zope-container
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
zope-container
Commits
22b2ded0
Commit
22b2ded0
authored
Dec 15, 2009
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Break testing dependency on zope.app.dependable by moving the code and tests into that package.
parent
0c7c39e3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
97 deletions
+10
-97
CHANGES.txt
CHANGES.txt
+5
-2
setup.py
setup.py
+2
-4
src/zope/container/configure.zcml
src/zope/container/configure.zcml
+0
-7
src/zope/container/dependency.py
src/zope/container/dependency.py
+3
-32
src/zope/container/tests/test_dependency.py
src/zope/container/tests/test_dependency.py
+0
-52
No files found.
CHANGES.txt
View file @
22b2ded0
...
...
@@ -2,8 +2,11 @@
CHANGES
=======
3.9.2 (Unreleased)
------------------
3.10.0 (Unreleased)
-------------------
- Break testing dependency on zope.app.dependable by moving the code and tests
into that package.
- Import ISite from zope.component after it was moved there from
zope.location.
...
...
setup.py
View file @
22b2ded0
...
...
@@ -27,7 +27,7 @@ def read(*rnames):
return
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
rnames
)).
read
()
setup
(
name
=
'zope.container'
,
version
=
'3.
9.2
dev'
,
version
=
'3.
10.0
dev'
,
author
=
'Zope Corporation and Contributors'
,
author_email
=
'zope-dev@zope.org'
,
description
=
'Zope Container'
,
...
...
@@ -40,7 +40,7 @@ setup(name='zope.container',
+
'
\
n
\
n
'
+
read
(
'CHANGES.txt'
)
),
keywords
=
"zope
3
container"
,
keywords
=
"zope container"
,
classifiers
=
[
'Development Status :: 5 - Production/Stable'
,
'Environment :: Web Environment'
,
...
...
@@ -65,8 +65,6 @@ setup(name='zope.container',
extras_require
=
dict
(
test
=
[
'zope.copypastemove'
,
'zope.app.testing'
,
'zope.app.component'
,
'zope.app.dependable'
,
]),
install_requires
=
[
'setuptools'
,
'zope.interface'
,
...
...
src/zope/container/configure.zcml
View file @
22b2ded0
...
...
@@ -56,13 +56,6 @@
factory=".contained.NameChooser"
/>
<subscriber
zcml:condition="installed zope.app.dependable"
handler=".dependency.CheckDependency"
for="zope.lifecycleevent.interfaces.IObjectRemovedEvent"
trusted="y"
/>
<subscriber
for="zope.location.interfaces.ILocation
zope.lifecycleevent.interfaces.IObjectMovedEvent"
...
...
src/zope/container/dependency.py
View file @
22b2ded0
...
...
@@ -12,35 +12,6 @@
#
##############################################################################
"""Subscriber function checking dependencies if a removal is performed
on an object having dependencies. It raises an exception if it's the
case.
$Id$
"""
__docformat__
=
'restructuredtext'
from
zope.i18nmessageid
import
Message
from
zope.container.i18n
import
ZopeMessageFactory
as
_
from
zope.app.dependable.interfaces
import
IDependable
,
DependencyError
from
zope.location.interfaces
import
ILocationInfo
exception_msg
=
_
(
"""
Removal of object (${object}) which has dependents (${dependents})
is not possible !
You must deactivate this object before trying to remove it.
"""
)
def
CheckDependency
(
event
):
object
=
event
.
object
dependency
=
IDependable
(
object
,
None
)
if
dependency
is
not
None
:
dependents
=
dependency
.
dependents
()
if
dependents
:
mapping
=
{
"object"
:
ILocationInfo
(
object
).
getPath
(),
"dependents"
:
", "
.
join
(
dependents
)
}
raise
DependencyError
(
Message
(
exception_msg
,
mapping
=
mapping
))
# BBB imports
from
zope.app.dependable.dependency
import
exception_msg
from
zope.app.dependable.dependency
import
CheckDependency
src/zope/container/tests/test_dependency.py
deleted
100644 → 0
View file @
0c7c39e3
##############################################################################
#
# Copyright (c) 2008 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test the CheckDependency event subscriber.
$Id$
"""
import
unittest
from
zope.interface
import
implements
from
zope.app.dependable.interfaces
import
IDependable
,
DependencyError
from
zope.lifecycleevent
import
ObjectRemovedEvent
from
zope.container.dependency
import
CheckDependency
from
zope.traversing.interfaces
import
IPhysicallyLocatable
class
DummyObject
(
object
):
implements
(
IDependable
,
IPhysicallyLocatable
)
def
dependents
(
self
):
return
[
'dependency1'
,
'dependency2'
]
def
getPath
(
self
):
return
'/dummy-object'
class
Test
(
unittest
.
TestCase
):
def
testCheckDependency
(
self
):
obj
=
DummyObject
()
parent
=
object
()
event
=
ObjectRemovedEvent
(
obj
,
parent
,
'oldName'
)
self
.
assertRaises
(
DependencyError
,
CheckDependency
,
event
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
Test
),
))
if
__name__
==
'__main__'
:
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment