This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new features, but backward compatible, new version, old version is in…
… branches/1.0. see CHANGES.txt for details
- Loading branch information
Showing
17 changed files
with
495 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<data-files zopeskel/etc/package-includes> | ||
z3c.configurator-*.zcml | ||
</data-files> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
|
||
|
Oops, something went wrong.