diff options
author | Roger Ineichen <roger@projekt01.ch> | 2008-12-11 02:38:56 +0000 |
---|---|---|
committer | Roger Ineichen <roger@projekt01.ch> | 2008-12-11 02:38:56 +0000 |
commit | 1ff19868327a0291082c016c4799dfa28734aaa7 (patch) | |
tree | c822782b08fc513f5041d163a7c2e9b7d3dfaa51 /src | |
download | zope-browser-1ff19868327a0291082c016c4799dfa28734aaa7.tar.gz |
implemented zope.browser, including an ITerms interface definition take from zope.app.form.browser.interfaces
added buildout scripts
added tests
Diffstat (limited to 'src')
-rw-r--r-- | src/zope/__init__.py | 7 | ||||
-rw-r--r-- | src/zope/browser/README.txt | 23 | ||||
-rw-r--r-- | src/zope/browser/__init__.py | 1 | ||||
-rw-r--r-- | src/zope/browser/interfaces.py | 36 | ||||
-rw-r--r-- | src/zope/browser/tests.py | 32 |
5 files changed, 99 insertions, 0 deletions
diff --git a/src/zope/__init__.py b/src/zope/__init__.py new file mode 100644 index 0000000..c2c4975 --- /dev/null +++ b/src/zope/__init__.py @@ -0,0 +1,7 @@ +# this is a namespace package
+try:
+ import pkg_resources
+ pkg_resources.declare_namespace(__name__)
+except ImportError:
+ import pkgutil
+ __path__ = pkgutil.extend_path(__path__, __name__)
diff --git a/src/zope/browser/README.txt b/src/zope/browser/README.txt new file mode 100644 index 0000000..822f549 --- /dev/null +++ b/src/zope/browser/README.txt @@ -0,0 +1,23 @@ +======
+README
+======
+
+This package provides shared browser components for Zope 3.
+
+
+ITerms
+------
+
+The ITerms interface is used as a base for ISource widget implementations. This
+interfaces get used by zope.app.form and was initially defined in
+zope.app.form.browser.interfaces.py. This makes it impossible to use for other
+packages like z3c.form wihtout to depend on zope.app.form. Moving such base
+components or interfaces to zope.browser will make it possible to share such
+base components.
+
+There is not much we can test except that ITerms is importable and an interface:
+
+ >>> import zope.interface
+ >>> from zope.browser import interfaces
+ >>> zope.interface.Interface.providedBy(interfaces.ITerms)
+ True
diff --git a/src/zope/browser/__init__.py b/src/zope/browser/__init__.py new file mode 100644 index 0000000..e7ae9de --- /dev/null +++ b/src/zope/browser/__init__.py @@ -0,0 +1 @@ +# make a package
diff --git a/src/zope/browser/interfaces.py b/src/zope/browser/interfaces.py new file mode 100644 index 0000000..e212bb0 --- /dev/null +++ b/src/zope/browser/interfaces.py @@ -0,0 +1,36 @@ +##############################################################################
+#
+# Copyright (c) 2004 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.
+#
+##############################################################################
+"""Shared dependency less Zope3 brwoser components.
+
+$Id:$
+"""
+
+import zope.interface
+
+__docformat__ = 'restructuredtext'
+
+
+class ITerms(zope.interface.Interface):
+
+ def getTerm(value):
+ """Return an ITitledTokenizedTerm object for the given value
+
+ LookupError is raised if the value isn't in the source
+ """
+
+ def getValue(token):
+ """Return a value for a given identifier token
+
+ LookupError is raised if there isn't a value in the source.
+ """
diff --git a/src/zope/browser/tests.py b/src/zope/browser/tests.py new file mode 100644 index 0000000..dac1209 --- /dev/null +++ b/src/zope/browser/tests.py @@ -0,0 +1,32 @@ +##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""
+$Id:$
+"""
+__docformat__ = "reStructuredText"
+
+import unittest
+from zope.testing import doctest
+
+
+def test_suite():
+ return unittest.TestSuite((
+ doctest.DocFileSuite('README.txt',
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+ ),
+ ))
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
|