[Checkins] SVN: z3c.configurator/trunk/src/z3c/configurator/ new features, but backward compatible, new version, old version is in branches/1.0. see CHANGES.txt for details

Bernd Dorn bernd.dorn at lovelysystems.com
Sun Jan 14 04:14:58 EST 2007


Log message for revision 72013:
  new features, but backward compatible, new version, old version is in branches/1.0. see CHANGES.txt for details

Changed:
  A   z3c.configurator/trunk/src/z3c/configurator/CHANGES.txt
  U   z3c.configurator/trunk/src/z3c/configurator/README.txt
  A   z3c.configurator/trunk/src/z3c/configurator/SETUP.cfg
  A   z3c.configurator/trunk/src/z3c/configurator/browser/
  A   z3c.configurator/trunk/src/z3c/configurator/browser/README.txt
  A   z3c.configurator/trunk/src/z3c/configurator/browser/__init__.py
  A   z3c.configurator/trunk/src/z3c/configurator/browser/configure.pt
  A   z3c.configurator/trunk/src/z3c/configurator/browser/configure.zcml
  A   z3c.configurator/trunk/src/z3c/configurator/browser/ftesting.zcml
  A   z3c.configurator/trunk/src/z3c/configurator/browser/ftests.py
  A   z3c.configurator/trunk/src/z3c/configurator/browser/testing.py
  A   z3c.configurator/trunk/src/z3c/configurator/browser/views.py
  U   z3c.configurator/trunk/src/z3c/configurator/configurator.py
  A   z3c.configurator/trunk/src/z3c/configurator/configure.zcml
  A   z3c.configurator/trunk/src/z3c/configurator/i18n.py
  U   z3c.configurator/trunk/src/z3c/configurator/interfaces.py
  A   z3c.configurator/trunk/src/z3c/configurator/vocabulary.py
  A   z3c.configurator/trunk/src/z3c/configurator/z3c.configurator-configure.zcml

-=-
Added: z3c.configurator/trunk/src/z3c/configurator/CHANGES.txt
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/CHANGES.txt	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/CHANGES.txt	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,27 @@
+========================
+z3c.configurator Changes
+========================
+
+This file contains change information for the current z3c.configurator
+package.
+
+After 1.0 (trunk only)
+======================
+
+New features
+------------
+
+- Added possibility to apply only specific named plugins in confugure.
+
+- New option to configure allows to have namespaced data to resolve
+  naming conflicts.
+
+- Added a page to call configurators TTW. This is the first step
+  towards mergin z3c.configurator and z3c.sampledata into one package.
+
+Bug fixes
+---------
+
+- SchemaConfigurationPluginBase now implements
+  ISchemaConfigurationPluginBase.
+


Property changes on: z3c.configurator/trunk/src/z3c/configurator/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: z3c.configurator/trunk/src/z3c/configurator/README.txt
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/README.txt	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/README.txt	2007-01-14 09:14:57 UTC (rev 72013)
@@ -125,3 +125,58 @@
   ...
   WrongType: (1, <type 'unicode'>)
 
+Data Namespaces
+---------------
+
+In order to not confuse attribute names if two plugins share a common
+name it is possible to pass data as a dictionary of dictionaries. The
+keys of the dictionary is the name under which the plugins are
+registered.
+
+  >>> something = Something()
+  >>> data = {u'add foo': {'foo': u'foo value'},
+  ...         u'add bar': {'bar': u'bar value'}}
+  >>> configurator.configure(something, data, useNameSpaces=True)
+  >>> something.foo, something.bar
+  (u'Text: foo value', u'bar value')
+
+Named Configuration
+-------------------
+
+Sometimes we do not want all registered configuration plugins to be
+executed. This can be achieved by providing the names argument to the
+configure function.
+
+Let us create a new something:
+
+  >>> something = Something()
+
+If we now configure it without names we get both attributes set.
+
+  >>> configurator.configure(something, {'foo': u'my value', 'bar': u'asdf'})
+  >>> something.__dict__
+  {'foo': u'Text: my value', 'bar': u'asdf'}
+
+Now let us just configure the plugin 'add bar'.
+
+  >>> something = Something()
+  >>> configurator.configure(something, {'foo': u'my value', 'bar': u'asdf'},
+  ...     names=['add bar'])
+  >>> something.__dict__
+  {'bar': u'asdf'}
+
+Dependencies of plugins are always executed - they don't have to be
+added to the ```names``` argument.
+
+  >>> something = Something()
+  >>> configurator.configure(something, {'foo': u'my value'},
+  ...     names=['extend foo'])
+  >>> something.foo
+  u'Text: my value'
+
+Named configurations are usefull when called manually through the web
+(see browser/README.txt). The configurator package does not look if a
+configuration is already applied if called twice. It is the
+responsibility of the plugin to be aware that it doesn't do things
+twice or delete things.
+

