[Checkins] SVN: zam.api/ Move implementation form private repos to svn.zope.org

Roger Ineichen roger at projekt01.ch
Sat Feb 16 11:18:39 EST 2008


Log message for revision 83905:
  Move implementation form private repos to svn.zope.org
  

Changed:
  A   zam.api/branches/
  A   zam.api/tags/
  A   zam.api/trunk/
  A   zam.api/trunk/AUTHOR.txt
  A   zam.api/trunk/CHANGES.txt
  A   zam.api/trunk/LICENSE.txt
  A   zam.api/trunk/README.txt
  A   zam.api/trunk/bootstrap.py
  A   zam.api/trunk/buildout.cfg
  A   zam.api/trunk/externals/
  A   zam.api/trunk/setup.py
  A   zam.api/trunk/src/
  A   zam.api/trunk/src/zam/
  A   zam.api/trunk/src/zam/__init__.py
  A   zam.api/trunk/src/zam/api/
  A   zam.api/trunk/src/zam/api/README.txt
  A   zam.api/trunk/src/zam/api/__init__.py
  A   zam.api/trunk/src/zam/api/breadcrumb.py
  A   zam.api/trunk/src/zam/api/breadcrumb.zcml
  A   zam.api/trunk/src/zam/api/browser/
  A   zam.api/trunk/src/zam/api/browser/README.txt
  A   zam.api/trunk/src/zam/api/browser/__init__.py
  A   zam.api/trunk/src/zam/api/browser/configure.zcml
  A   zam.api/trunk/src/zam/api/browser/plugin.py
  A   zam.api/trunk/src/zam/api/browser/plugins.pt
  A   zam.api/trunk/src/zam/api/browser/tests/
  A   zam.api/trunk/src/zam/api/browser/tests/__init__.py
  A   zam.api/trunk/src/zam/api/browser/tests/ftesting.zcml
  A   zam.api/trunk/src/zam/api/browser/tests/index.pt
  A   zam.api/trunk/src/zam/api/browser/tests/template.pt
  A   zam.api/trunk/src/zam/api/browser/tests/test.pt
  A   zam.api/trunk/src/zam/api/browser/tests/test_skin.py
  A   zam.api/trunk/src/zam/api/configure.zcml
  A   zam.api/trunk/src/zam/api/ftesting.zcml
  A   zam.api/trunk/src/zam/api/i18n.py
  A   zam.api/trunk/src/zam/api/interfaces.py
  A   zam.api/trunk/src/zam/api/layer.py
  A   zam.api/trunk/src/zam/api/layer.zcml
  A   zam.api/trunk/src/zam/api/menu.py
  A   zam.api/trunk/src/zam/api/menu.zcml
  A   zam.api/trunk/src/zam/api/menuitem.zcml
  A   zam.api/trunk/src/zam/api/plugin.py
  A   zam.api/trunk/src/zam/api/testing.py
  A   zam.api/trunk/src/zam/api/tests.py

-=-
Added: zam.api/trunk/AUTHOR.txt
===================================================================
--- zam.api/trunk/AUTHOR.txt	                        (rev 0)
+++ zam.api/trunk/AUTHOR.txt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1 @@
+Roger Ineichen (roger <at> projekt01 <dot> ch)


Property changes on: zam.api/trunk/AUTHOR.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/CHANGES.txt
===================================================================
--- zam.api/trunk/CHANGES.txt	                        (rev 0)
+++ zam.api/trunk/CHANGES.txt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,8 @@
+=======
+CHANGES
+=======
+
+Version 0.5.0 (unreleased)
+--------------------------
+
+- Initial Release


Property changes on: zam.api/trunk/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/LICENSE.txt
===================================================================
--- zam.api/trunk/LICENSE.txt	                        (rev 0)
+++ zam.api/trunk/LICENSE.txt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,54 @@
+Zope Public License (ZPL) Version 2.1
+-------------------------------------
+
+A copyright notice accompanies this license document that
+identifies the copyright holders.
+
+This license has been certified as open source. It has also
+been designated as GPL compatible by the Free Software
+Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions in source code must retain the
+   accompanying copyright notice, this list of conditions,
+   and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying
+   copyright notice, this list of conditions, and the
+   following disclaimer in the documentation and/or other
+   materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to
+   endorse or promote products derived from this software
+   without prior written permission from the copyright
+   holders.
+
+4. The right to distribute this software or to use it for
+   any purpose does not give you the right to use
+   Servicemarks (sm) or Trademarks (tm) of the copyright
+   holders. Use of them is covered by separate agreement
+   with the copyright holders.
+
+5. If any files are modified, you must cause the modified
+   files to carry prominent notices stating that you changed
+   the files and the date of any change.
+
+Disclaimer
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+  AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+  NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
+  NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+  DAMAGE.


Property changes on: zam.api/trunk/LICENSE.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/README.txt
===================================================================
--- zam.api/trunk/README.txt	                        (rev 0)
+++ zam.api/trunk/README.txt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1 @@
+This package provides an API for ZAM (Zope Application Management).


Property changes on: zam.api/trunk/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/bootstrap.py
===================================================================
--- zam.api/trunk/bootstrap.py	                        (rev 0)
+++ zam.api/trunk/bootstrap.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 75940 2007-05-24 14:45:00Z srichter $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                     ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+    cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+    os.P_WAIT, sys.executable, sys.executable,
+    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+    dict(os.environ,
+         PYTHONPATH=
+         ws.find(pkg_resources.Requirement.parse('setuptools')).location
+         ),
+    ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)


Property changes on: zam.api/trunk/bootstrap.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/buildout.cfg
===================================================================
--- zam.api/trunk/buildout.cfg	                        (rev 0)
+++ zam.api/trunk/buildout.cfg	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,20 @@
+[buildout]
+develop = .
+          externals/z3c.menu.ready2go
+
+parts = test checker coverage
+
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = zam.api [test]
+
+
+[checker]
+recipe = lovely.recipe:importchecker
+path = src/zam/api
+
+
+[coverage]
+recipe = zc.recipe.egg
+eggs = z3c.coverage

