Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Kirill Smelkov
Zope
Commits
70922ece
Commit
70922ece
authored
Sep 22, 2009
by
Tres Seaver
Browse files
Options
Browse Files
Download
Plain Diff
Backport removal of dependency on zope.app.schema from trunk.
parents
6bfb801b
24d87feb
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
6 deletions
+105
-6
ZOPE_APP_DEPENDENCIES.rst
ZOPE_APP_DEPENDENCIES.rst
+3
-3
doc/CHANGES.rst
doc/CHANGES.rst
+3
-0
src/Products/Five/__init__.py
src/Products/Five/__init__.py
+4
-3
src/Products/Five/schema.py
src/Products/Five/schema.py
+36
-0
src/Products/Five/tests/test_schema.py
src/Products/Five/tests/test_schema.py
+59
-0
No files found.
ZOPE_APP_DEPENDENCIES.rst
View file @
70922ece
...
...
@@ -36,9 +36,9 @@ Zope2 depends on the following zope.app packages directly:
o Products.Five.form.metaconfigure (for ``menuItemDirective``)
o Products.Five.fivedirectives (for ``IBasicResourceInformation``)
- [
_
] zope.app.schema
o Products.Five
- [
X
] zope.app.schema
* Products.Five (imports ``zope.app.schema.vocabulary`` for
side-effects ?!).
Zope2 has transitive dependencies on these packages:
...
...
doc/CHANGES.rst
View file @
70922ece
...
...
@@ -15,6 +15,9 @@ Features Added
- ZODB3 = 3.9.0
- Backported clone of ``ZopeVocabularyRegistry`` from ``zope.app.schema``, and
sane registration of it during initialization of Five product.
Bugs Fixed
++++++++++
...
...
src/Products/Five/__init__.py
View file @
70922ece
...
...
@@ -22,13 +22,14 @@ from Products.Five import zcml
from
Products.Five.browser
import
BrowserView
from
Products.Five.skin.standardmacros
import
StandardMacros
# hook up ZopeVocabularyRegistry
import
zope.app.schema.vocabulary
# load the site's ZCML tree (usually site.zcml) upon product
# initialization
def
initialize
(
context
):
from
zope.schema.vocabulary
import
setVocabularyRegistry
from
Products.Five.schema
import
Zope2VocabularyRegistry
zcml
.
load_site
()
setVocabularyRegistry
(
Zope2VocabularyRegistry
())
# some convenience methods/decorators
...
...
src/Products/Five/schema.py
0 → 100644
View file @
70922ece
##############################################################################
#
# Copyright (c) 2004, 2005 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.
#
##############################################################################
"""Five-specific schema support
$Id$
"""
from
zope.component
import
getUtility
from
zope.interface
import
implements
from
zope.schema.interfaces
import
IVocabularyRegistry
from
zope.schema.interfaces
import
IVocabularyFactory
class
Zope2VocabularyRegistry
(
object
):
"""IVocabularyRegistry that supports global and local utilities.
Cloned from the version in zope.app.schema.vocabulary: it was the
only feature in that package!
"""
implements
(
IVocabularyRegistry
)
__slots__
=
()
def
get
(
self
,
context
,
name
):
"""See zope.schema.interfaces.IVocabularyRegistry.
"""
factory
=
getUtility
(
IVocabularyFactory
,
name
)
return
factory
(
context
)
src/Products/Five/tests/test_schema.py
0 → 100644
View file @
70922ece
##############################################################################
#
# Copyright (c) 2006 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.
#
##############################################################################
""" Unit tests for Products.Five.schema module.
$Id: tests.py 71093 2006-11-07 13:54:29Z yuppie $
"""
import
unittest
from
zope.testing.cleanup
import
CleanUp
class
Zope2VocabularyRegistryTests
(
unittest
.
TestCase
,
CleanUp
):
def
_getTargetClass
(
self
):
from
Products.Five.schema
import
Zope2VocabularyRegistry
return
Zope2VocabularyRegistry
def
_makeOne
(
self
):
return
self
.
_getTargetClass
()()
def
test_class_conforms_to_IVocabularyRegistry
(
self
):
from
zope.interface.verify
import
verifyClass
from
zope.schema.interfaces
import
IVocabularyRegistry
verifyClass
(
IVocabularyRegistry
,
self
.
_getTargetClass
())
def
test_instance_conforms_to_IVocabularyRegistry
(
self
):
from
zope.interface.verify
import
verifyObject
from
zope.schema.interfaces
import
IVocabularyRegistry
verifyObject
(
IVocabularyRegistry
,
self
.
_makeOne
())
def
test_get_miss_raises_LookupError
(
self
):
registry
=
self
.
_makeOne
()
context
=
object
()
self
.
assertRaises
(
LookupError
,
registry
.
get
,
context
,
'nonesuch'
)
def
test_get_hit_finds_registered_IVocabularyFactory
(
self
):
from
zope.component
import
provideUtility
from
zope.schema.interfaces
import
IVocabularyFactory
_marker
=
object
()
def
_factory
(
context
):
return
_marker
provideUtility
(
_factory
,
IVocabularyFactory
,
'foundit'
)
registry
=
self
.
_makeOne
()
context
=
object
()
found
=
registry
.
get
(
context
,
'foundit'
)
self
.
failUnless
(
found
is
_marker
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
Zope2VocabularyRegistryTests
),
))
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