Added: z3c.configurator/trunk/src/z3c/configurator/SETUP.cfg
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/SETUP.cfg	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/SETUP.cfg	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,3 @@
+<data-files zopeskel/etc/package-includes>
+  z3c.configurator-*.zcml
+</data-files>


Property changes on: z3c.configurator/trunk/src/z3c/configurator/SETUP.cfg
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.configurator/trunk/src/z3c/configurator/browser/README.txt
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/browser/README.txt	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/browser/README.txt	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,46 @@
+=========================
+Calling Configurators TTW
+=========================
+
+A configuration view is registered to apply named configuration on any
+object.  We defined two example configurators which we now gonna apply
+to the site object.
+
+  >>> from zope.testbrowser.testing import Browser
+  >>> browser = Browser()
+  >>> browser.addHeader('Authorization','Basic mgr:mgrpw')
+  >>> browser.handleErrors = False
+
+  >>> browser.open('http://localhost/manage')
+  >>> browser.url
+  'http://localhost/@@contents.html'
+
+The view is registered in the zmi_views menu
+
+  >>> browser.getLink(u'Configurators').click()
+  >>> viewURL = browser.url
+  >>> viewURL
+  'http://localhost/@@configurators.html'
+
+  >>> sel = browser.getControl(name="form.pluginNames.to")
+
+First we can choose from the registered named plugins.
+
+  >>> plugs = browser.getControl(name="form.pluginNames.from").options
+  >>> sorted(plugs)
+  ['z3c.configurator.testing.setdescription',
+   'z3c.configurator.testing.settitle']
+  >>> browser.open(viewURL + '?form.pluginNames=z3c.configurator.testing.settitle')
+
+We have choosen a plugin, so now we have a form for the arguments needed.
+
+  >>> browser.getControl('Some Argument').value
+  ''
+  >>> browser.getControl('Some Argument').value = "New Title"
+  >>> browser.getControl('Apply').click()
+
+
+XXX form.pluginNames have to be set, but we can't because the widget
+uses javascript.
+
+


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

Added: z3c.configurator/trunk/src/z3c/configurator/browser/__init__.py
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/browser/__init__.py	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/browser/__init__.py	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1 @@
+#


Property changes on: z3c.configurator/trunk/src/z3c/configurator/browser/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.configurator/trunk/src/z3c/configurator/browser/configure.pt
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/browser/configure.pt	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/browser/configure.pt	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,9 @@
+<div metal:use-macro="view/base_template/macros/main" >
+  <div metal:fill-slot="above_buttons">
+    <tal:block tal:repeat="subform view/subforms">
+      <p tal:content="subform/prefix"></p>
+      <div tal:replace="structure subform" /><hr/>
+    </tal:block>
+  </div>
+</div>
+


Property changes on: z3c.configurator/trunk/src/z3c/configurator/browser/configure.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.configurator/trunk/src/z3c/configurator/browser/configure.zcml
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/browser/configure.zcml	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/browser/configure.zcml	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,14 @@
+<configure
+    xmlns:zope="http://namespaces.zope.org/zope"
+    xmlns="http://namespaces.zope.org/browser"
+    i18n_domain="z3c.configurator">
+
+  <page
+      for="*"
+      permission="z3c.configurator.ManageConfigurations"
+      name="configurators.html"
+      title="Configurators"
+      class=".views.ConfigureForm"
+      menu="zmi_views"/>
+  
+</configure>
\ No newline at end of file


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