Added: zam.api/trunk/setup.py
===================================================================
--- zam.api/trunk/setup.py	                        (rev 0)
+++ zam.api/trunk/setup.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,73 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Setup
+
+$Id:$
+"""
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+setup (
+    name='zam.api',
+    version='0.5.0',
+    author = "Stephan Richter, Roger Ineichen and the Zope Community",
+    author_email = "zope3-dev at zope.org",
+    description = "API for ZAM (Zope Application Management",
+    long_description=(
+        read('README.txt')
+        + '\n\n' +
+        read('CHANGES.txt')
+        ),
+    license = "ZPL 2.1",
+    keywords = "zope3 z3c zam api",
+    classifiers = [
+        'Development Status :: 4 - Beta',
+        'Environment :: Web Environment',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: Zope Public License',
+        'Programming Language :: Python',
+        'Natural Language :: English',
+        'Operating System :: OS Independent',
+        'Topic :: Internet :: WWW/HTTP',
+        'Framework :: Zope3'],
+    url = 'http://cheeseshop.python.org/pypi/zam.api',
+    packages = find_packages('src'),
+    include_package_data = True,
+    package_dir = {'':'src'},
+    namespace_packages = ['zam'],
+    extras_require = dict(
+        test = [
+            'zope.testbrowser',
+            'zope.app.securitypolicy',
+            'zope.app.testing',
+            'zope.app.twisted',
+            'z3c.sampledata',
+            'z3c.zrtresource',
+            ],
+        ),
+    install_requires = [
+        'setuptools',
+        'z3c.baseregistry',
+        'z3c.breadcrumb',
+        'z3c.layer.pagelet',
+        'z3c.layer.ready2go',
+        'z3c.menu.ready2go',
+        'zc.configuration',
+        'zope.app.intid',
+        ],
+    zip_safe = False,
+)
\ No newline at end of file


Property changes on: zam.api/trunk/setup.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/__init__.py
===================================================================
--- zam.api/trunk/src/zam/__init__.py	                        (rev 0)
+++ zam.api/trunk/src/zam/__init__.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -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__)


Property changes on: zam.api/trunk/src/zam/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/README.txt
===================================================================
--- zam.api/trunk/src/zam/api/README.txt	                        (rev 0)
+++ zam.api/trunk/src/zam/api/README.txt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,154 @@
+====================
+ZAM Plugin Framework
+====================
+
+The plugin framework allows us to write "3rd party" software that depends on
+the base system's API, but the base system does not in any way depend on the
+new software. This allows us to keep the base system compact, and separate
+optional features into clearly separated packages.
+
+There are two different type of plugins offered. A simple plugin can do what it
+needs to do during the install and unistall process. The other base registry
+supported plugin will install a customcomponent registry.
+
+The fundamental concept of the package is that a plugin can be installed for a
+particular site. At any time, you can ask the plugin, whether it has been
+installed for a prticular site. The third API method allows you to uninstall
+the plugin from a site.
+
+So let's implement a trivial plugin that stores an attribute:
+
+  >>> from zam.api import plugin
+
+  >>> class SamplePlugin(plugin.Plugin):
+  ...     title = u'Sample'
+  ...     description = u'Sample Attribute Plugin'
+  ...
+  ...     def isInstalled(self, site):
+  ...         """See interfaces.IPlugin"""
+  ...         return hasattr(site, 'sample')
+  ...
+  ...     def install(self, site):
+  ...         """See interfaces.IPlugin"""
+  ...         if not self.isInstalled(site):
+  ...             setattr(site, 'sample', 1)
+  ...
+  ...     def uninstall(self, site):
+  ...         """See interfaces.IPlugin"""
+  ...         if self.isInstalled(site):
+  ...             delattr(site, 'sample')
+
+The title and description of the plugin serve as pieces of information for the
+user and are commonly used in the UI.
+
+So let's use the sample plugin:
+
+  >>> from zam.api import testing
+  >>> site = testing.ZAMTestSite(u'ZAM Test Site')
+  >>> sm = site.getSiteManager()
+
+  >>> sample = SamplePlugin()
+
+At the beginning the plugin is not installed, so we that first:
+
+  >>> sample.isInstalled(site)
+  False
+
+  >>> sample.install(site)
+  >>> site.sample
+  1
+
+  >>> sample.isInstalled(site)
+  True
+
+However, once the plugin is isntalled, it cannot be installed again:
+
+  >>> site.sample = 2
+
+  >>> sample.install(site)
+  >>> site.sample
+  2
+
+This is a requirement of the API. Now you can also uninstall the plugin:
+
+  >>> sample.uninstall(site)
+  >>> sample.isInstalled(site)
+  False
+  >>> site.sample
+  Traceback (most recent call last):
+  ...
+  AttributeError: 'ZAMTestSite' object has no attribute 'sample'
+
+You cannot uninstall the plugin again:
+
+  >>> sample.uninstall(site)
+
+
+Base Registry Plugins
+---------------------
+
+An important base implementation is a plugin that installs a new base registry
+to the to the site.
+
+We also need a base registry for the plugin:
+
+  >>> import zope.component
+  >>> from z3c.baseregistry import baseregistry
+
+  >>> sampleRegistry = baseregistry.BaseComponents(
+  ...     zope.component.globalSiteManager, 'sampleRegistry')
+
+Now we can create the plugin, either through instantiation or subsclassing:
+
+  >>> class SampleRegistryPlugin(plugin.BaseRegistryPlugin):
+  ...     title = u'Sample Registry'
+  ...     description = u'Sample Registry Plugin'
+  ...     registry = sampleRegistry
+
+  >>> regPlugin = SampleRegistryPlugin()
+
+We use the same API methods as before. Initially the plugin is not installed:
+
+  >>> sampleRegistry in sm.__bases__
+  False
+  >>> regPlugin.isInstalled(site)
+  False
+
+Now we install the plugin:
+
+  >>> regPlugin.install(site)
+
+  >>> sampleRegistry in sm.__bases__
+  True
+  >>> regPlugin.isInstalled(site)
+  True
+
+As before installing the plugin again does nothing:
+
+  >>> len(sm.__bases__)
+  2
+
+  >>> regPlugin.install(site)
+
+  >>> len(sm.__bases__)
+  2
+
+And uninstalling the plugin is equally simple:
+
+  >>> regPlugin.uninstall(site)
+
+  >>> sampleRegistry in sm.__bases__
+  False
+  >>> regPlugin.isInstalled(site)
+  False
+  >>> len(sm.__bases__)
+  1
+
+Uninstalling a second time does nothing:
+
+  >>> regPlugin.uninstall(site)
+
+  >>> sampleRegistry in sm.__bases__
+  False
+  >>> len(sm.__bases__)
+  1


Property changes on: zam.api/trunk/src/zam/api/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/__init__.py
===================================================================
--- zam.api/trunk/src/zam/api/__init__.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/__init__.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1 @@
+# make a package


Property changes on: zam.api/trunk/src/zam/api/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/breadcrumb.py
===================================================================
--- zam.api/trunk/src/zam/api/breadcrumb.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/breadcrumb.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,51 @@
+##############################################################################
+#
+# 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: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
+
+import zope.interface
+import zope.component
+import zope.location.interfaces
+import z3c.breadcrumb.browser
+from zam.api import layer
+
+
+class BreadcrumbProvider(z3c.breadcrumb.browser.Breadcrumbs):
+    """Breadcrumbs implementation using IBreadcrum adapters."""
+
+    zope.component.adapts(zope.location.interfaces.ILocation,
+        layer.IZAMBrowserLayer, zope.interface.Interface)
+
+    def __init__(self, context, request, view):
+        self.context = context
+        self.request = request
+        self.__parent__ = context
+        self.view = view
+
+    def update(self):
+        pass
+
+    def render(self):
+        bStr = u''
+        crumbs = list(self.crumbs)
+        if crumbs:
+            for crumb in crumbs:
+                if crumb['activeURL']:
+                    bStr += ' &gt;&gt; <a href="%s" class="selected">%s</a>' %(
+                        crumb['url'], crumb['name'])
+                else:
+                    bStr += ' &gt;&gt; <a href="%s">%s</a>' % (crumb['url'],
+                        crumb['name'])
+        return bStr


Property changes on: zam.api/trunk/src/zam/api/breadcrumb.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/breadcrumb.zcml
===================================================================
--- zam.api/trunk/src/zam/api/breadcrumb.zcml	                        (rev 0)
+++ zam.api/trunk/src/zam/api/breadcrumb.zcml	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,12 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="zam">
+
+  <!-- IContentProvider -->
+  <adapter
+      name="IBreadcrumbs"
+      factory=".breadcrumb.BreadcrumbProvider"
+      provides="zope.contentprovider.interfaces.IContentProvider"
+      />
+
+</configure>


Property changes on: zam.api/trunk/src/zam/api/breadcrumb.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/README.txt
===================================================================
--- zam.api/trunk/src/zam/api/browser/README.txt	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/README.txt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,180 @@
+======
+README
+======
+
+This package contains the Zope Application Management api. We support a test
+skin for this package which allows us to test the plugin management page.
+There is also a ZAMTest site available whcih this test will use. This test site
+can also be used in any other zam.* or zamplugin.* package.
+
+Login as manager first:
+
+  >>> from zope.testbrowser.testing import Browser
+  >>> manager = Browser()
+  >>> manager.addHeader('Authorization', 'Basic mgr:mgrpw')
+
+Check if we can access the page.html view which is registred in the
+ftesting.zcml file with our skin:
+
+  >>> manager = Browser()
+  >>> manager.handleErrors = False
+  >>> manager.addHeader('Authorization', 'Basic mgr:mgrpw')
+  >>> skinURL = 'http://localhost/++skin++ZAMTest/index.html'
+  >>> manager.open(skinURL)
+  >>> manager.url
+  'http://localhost/++skin++ZAMTest/index.html'
+
+Now let's create a test site called ``first`` and add them to the root:
+
+  >>> import zam.api.testing
+  >>> root = getRootFolder()
+  >>> firstSite = zam.api.testing.ZAMTestSite(u'first')
+  >>> root['first'] = firstSite
+
+And create another one called ``second``:
+
+  >>> secondSite = zam.api.testing.ZAMTestSite(u'second')
+  >>> root['second'] = secondSite
+
+Go the the new zam test site:
+
+  >>> firstSiteURL = 'http://localhost/++skin++ZAMTest/first'
+  >>> manager.open(firstSiteURL + '/index.html')
+  >>> manager.url
+  'http://localhost/++skin++ZAMTest/first/index.html'
+
+and to the ``second`` site:
+
+  >>> secondSiteURL = 'http://localhost/++skin++ZAMTest/second'
+  >>> manager.open(secondSiteURL + '/index.html')
+  >>> manager.url
+  'http://localhost/++skin++ZAMTest/second/index.html'
+
+and go to the ``plugins.html`` page:
+
+  >>> manager.open(firstSiteURL + '/plugins.html')
+
+Now we see the plugins.html page:
+
+  >>> print manager.contents
+  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
+        lang="en">
+  <head>
+  <title>ZAM</title><meta http-equiv="cache-control" content="no-cache" />
+  <meta http-equiv="pragma" content="no-cache" />
+  </head>
+  <body>
+  <form action="http://localhost/++skin++ZAMTest/first/plugins.html"
+        method="post" enctype="multipart/form-data"
+        class="edit-form" name="form" id="form">
+    <div class="viewspace">
+        <div class="required-info">
+           <span class="required">*</span>
+           &ndash; required
+        </div>
+      <div>
+    <h1>ZAM Plugin Management</h1>
+    <fieldset>
+      <legend>
+        ZAM test plugin&nbsp;
+      (not installed)
+    </legend>
+    <br />
+    <div><p>ZAM test plugin.</p>
+  </div>
+    <br />
+    <span>install</span>
+    <input type="radio" class="radio-widget"
+           name="zam.api.testing" value="install">
+    <span>uninstall</span>
+    <input type="radio" class="radio-widget"
+           name="zam.api.testing" value="uninstall"
+           checked="checked">
+     </fieldset>
+    </div>
+    </div>
+    <div>
+      <div class="buttons">
+        <input type="submit" id="form-buttons-apply"
+               name="form.buttons.apply"
+               class="submit-widget button-field" value="Apply" />
+      </div>
+    </div>
+  </form>
+  </body>
+  </html>
+
+Before we install the plugin, we try to access the page which only is available
+if the zam test plugin is installed:
+
+  >>> manager.open(firstSiteURL + '/test.html')
+  Traceback (most recent call last):
+  ...
+  NotFound: Object: <ZAMTestSite u'first'>, name: u'test.html'
+
+The ``second`` site does also not provide such a test page:
+
+  >>> manager.open(secondSiteURL + '/test.html')
+  Traceback (most recent call last):
+  ...
+  NotFound: Object: <ZAMTestSite u'second'>, name: u'test.html'
+
+As you can see there is no such ``test.html`` page. Let's install our zam test
+plugin:
+
+  >>> manager.open(firstSiteURL + '/plugins.html')
+  >>> manager.getControl(name='zam.api.testing').value = ['install']
+  >>> manager.getControl('Apply').click()
+
+Now we can see that the plugin is installed:
+
+  >>> print manager.contents
+  <!DOCTYPE...
+   <input type="radio" class="radio-widget"
+         name="zam.api.testing" value="install"
+         checked="checked">
+  ...
+   <input type="radio" class="radio-widget"
+         name="zam.api.testing" value="uninstall">
+  ...
+
+Now make test coverage happy and test to install a alreay installed
+plugin:
+
+  >>> manager.open(firstSiteURL + '/plugins.html')
+  >>> manager.getControl(name='zam.api.testing').value = ['install']
+  >>> manager.getControl('Apply').click()
+
+And the zam plugin test page is available at the ``first`` site
+
+  >>> manager.open(firstSiteURL + '/test.html')
+  >>> manager.url
+  'http://localhost/++skin++ZAMTest/first/test.html'
+
+But not at the ``second`` site:
+
+  >>> manager.open(secondSiteURL + '/test.html')
+  Traceback (most recent call last):
+  ...
+  NotFound: Object: <ZAMTestSite u'second'>, name: u'test.html'
+
+Let's unsinstall the plugin:
+
+  >>> manager.open(firstSiteURL + '/plugins.html')
+  >>> manager.getControl(name='zam.api.testing').value = ['uninstall']
+  >>> manager.getControl('Apply').click()
+
+And check if the site is not available anymore:
+
+  >>> manager.open(firstSiteURL + '/test.html')
+  Traceback (most recent call last):
+  ...
+  NotFound: Object: <ZAMTestSite u'first'>, name: u'test.html'
+
+Now make test coverage happy and test to uninstall a alreay uninstalled
+plugin:
+
+  >>> manager.open(firstSiteURL + '/plugins.html')
+  >>> manager.getControl(name='zam.api.testing').value = ['uninstall']
+  >>> manager.getControl('Apply').click()


Property changes on: zam.api/trunk/src/zam/api/browser/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/__init__.py
===================================================================
--- zam.api/trunk/src/zam/api/browser/__init__.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/__init__.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1 @@
+# make a package


Property changes on: zam.api/trunk/src/zam/api/browser/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/configure.zcml
===================================================================
--- zam.api/trunk/src/zam/api/browser/configure.zcml	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/configure.zcml	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,21 @@
+<configure
+    xmlns:zope="http://namespaces.zope.org/zope"
+    xmlns="http://namespaces.zope.org/browser"
+    xmlns:z3c="http://namespaces.zope.org/z3c"
+    i18n_domain="zam">
+
+  <z3c:pagelet
+      name="plugins.html"
+      for="zope.location.interfaces.ISite"
+      class=".plugin.PluginsPage"
+      layer="zam.api.layer.IZAMBrowserLayer"
+      permission="zope.ManageSite"
+      />
+
+  <z3c:template
+      template="plugins.pt"
+      for=".plugin.PluginsPage"
+      layer="zam.api.layer.IZAMBrowserLayer"
+      />
+
+</configure>


Property changes on: zam.api/trunk/src/zam/api/browser/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/plugin.py
===================================================================
--- zam.api/trunk/src/zam/api/browser/plugin.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/plugin.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,70 @@
+##############################################################################
+#
+# 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: __init__.py 97 2007-03-29 22:58:27Z rineichen $
+"""
+__docformat__ = "reStructuredText"
+
+import zope.component
+import zope.interface
+from zope.publisher.interfaces import NotFound
+from zope.traversing.interfaces import IContainmentRoot
+from zope.app.pagetemplate import ViewPageTemplateFile
+from zope.app.renderer import rest
+from z3c.pagelet import browser
+from z3c.form import button
+from z3c.formui import form
+
+from z3c.template.template import getPageTemplate
+
+from zam.api import interfaces
+from zam.api.i18n import MessageFactory as _
+
+
+def render(text, request):
+    return rest.ReStructuredTextToHTMLRenderer(text, request).render()
+
+
+class PluginsPage(form.Form):
+    """Plugin management page."""
+
+    template = getPageTemplate()
+
+    successMessage = _('Plugins status successfully changed.')
+    NoChangesMessage = _('No plugin status get changed.')
+
+    def plugins(self):
+        for name, plugin in zope.component.getUtilitiesFor(interfaces.IPlugin):
+            yield {
+                'name': name,
+                'title': plugin.title,
+                'description': render(plugin.description, self.request),
+                'isInstalled': plugin.isInstalled(self.context)
+                }
+
+    @button.buttonAndHandler(_('Apply'), name='apply')
+    def handleApply(self, action):
+        changed = False
+        for name, plugin in zope.component.getUtilitiesFor(interfaces.IPlugin):
+            action = self.request.get(name)
+            if action == 'uninstall' and plugin.isInstalled(self.context):
+                plugin.uninstall(self.context)
+                changed = True
+            elif action == 'install' and not plugin.isInstalled(self.context):
+                plugin.install(self.context)
+                changed = True
+        if changed:
+            self.status = self.successMessage
+        else:
+            self.status = self.NoChangesMessage


Property changes on: zam.api/trunk/src/zam/api/browser/plugin.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/plugins.pt
===================================================================
--- zam.api/trunk/src/zam/api/browser/plugins.pt	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/plugins.pt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,33 @@
+<div metal:use-macro="macro:form">
+  <div metal:fill-slot="main">
+  <h1 i18n:translate="">ZAM Plugin Management</h1>
+  <fieldset tal:repeat="plugin view/plugins">
+    <legend>
+      <tal:block content="plugin/title">Plugin Title</tal:block>&nbsp;
+	  <tal:block condition="plugin/isInstalled" i18n:translate="">(installed)</tal:block>
+	  <tal:block condition="not:plugin/isInstalled" i18n:translate="">(not installed)</tal:block>
+	</legend>
+	<br />
+    <div tal:content="structure plugin/description">
+      Describes the plugin in detail.
+    </div>
+	<br />
+	<span i18n:translate="">install</span>
+	<input type="radio" class="radio-widget" name="" value="install" checked="checked"
+           tal:condition="plugin/isInstalled"
+           tal:attributes="name plugin/name">
+	<input type="radio" class="radio-widget" name="" value="install"
+           tal:condition="not:plugin/isInstalled"
+           tal:attributes="name plugin/name">
+	<span i18n:translate="">uninstall</span>
+	<input type="radio" class="radio-widget" name="" value="uninstall" checked="checked"
+           tal:condition="not:plugin/isInstalled"
+           tal:attributes="name plugin/name">
+	<input type="radio" class="radio-widget" name="" value="uninstall"
+           tal:condition="plugin/isInstalled"
+           tal:attributes="name plugin/name">
+  </fieldset>
+
+  </div>
+</div>
+