Added: z3c.configurator/trunk/src/z3c/configurator/browser/ftesting.zcml
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/browser/ftesting.zcml	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/browser/ftesting.zcml	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,66 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:browser="http://namespaces.zope.org/browser"
+           xmlns:meta="http://namespaces.zope.org/meta"
+           i18n_domain="zope">
+
+  <include package="zope.app" />
+
+  <include package="zope.app.securitypolicy" file="meta.zcml" />
+
+  <include package="zope.app.server" />
+  <include package="zope.app.authentication" />
+  <securityPolicy
+    component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+  <include package="zope.app.securitypolicy" />
+
+  <role id="zope.Anonymous" title="Everybody"
+        description="All users have this role implicitly" />
+
+  <role id="zope.Manager" title="Site Manager" />
+
+  
+  <principal
+   id="zope.manager"
+   title="Administrator"
+   login="mgr"
+   password="mgrpw" />
+  <grant
+   role="zope.Manager"
+   principal="zope.manager"
+   />
+  
+  <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" 
+    />
+  
+  <include package="zope.app.form.browser" />
+  <include package="zope.formlib" />
+  <include package="z3c.configurator"/>
+
+  <adapter
+      name="z3c.configurator.testing.settitle"
+      factory="z3c.configurator.browser.testing.SetTitle"/>
+
+  <adapter
+      name="z3c.configurator.testing.setdescription"
+      factory="z3c.configurator.browser.testing.SetDescription"/>
+  
+  
+  <grantAll role="zope.Manager" />
+</configure>


Property changes on: z3c.configurator/trunk/src/z3c/configurator/browser/ftesting.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.configurator/trunk/src/z3c/configurator/browser/ftests.py
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/browser/ftests.py	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/browser/ftests.py	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,29 @@
+import unittest
+from zope.app.testing import functional
+
+functional.defineLayer('TestLayer', 'ftesting.zcml')
+
+
+def setUp(test):
+    """Setup a reasonable environment for the category tests"""
+    pass
+
+
+def tearDown(test):
+    pass
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suites = (
+        functional.FunctionalDocFileSuite('README.txt',
+                                          setUp=setUp, tearDown=tearDown,
+                                         ),
+        )
+    for s in suites:
+        s.layer=TestLayer
+        suite.addTest(s)
+    return suite
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: z3c.configurator/trunk/src/z3c/configurator/browser/ftests.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.configurator/trunk/src/z3c/configurator/browser/testing.py
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/browser/testing.py	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/browser/testing.py	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,32 @@
+"""Some test classes
+"""
+from z3c.configurator import configurator
+from zope import interface
+from zope import component
+from zope import schema
+from zope.dublincore.interfaces import IZopeDublinCore
+from zope.annotation.interfaces import IAttributeAnnotatable
+
+class ISingleArg(interface.Interface):
+
+    arg = schema.TextLine(title=u'Some Argument')
+
+class SetTitle(configurator.SchemaConfigurationPluginBase):
+    """makes an object implement IFoo"""
+    component.adapts(IAttributeAnnotatable)
+    schema = ISingleArg
+    
+    def __call__(self, data):
+        dc = IZopeDublinCore(self.context)
+        dc.title = data.get('arg')
+
+class SetDescription(configurator.SchemaConfigurationPluginBase):
+
+    component.adapts(IAttributeAnnotatable)
+    schema = ISingleArg
+    
+    def __call__(self, data):
+        dc = IZopeDublinCore(self.context)
+        dc.description = data.get('arg')
+        
+