Property changes on: zam.api/trunk/src/zam/api/browser/plugins.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/tests/__init__.py
===================================================================
--- zam.api/trunk/src/zam/api/browser/tests/__init__.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/tests/__init__.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,31 @@
+##############################################################################
+#
+# Copyright (c) 2008 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: __init__.py 97 2007-03-29 22:58:27Z rineichen $
+"""
+
+from z3c.pagelet import browser
+import zam.api.layer
+
+
+class IZAMTestBrowserSkin(zam.api.layer.IZAMBrowserLayer):
+    """The ``ZAMTest`` browser skin."""
+
+
+class TestPage(browser.BrowserPagelet):
+    """Test page."""
+
+
+class PluginTestPage(browser.BrowserPagelet):
+    """Plugin test page."""


Property changes on: zam.api/trunk/src/zam/api/browser/tests/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/tests/ftesting.zcml
===================================================================
--- zam.api/trunk/src/zam/api/browser/tests/ftesting.zcml	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/tests/ftesting.zcml	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,73 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser"
+    xmlns:z3c="http://namespaces.zope.org/z3c"
+    i18n_domain="zam">
+
+  <!-- load ftesting form zam.api -->
+  <include package="zam.api" file="ftesting.zcml" />
+
+
+  <!-- configure the zam test plugin -->
+  <utility
+      component="zam.api.testing.ZAMTestBaseRegistry"
+      provides="zope.component.interfaces.IComponents"
+      name="zam.api.testing"
+      />
+
+  <utility
+      factory="zam.api.testing.ZAMTestPlugin"
+      provides="zam.api.interfaces.IPlugin"
+      name="zam.api.testing"
+      />
+
+
+  <!-- setup test skin -->
+  <interface
+      interface="zam.api.browser.tests.IZAMTestBrowserSkin"
+      type="zope.publisher.interfaces.browser.IBrowserSkinType"
+      name="ZAMTest"
+      />
+
+  <z3c:layout
+      for="*"
+      layer="zam.api.layer.IZAMBrowserLayer"
+      template="template.pt"
+      />
+
+  <z3c:pagelet
+      for="*"
+      name="index.html"
+      permission="zope.ManageContent"
+      class="zam.api.browser.tests.TestPage"
+      layer="zam.api.layer.IZAMBrowserLayer"
+      />
+
+  <z3c:template
+      for="zam.api.browser.tests.TestPage"
+      layer="zam.api.layer.IZAMBrowserLayer"
+      template="index.pt"
+      />
+
+
+  <!-- configure a plugin page -->
+  <registerIn registry="zam.api.testing.ZAMTestBaseRegistry">
+    <z3c:pagelet
+        for="*"
+        name="test.html"
+        permission="zope.ManageContent"
+        class="zam.api.browser.tests.PluginTestPage"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        />
+    <z3c:template
+        for="zam.api.browser.tests.PluginTestPage"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        template="test.pt"
+        />
+  </registerIn>
+
+
+  <browser:defaultSkin name="ZAMTest" />
+  <browser:defaultView name="index.html" />
+
+</configure>


Property changes on: zam.api/trunk/src/zam/api/browser/tests/ftesting.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/tests/index.pt
===================================================================
--- zam.api/trunk/src/zam/api/browser/tests/index.pt	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/tests/index.pt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1 @@
+index page


Property changes on: zam.api/trunk/src/zam/api/browser/tests/index.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/tests/template.pt
===================================================================
--- zam.api/trunk/src/zam/api/browser/tests/template.pt	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/tests/template.pt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,13 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
+      i18n:domain="zam">
+<head>
+<title>ZAM</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta http-equiv="cache-control" content="no-cache" />
+<meta http-equiv="pragma" content="no-cache" />
+</head>
+<body>
+<tal:block replace="structure provider:pagelet">pagelet provider</tal:block>
+</body>
+</html>


Property changes on: zam.api/trunk/src/zam/api/browser/tests/template.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/tests/test.pt
===================================================================
--- zam.api/trunk/src/zam/api/browser/tests/test.pt	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/tests/test.pt	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1 @@
+plugin test page


Property changes on: zam.api/trunk/src/zam/api/browser/tests/test.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/browser/tests/test_skin.py
===================================================================
--- zam.api/trunk/src/zam/api/browser/tests/test_skin.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/browser/tests/test_skin.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,40 @@
+##############################################################################
+#
+# 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: __init__.py 97 2007-03-29 22:58:27Z rineichen $
+"""
+
+import doctest
+import unittest
+from zope.app.testing import functional
+
+functional.defineLayer('TestLayer', 'ftesting.zcml')
+
+
+def getRootFolder():
+    return functional.FunctionalTestSetup().getRootFolder()
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    s = functional.FunctionalDocFileSuite('../README.txt',
+        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+        globs={'getRootFolder': getRootFolder})
+    s.layer = TestLayer
+    suite.addTest(s)
+
+    return suite
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: zam.api/trunk/src/zam/api/browser/tests/test_skin.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/configure.zcml
===================================================================
--- zam.api/trunk/src/zam/api/configure.zcml	                        (rev 0)
+++ zam.api/trunk/src/zam/api/configure.zcml	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,14 @@
+<configure
+    xmlns:zope="http://namespaces.zope.org/zope"
+    xmlns="http://namespaces.zope.org/browser"
+    xmlns:z3c="http://namespaces.zope.org/z3c"
+    i18n_domain="zam">
+
+  <include file="breadcrumb.zcml" />
+  <include file="layer.zcml" />
+  <include file="menu.zcml" />
+  <include file="menuitem.zcml" />
+
+  <include package=".browser" />
+
+</configure>


Property changes on: zam.api/trunk/src/zam/api/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/ftesting.zcml
===================================================================
--- zam.api/trunk/src/zam/api/ftesting.zcml	                        (rev 0)
+++ zam.api/trunk/src/zam/api/ftesting.zcml	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,225 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:meta="http://namespaces.zope.org/meta"
+    xmlns:browser="http://namespaces.zope.org/browser"
+    xmlns:z3c="http://namespaces.zope.org/z3c"
+    i18n_domain="zope">
+
+  <!-- This is the general zam.api ftesting.zcml and can be reused as base for
+       all different ftesting setup in zam.* and zamplugin.* packages.
+  -->
+
+  <!-- Turn on the devmode -->
+  <meta:provides feature="devmode" />
+
+  <!-- load meta configuration for exclude -->
+  <include package="zc.configuration" file="meta.zcml" />
+
+  <!-- exclude will prevent from include -->
+  <exclude package="zope.app.authentication" file="ftpplugins.zcml" />
+  <exclude package="zope.app.authentication" file="groupfolder.zcml" />
+  <exclude package="zope.app.authentication" file="principalfolder.zcml" />
+  <exclude package="zope.app.authentication.browser" />
+  <exclude package="zope.app.authentication.browser" file="configure.zcml" />
+  <exclude package="zope.app.authentication.browser" file="groupfolder.zcml" />
+  <exclude package="zope.app.authentication.browser" file="httpplugins.zcml" />
+  <exclude package="zope.app.authentication.browser" file="principalfolder.zcml" />
+  <exclude package="zope.app.authentication.browser" file="session.zcml" />
+  <exclude package="zope.app.broken" file="browser.zcml" />
+  <exclude package="zope.app.container.browser" />
+  <exclude package="zope.app.error.browser" />
+  <exclude package="zope.app.folder.browser" />
+  <exclude package="zope.app.i18n.browser" />
+  <exclude package="zope.app.intid.browser" />
+  <exclude package="zope.app.securitypolicy.browser" />
+  <exclude package="zope.app.session" file="browser.zcml" />
+  <exclude package="zope.dublincore.browser" />
+
+ 
+  <!-- z3c exlude -->
+  <exclude package="z3c.sampledata.browser" />
+
+  <!-- meta configure -->
+  <include package="zope.app.component" file="meta.zcml" />
+  <include package="zope.app.component.browser" file="meta.zcml" />
+  <include package="zope.app.container.browser" file="meta.zcml" />
+  <include package="zope.app.pagetemplate" file="meta.zcml" />
+  <include package="zope.app.publication" file="meta.zcml" />
+  <include package="zope.app.publisher" file="meta.zcml" />
+  <include package="zope.app.security" file="meta.zcml" />
+  <include package="zope.i18n" file="meta.zcml" />
+  <include package="zope.security" file="meta.zcml" />
+  <include package="zope.securitypolicy" file="meta.zcml" />
+  <include package="zope.viewlet" file="meta.zcml" />
+
+
+  <!-- load 3rd party meta configuration -->
+  <include package="z3c.baseregistry" file="meta.zcml" />
+  <include package="z3c.form" file="meta.zcml" />
+  <include package="z3c.macro" file="meta.zcml" />
+  <include package="z3c.pagelet" file="meta.zcml" />
+  <include package="z3c.sampledata" file="meta.zcml" />
+  <include package="z3c.template" file="meta.zcml" />
+  <include package="z3c.zrtresource" file="meta.zcml" />
+
+
+  <!-- vocabulary setup, that's bad and weird, because this is meta configuration -->
+  <include package="zope.app.schema" />
+
+
+  <!-- bootstrap Database -->
+  <include package="zope.app.appsetup" />
+  <include package="zope.app.zopeappgenerations" />
+
+  <!-- zope server -->
+  <include package="zope.app.server" />
+  <include package="zope.app.twisted" />
+  <include package="zope.app.wsgi" />
+
+
+  <!-- zope packages -->
+  <include package="zope.annotation" />
+  <include package="zope.component" />
+  <include package="zope.contentprovider" />
+  <include package="zope.dublincore" />
+  <include package="zope.error" />
+  <include package="zope.location" />
+  <include package="zope.publisher" />
+  <include package="zope.securitypolicy" />
+  <include package="zope.session" />
+  <include package="zope.traversing" />
+  <include package="zope.traversing.browser" />
+
+
+  <!-- zope app package configuration -->
+  <include package="zope.app.authentication" />
+  <include package="zope.app.broken" />
+  <include package="zope.app.component" />
+  <include package="zope.app.container" />
+  <include package="zope.app.folder" />
+  <include package="zope.app.http" />
+  <include package="zope.app.intid" />
+  <include package="zope.app.keyreference" />
+  <include package="zope.app.principalannotation" />
+  <include package="zope.app.publication" />
+  <include package="zope.app.publisher" />
+  <include package="zope.app.publisher.browser" />
+  <include package="zope.app.security" />
+  <include package="zope.app.securitypolicy" />
+  <include package="zope.app.session" />
+
+
+  <!-- z3c component -->
+  <include package="z3c.breadcrumb" />
+  <include package="z3c.form" />
+  <include package="z3c.formui" />
+  <include package="z3c.layer.pagelet" />
+  <include package="z3c.layer.ready2go" />
+  <include package="z3c.macro" />
+  <include package="z3c.pagelet" />
+
+
+  <!-- zam configuration -->
+  <include package="zam.api" />
+
+  <!-- setup public test site (no login required for simple test setup) -->
+  <class class=".testing.ZAMTestSite">
+    <allow
+        attributes="getSiteManager"
+        />
+    <require
+        permission="zope.ManageSite"
+        attributes="setSiteManager"
+        />
+    <require
+        permission="zope.Public"
+        attributes="title"
+        interface="zope.app.container.interfaces.IContained"
+        />
+    <require
+        permission="zope.ManageSite"
+        set_schema=".testing.IZAMTestSite"
+        />
+  </class>
+
+  <!-- from zope.app.i18n move this to another package -->
+  <!-- Setup charset negotiation -->
+  <adapter
+      factory="zope.publisher.http.HTTPCharsets"
+      for="zope.publisher.interfaces.http.IHTTPRequest"
+      provides="zope.i18n.interfaces.IUserPreferredCharsets"
+      />
+
+  <!-- Setup charset negotiation --><!-- move this to another package -->
+  <adapter
+      factory="zope.app.publisher.browser.ModifiableBrowserLanguages"
+      for="zope.publisher.interfaces.http.IHTTPRequest"
+      provides="zope.i18n.interfaces.IModifiableUserPreferredLanguages"
+      />
+
+  <class class="zope.publisher.http.HTTPRequest">
+    <implements
+        interface="zope.annotation.interfaces.IAttributeAnnotatable"
+        />
+  </class>
+
+
+  <!-- load security policy -->
+  <include package="zope.securitypolicy" />
+
+  <securityPolicy
+      component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+      />
+
+  <role id="zope.Anonymous"
+      title="Everybody"
+      description="All users have this role implicitly"
+      />
+  <role id="zope.Manager" title="Site Manager" />
+  <role id="zope.Member" title="Site Member" />
+
+  <grant permission="zope.View"
+                  role="zope.Anonymous" />
+  <grant permission="zope.app.dublincore.view"
+                  role="zope.Anonymous" />
+
+  <grantAll role="zope.Manager" />
+
+
+  <!-- setup principals -->
+  <unauthenticatedPrincipal
+      id="zope.anybody"
+      title="Unauthenticated User" />
+
+  <unauthenticatedGroup
+    id="zope.Anybody"
+    title="Unauthenticated Users"
+    />
+
+  <authenticatedGroup
+    id="zope.Authenticated"
+    title="Authenticated Users"
+    />
+
+  <everybodyGroup
+    id="zope.Everybody"
+    title="All Users"
+    />
+
+  <principal
+      id="zope.mgr"
+      title="Manager"
+      login="mgr"
+      password="mgrpw" />
+
+  <grant role="zope.Manager" principal="zope.mgr" />
+
+  <principal
+      id="zope.globalmgr"
+      title="Manager"
+      login="globalmgr"
+      password="globalmgrpw" />
+
+  <grant role="zope.Manager" principal="zope.globalmgr" />
+
+</configure>