Property changes on: z3c.configurator/trunk/src/z3c/configurator/browser/testing.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.configurator/trunk/src/z3c/configurator/browser/views.py
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/browser/views.py	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/browser/views.py	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,125 @@
+from zope import component
+from zope import interface
+from zope import schema
+
+from zope import formlib
+from zope.formlib import form
+from zope.app.pagetemplate import ViewPageTemplateFile
+from zope.cachedescriptors.property import Lazy
+from z3c.configurator import interfaces 
+from z3c.configurator.i18n import _
+from z3c.configurator import configurator
+
+
+class SelectPlugins(form.PageForm):
+
+    """a form to choose plugins, to be applied"""
+
+    form_fields = form.Fields(
+        schema.Choice(__name__=u'pluginName',
+                      title=_(u'Plugin Name'),
+                      vocabulary="Configurator Plugin Names")
+        )
+
+    @form.action(label=_(u'Apply Configuration'))
+    def selectPlugins(self, action, data):
+        pluginName = data.get('pluginName')
+        configurator.configure(self.context, names=[pluginName])
+        self.status = _('Configuration applied')
+
+class IGenerateSchema(interface.Interface):
+    """Schema for the minimal generator parameters"""
+
+    seed = schema.TextLine(
+            title = _(u'Seed'),
+            description =  _(u'A seed for the random generator'),
+            default = u'sample',
+            required=False,
+            )
+
+
+class ConfigureForm(form.PageForm):
+    """Configurator Plugin form"""
+
+    base_template = form.EditForm.template
+    template = ViewPageTemplateFile('configure.pt')
+    subforms = []
+    
+    form_fields = form.Fields(
+        schema.List(__name__=u'pluginNames',
+                    title=u'Plugin Names',
+                    value_type=schema.Choice(
+        __name__=u'pluginName',
+        title=_(u'Plugin Name'),
+        vocabulary="Configurator Plugin Names")
+        ))
+    
+    workDone = False
+
+    @Lazy
+    def _pluginNames(self):
+        names = self.request.form.get(self.prefix + '.pluginNames')
+        if names and not type(names) is type([]):
+            return [names]
+        return names
+
+    def setUpWidgets(self, ignore_request=False):
+        if self._pluginNames:
+            plugins = configurator.requiredPlugins(self.context,
+                                                   self._pluginNames)
+            self.subforms = []
+            for name, plugin in plugins:
+                if not interfaces.ISchemaConfigurationPlugin.providedBy(
+                    plugin):
+                    continue
+                subform = PluginSchemaForm(context=self.context,
+                                           request=self.request,
+                                           plugin=plugin,
+                                           prefix=name)
+                subform.form_fields = form.Fields(plugin.schema)
+                self.subforms.append(subform)
+        super(ConfigureForm, self).setUpWidgets(ignore_request=ignore_request)
+
+    @form.action(_("Update"))
+    def handleUpdate(self, action, data):
+        if not self._pluginNames:
+            return
+        self.setUpWidgets(ignore_request=False)
+        result = self.template()
+        return result
+    
+    def _pluginsSelected(self, action):
+        return not not self.request.form.get(self.prefix + '.pluginNames')
+
+    @form.action(_("Apply"), condition='_pluginsSelected')
+    def handleApply(self, action, data):
+        plugins = configurator.requiredPlugins(self._pluginNames)
+        configuratorData = {}
+        for subform in self.subforms:
+            subform.update()
+            formData = {}
+            errors = form.getWidgetsData(subform.widgets,
+                                         subform.prefix,
+                                         formData)
+            configuratorData[subform.prefix] = formData
+        
+        configurator.configure(self.context,
+                               configuratorData,
+                               names=self._pluginNames,
+                               useNameSpaces=True)
+        self.status = u'Applied: %s' % u' '.join(self._pluginNames)
+
+
+class PluginSchemaForm(form.AddForm):
+    """An editor for a single schema based plugin"""
+    interface.implements(formlib.interfaces.ISubPageForm)
+    template = formlib.namedtemplate.NamedTemplate('default')
+    actions = []
+
+    def __init__(self, context, request, plugin=None,
+                 schema=None, prefix=''):
+        self.plugin = plugin
+        self.schema = schema
+        self.prefix = prefix
+        super(PluginSchemaForm, self).__init__(context, request)
+


Property changes on: z3c.configurator/trunk/src/z3c/configurator/browser/views.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: z3c.configurator/trunk/src/z3c/configurator/configurator.py
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/configurator.py	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/configurator.py	2007-01-14 09:14:57 UTC (rev 72013)
@@ -23,45 +23,40 @@
 
 from z3c.configurator import interfaces
 
-# Stati values
-NEW = 1
-OPEN = 2
-CLOSED = 3
+def requiredPlugins(component, names=[]):
 
-def configure(component, data):
-
+    """returns a list of tuples (name, plugin) in the right order to
+    be executed"""
+    
     plugins = dict(zope.component.getAdapters(
         (component,), interfaces.IConfigurationPlugin))
+    # if we have no names we return them all
+    if not names:
+        return [(name, plugins[name]) for name in sorted(plugins.keys())]
+    
+    def _add(name, res):
+        deps = getattr(plugins[name], 'dependencies', ())
+        for dep in deps:
+            if not dep in res:
+                _add(dep, res)
+        if name not in res:
+            res.append(name)
+    res = []
+    for name in names:
+        _add(name, res)
+    return [(name, plugins[name]) for name in res]
 