Property changes on: zam.api/trunk/src/zam/api/ftesting.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/i18n.py
===================================================================
--- zam.api/trunk/src/zam/api/i18n.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/i18n.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2008 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: __init__.py 97 2007-03-29 22:58:27Z rineichen $
+"""
+
+import zope.i18nmessageid
+MessageFactory = zope.i18nmessageid.MessageFactory('zam')


Property changes on: zam.api/trunk/src/zam/api/i18n.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/interfaces.py
===================================================================
--- zam.api/trunk/src/zam/api/interfaces.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/interfaces.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,65 @@
+##############################################################################
+#
+# 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: __init__.py 97 2007-03-29 22:58:27Z rineichen $
+"""
+
+import zope.interface
+import zope.component
+import zope.schema
+
+from zam.api.i18n import MessageFactory as _
+
+
+class IPlugin(zope.interface.Interface):
+    """A component that provides additional features to a site."""
+
+    title = zope.schema.TextLine(
+        title=_(u'Title'),
+        description=_(u'The title.'),
+        required=True)
+
+    description = zope.schema.Text(
+        title=_(u'Description'),
+        description=_(u'The depscription.'),
+        required=True)
+
+    def isInstalled(site):
+        """Checks whether the plugin is installed for the site."""
+
+    def install(site):
+        """Install the plugin for the site.
+
+        If the plugin is already installed, do nothing.
+        """
+
+    def uninstall(site):
+        """Uninstall the plugin from the site.
+
+        If the plugin is already uninstalled, do nothing.
+        """
+
+
+class IBaseRegistryPlugin(IPlugin):
+
+    registry = zope.schema.Object(
+        title=_(u'Registry'),
+        description=_(u'The base registry to be inserted into the site.'),
+        schema=zope.component.interfaces.IComponents,
+        required=True)
+
+
+# selected menu marker for pages
+class IRootMenuItemPage(zope.interface.Interface):
+    """Containment root page marker."""