-    # status is a dict plugin names as keys and stati as values.
-    status = dict([(name, NEW) for name in plugins])
+def configure(component, data, names=[], useNameSpaces=False):
 
-    def visit(name):
-        """The recursive part of the topological sort
+    plugins = requiredPlugins(component, names)
+    for name, plugin in plugins:
+        if useNameSpaces is True:
+            d = data.get(name, {})
+        else:
+            d = data
+            
+        plugin(d)
 
-        Raises a CyclicDependencyError if cyclic depencencies are found.
-        """
-        if status[name] == NEW:
-            status[name] = OPEN
-            plugin = plugins[name]
-            for dep in getattr(plugin, 'dependencies', ()):
-                visit(dep)
-            plugin(data)
-            status[name] = CLOSED
-
-        elif status[name] == CLOSED:
-            return
-
-        # Stumbling over an OPEN node means there is a cyclic dependency
-        elif status[name] == OPEN:
-            raise interfaces.CyclicDependencyError(
-                "cyclic dependency at '%s'" % name)
-
-
-    for name in plugins:
-        visit(name)
-
-
 class ConfigurationPluginBase(object):
     zope.interface.implements(interfaces.IConfigurationPlugin)
 
@@ -72,7 +67,7 @@
         raise NotImplemented
 
 class SchemaConfigurationPluginBase(object):
-    zope.interface.implements(interfaces.IConfigurationPlugin)
+    zope.interface.implements(interfaces.ISchemaConfigurationPlugin)
     schema = zope.interface.Interface
 
     def __init__(self, context):

Added: z3c.configurator/trunk/src/z3c/configurator/configure.zcml
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/configure.zcml	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/configure.zcml	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,17 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="z3c.configurator">
+
+  <permission
+      id="z3c.configurator.ManageConfigurations"
+      title="Manage Configurations"
+      />
+
+  <utility
+      component=".vocabulary.pluginNamesVocabulary"
+      provides="zope.schema.interfaces.IVocabularyFactory"
+      name="Configurator Plugin Names"/>
+  
+  <include package=".browser"/>
+  
+</configure>
\ No newline at end of file


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

Added: z3c.configurator/trunk/src/z3c/configurator/i18n.py
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/i18n.py	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/i18n.py	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,10 @@
+"""The i18n definitions.
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.i18nmessageid
+
+_ = zope.i18nmessageid.MessageFactory('z3c.configurator')
+


Property changes on: z3c.configurator/trunk/src/z3c/configurator/i18n.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: z3c.configurator/trunk/src/z3c/configurator/interfaces.py
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/interfaces.py	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/interfaces.py	2007-01-14 09:14:57 UTC (rev 72013)
@@ -43,7 +43,6 @@
         then raise a ``DataMissingError`` error.
         """
 
-
 class ISchemaConfigurationPlugin(IConfigurationPlugin):
     """A configuration plugin that provides a data schema."""
 

Added: z3c.configurator/trunk/src/z3c/configurator/vocabulary.py
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/vocabulary.py	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/vocabulary.py	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# Copyright (c) 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.
+#
+##############################################################################
+"""Vocabularies
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+from zope import component
+from zope.schema import vocabulary
+import interfaces
+
+def pluginNamesVocabulary(context):
+    """a vocabulary that returns all names of registered configuration
+    plugins"""
+    terms = []
+    plugins = dict(component.getAdapters(
+        (context,), interfaces.IConfigurationPlugin))
+    return vocabulary.SimpleVocabulary.fromValues(plugins.keys())


Property changes on: z3c.configurator/trunk/src/z3c/configurator/vocabulary.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.configurator/trunk/src/z3c/configurator/z3c.configurator-configure.zcml
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/z3c.configurator-configure.zcml	2007-01-14 09:04:23 UTC (rev 72012)
+++ z3c.configurator/trunk/src/z3c/configurator/z3c.configurator-configure.zcml	2007-01-14 09:14:57 UTC (rev 72013)
@@ -0,0 +1 @@
+<include package="z3c.configurator"/>
\ No newline at end of file


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



More information about the Checkins mailing list