Property changes on: zam.api/trunk/src/zam/api/interfaces.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/layer.py
===================================================================
--- zam.api/trunk/src/zam/api/layer.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/layer.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,41 @@
+##############################################################################
+#
+# 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: __init__.py 97 2007-03-29 22:58:27Z rineichen $
+"""
+
+from zope.viewlet.interfaces import IViewletManager
+from z3c.menu.ready2go import interfaces
+import z3c.layer.ready2go
+
+
+class IZAMBrowserLayer(z3c.layer.ready2go.IReady2GoBrowserLayer):
+    """Secure browser layer used for ZAM."""
+
+
+# ZAM viewlet manager
+class ICSS(IViewletManager):
+    """CSS viewlet manager."""
+
+
+class IJavaScript(IViewletManager):
+    """JavaScript viewlet manager."""
+
+
+class IBreadcrumb(IViewletManager):
+    """Breadcrumb viewlet manager."""
+
+
+class ISideBar(IViewletManager):
+    """SideBar viewlet manager."""


Property changes on: zam.api/trunk/src/zam/api/layer.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/layer.zcml
===================================================================
--- zam.api/trunk/src/zam/api/layer.zcml	                        (rev 0)
+++ zam.api/trunk/src/zam/api/layer.zcml	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,12 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser"
+    xmlns:i18n="http://namespaces.zope.org/i18n"
+    i18n_domain="zam">
+
+  <interface
+      interface="zam.api.layer.IZAMBrowserLayer"
+      type="zope.publisher.interfaces.browser.IBrowserSkinType"
+      />
+
+</configure>


Property changes on: zam.api/trunk/src/zam/api/layer.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/menu.py
===================================================================
--- zam.api/trunk/src/zam/api/menu.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/menu.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,75 @@
+##############################################################################
+#
+# 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: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
+
+import zope.component
+from zope.contentprovider.interfaces import IContentProvider
+from zope.traversing.interfaces import IContainmentRoot
+from zope.traversing import api
+from zope.viewlet.interfaces import IViewletManager
+from zope.app.component import hooks
+
+import z3c.pagelet.interfaces
+import z3c.form.interfaces
+from z3c.menu.ready2go import item
+
+from zam.api import interfaces
+
+
+class IAddMenu(IContentProvider):
+    """Add menu item controlling tab."""
+
+
+class IGlobalMenu(IViewletManager):
+    """Global menu item controlling tab."""
+
+
+class ISiteMenu(IViewletManager):
+    """Site menu item controlling tab."""
+
+
+class IContextMenu(IViewletManager):
+    """Context menu item controlling tab."""
+
+
+# default ZAM root menu item
+class RootMenuItem(item.GlobalMenuItem):
+    """Zope root menu item."""
+
+    viewName = 'index.html'
+    viewInterface = interfaces.IRootMenuItemPage
+    weight = 1
+
+    def getURLContext(self):
+        return api.getRoot(self.context)
+
+
+class ZAMPluginsMenuItem(item.SiteMenuItem):
+    """ZAM plugins menu item."""
+
+    viewName = 'plugins.html'
+    viewInterface = zope.component.interfaces.IComponents
+    weight = 1
+
+    @property
+    def available(self):
+        """Only available on ISite but not at root."""
+        site = hooks.getSite()
+        if site is not None:
+            return True
+        else:
+            return False
+


Property changes on: zam.api/trunk/src/zam/api/menu.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/menu.zcml
===================================================================
--- zam.api/trunk/src/zam/api/menu.zcml	                        (rev 0)
+++ zam.api/trunk/src/zam/api/menu.zcml	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,202 @@
+<configure
+    xmlns:zope="http://namespaces.zope.org/zope"
+    xmlns="http://namespaces.zope.org/browser"
+    xmlns:z3c="http://namespaces.zope.org/z3c"
+    i18n_domain="zam">
+
+  <configure package="z3c.menu.ready2go">
+    <viewletManager
+        name="IAddMenu"
+        class=".manager.MenuManager"
+        provides="zam.api.menu.IAddMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+
+    <viewletManager
+        name="IGlobalMenu"
+        class=".manager.MenuManager"
+        provides="zam.api.menu.IGlobalMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+
+    <viewletManager
+        name="ISiteMenu"
+        class=".manager.MenuManager"
+        provides="zam.api.menu.ISiteMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+
+    <viewletManager
+        name="IContextMenu"
+        class=".manager.MenuManager"
+        provides="zam.api.menu.IContextMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+
+
+    <!-- IException -->
+    <viewletManager
+        name="IAddMenu"
+        for="zope.interface.common.interfaces.IException"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IAddMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="IGlobalMenu"
+        for="zope.interface.common.interfaces.IException"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IGlobalMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="ISiteMenu"
+        for="zope.interface.common.interfaces.IException"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.ISiteMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="IContextMenu"
+        for="zope.interface.common.interfaces.IException"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IContextMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+
+
+    <!-- IUnauthorized -->
+    <viewletManager
+        name="IAddMenu"
+        for="zope.security.interfaces.IUnauthorized"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IAddMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="IGlobalMenu"
+        for="zope.security.interfaces.IUnauthorized"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IGlobalMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="ISiteMenu"
+        for="zope.security.interfaces.IUnauthorized"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.ISiteMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="IContextMenu"
+        for="zope.security.interfaces.IUnauthorized"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IContextMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+
+
+    <!-- IUserError -->
+    <viewletManager
+        name="IAddMenu"
+        for="zope.exceptions.interfaces.IUserError"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IAddMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="IGlobalMenu"
+        for="zope.exceptions.interfaces.IUserError"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IGlobalMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="ISiteMenu"
+        for="zope.exceptions.interfaces.IUserError"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.ISiteMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="IContextMenu"
+        for="zope.exceptions.interfaces.IUserError"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IContextMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+
+
+    <!-- INotFound -->
+    <viewletManager
+        name="IAddMenu"
+        for="zope.publisher.interfaces.INotFound"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IAddMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="IGlobalMenu"
+        for="zope.publisher.interfaces.INotFound"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IGlobalMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="ISiteMenu"
+        for="zope.publisher.interfaces.INotFound"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.ISiteMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+    <viewletManager
+        name="IContextMenu"
+        for="zope.publisher.interfaces.INotFound"
+        class=".manager.EmptyMenuManager"
+        provides="zam.api.menu.IContextMenu"
+        template="menu.pt"
+        layer="zam.api.layer.IZAMBrowserLayer"
+        permission="zope.Public"
+        />
+
+  </configure>
+
+</configure>


Property changes on: zam.api/trunk/src/zam/api/menu.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/menuitem.zcml
===================================================================
--- zam.api/trunk/src/zam/api/menuitem.zcml	                        (rev 0)
+++ zam.api/trunk/src/zam/api/menuitem.zcml	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,24 @@
+<configure
+    xmlns:zope="http://namespaces.zope.org/zope"
+    xmlns="http://namespaces.zope.org/browser"
+    i18n_domain="zam">
+
+  <viewlet
+      name="Root"
+      for="*"
+      class=".menu.RootMenuItem"
+      manager=".menu.IGlobalMenu"
+      layer=".layer.IZAMBrowserLayer"
+      permission="zope.ManageServices"
+      />
+
+  <viewlet
+      name="Plugins"
+      for="zope.location.interfaces.ISite"
+      class=".menu.ZAMPluginsMenuItem"
+      manager=".menu.ISiteMenu"
+      layer=".layer.IZAMBrowserLayer"
+      permission="zope.ManageServices"
+      />
+
+</configure>


Property changes on: zam.api/trunk/src/zam/api/menuitem.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/plugin.py
===================================================================
--- zam.api/trunk/src/zam/api/plugin.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/plugin.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,77 @@
+##############################################################################
+#
+# Copyright (c) 2008 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: __init__.py 97 2007-03-29 22:58:27Z rineichen $
+"""
+__docformat__ = "reStructuredText"
+
+import zope.component
+import zope.interface
+from zope.schema.fieldproperty import FieldProperty
+
+from zam.api import interfaces
+
+
+class Plugin(object):
+    """Plugin base."""
+
+    zope.interface.implements(interfaces.IPlugin)
+
+    title = FieldProperty(interfaces.IPlugin['title'])
+    description = FieldProperty(interfaces.IPlugin['description'])
+
+    def isInstalled(self, site):
+        """See interfaces.IPlugin"""
+        raise NotImplemented
+
+    def install(self, site):
+        """See interfaces.IPlugin"""
+        raise NotImplemented
+
+    def uninstall(self, site):
+        """See interfaces.IPlugin"""
+        raise NotImplemented
+
+
+class BaseRegistryPlugin(Plugin):
+    """Base registry plugin base."""
+
+    zope.interface.implements(interfaces.IBaseRegistryPlugin)
+
+    registry = FieldProperty(interfaces.IBaseRegistryPlugin['registry'])
+
+    def isInstalled(self, site):
+        """See interfaces.IPlugin"""
+        sm = site.getSiteManager()
+        if not zope.component.interfaces.IComponents.providedBy(sm):
+            raise ValueError('Site does not provide ``IComponents``.',
+                sm)
+        return self.registry in sm.__bases__
+
+    def install(self, site):
+        """See interfaces.IPlugin"""
+        if self.isInstalled(site):
+            return
+        sm = site.getSiteManager()
+        # new custom registry first
+        sm.__bases__ = tuple([self.registry] + list(sm.__bases__))
+
+    def uninstall(self, site):
+        """See interfaces.IPlugin"""
+        if not self.isInstalled(site):
+            return
+        sm = site.getSiteManager()
+        bases = list(sm.__bases__)
+        bases.remove(self.registry)
+        sm.__bases__ = bases


Property changes on: zam.api/trunk/src/zam/api/plugin.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/testing.py
===================================================================
--- zam.api/trunk/src/zam/api/testing.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/testing.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,96 @@
+##############################################################################
+#
+# Copyright (c) 2008 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: __init__.py 97 2007-03-29 22:58:27Z rineichen $
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+import zope.component
+import zope.schema
+from zope.schema.fieldproperty import FieldProperty
+from zope.annotation.interfaces import IAttributeAnnotatable
+from zope.app.component.interfaces import IPossibleSite
+from zope.app import folder
+from zope.app.component import site
+
+from z3c.baseregistry import baseregistry
+
+from zam.api.i18n import MessageFactory as _
+from zam.api import plugin
+
+###############################################################################
+#
+# ZAM test site used in different zam package tests
+#
+###############################################################################
+
+class IZAMTestSite(IPossibleSite, IAttributeAnnotatable):
+    """ZAM test site interface."""
+
+    __name__ = zope.schema.TextLine(
+        title=_('Object name.'),
+        description=_('The object name.'),
+        default=u'ZAMDemoSite',
+        missing_value=u'',
+        required=True)
+
+    title = zope.schema.TextLine(
+        title=_('Title'),
+        description=_('The title of the demo site.'),
+        default=u'',
+        missing_value=u'',
+        required=True)
+
+
+class ZAMTestSite(folder.Folder):
+    """ZAM test site."""
+
+    zope.interface.implements(IZAMTestSite)
+
+    title = FieldProperty(IZAMTestSite['title'])
+
+    def __init__(self, title):
+        super(ZAMTestSite, self).__init__()
+        self.title = title
+
+        # setup site manager
+        self.setSiteManager(site.LocalSiteManager(self))
+
+    def __repr__(self):
+        return '<%s %r>' % (self.__class__.__name__, self.__name__)
+
+
+ZAMTestBaseRegistry = baseregistry.BaseComponents(
+    zope.component.globalSiteManager, 'zam.api.testing')
+
+
+class ZAMTestPlugin(plugin.BaseRegistryPlugin):
+    """ZAM test plugin."""
+
+    registry = ZAMTestBaseRegistry
+
+    title = _("ZAM test plugin")
+
+    description = _("ZAM test plugin.")
+
+    def install(self, site):
+        super(ZAMTestPlugin, self).install(site)
+        setattr(site, 'testAttr', 'dummy')
+
+    def uninstall(self, site):
+        super(ZAMTestPlugin, self).uninstall(site)
+        delattr(site, 'testAttr')
+
+


Property changes on: zam.api/trunk/src/zam/api/testing.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zam.api/trunk/src/zam/api/tests.py
===================================================================
--- zam.api/trunk/src/zam/api/tests.py	                        (rev 0)
+++ zam.api/trunk/src/zam/api/tests.py	2008-02-16 16:18:38 UTC (rev 83905)
@@ -0,0 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 2005 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: tests.py 69742 2006-08-23 22:17:00Z rogerineichen $
+"""
+__docformat__ = 'restructuredtext'
+
+import doctest
+import unittest
+from zope.testing import doctestunit
+from zope.app.testing import setup
+
+
+def setUp(test):
+    site = setup.placefulSetUp(site=True)
+    test.globs['rootFolder'] = site
+    setup.setUpTestAsModule(test, name='README')
+
+def tearDown(test):
+    setup.placefulTearDown()
+
+
+def test_suite():
+    return unittest.TestSuite((
+        doctestunit.DocFileSuite('README.txt', 
+            setUp=setUp, tearDown=tearDown,
+            optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+        ))
+
+if __name__=='__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: zam.api/trunk/src/zam/api/tests.py
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list