[Checkins] SVN: zamplugin.authenticator/trunk/ Removed svn:externals
Roger Ineichen
roger at projekt01.ch
Wed Apr 16 00:26:16 EDT 2008
Log message for revision 85427:
Removed svn:externals
Cleanup imports
Cleanup dependencies
Added more tests
Prepare for release
Changed:
U zamplugin.authenticator/trunk/CHANGES.txt
U zamplugin.authenticator/trunk/buildout.cfg
D zamplugin.authenticator/trunk/externals/
U zamplugin.authenticator/trunk/setup.py
U zamplugin.authenticator/trunk/src/zamplugin/authenticator/README.txt
U zamplugin.authenticator/trunk/src/zamplugin/authenticator/configure.zcml
U zamplugin.authenticator/trunk/src/zamplugin/authenticator/tests.py
-=-
Modified: zamplugin.authenticator/trunk/CHANGES.txt
===================================================================
--- zamplugin.authenticator/trunk/CHANGES.txt 2008-04-16 04:20:26 UTC (rev 85426)
+++ zamplugin.authenticator/trunk/CHANGES.txt 2008-04-16 04:26:15 UTC (rev 85427)
@@ -2,7 +2,7 @@
CHANGES
=======
-Version 0.5.0 (unreleased)
--------------------------
+Version 0.5.0 (2008-04-16)
+--------------------------
- Initial Release
Modified: zamplugin.authenticator/trunk/buildout.cfg
===================================================================
--- zamplugin.authenticator/trunk/buildout.cfg 2008-04-16 04:20:26 UTC (rev 85426)
+++ zamplugin.authenticator/trunk/buildout.cfg 2008-04-16 04:26:15 UTC (rev 85427)
@@ -1,18 +1,13 @@
[buildout]
develop = .
- externals/z3c.authenticator
- externals/z3c.contents
- externals/z3c.menu.ready2go
- externals/z3c.table
- externals/zam.api
- externals/zam.skin
+parts = logs app var test checker coverage-test coverage-report
-parts = logs app var test checker coverage
-
[test]
recipe = zc.recipe.testrunner
-eggs = zamplugin.authenticator [test]
+eggs = z3c.authenticator
+ zam.skin [app]
+ zamplugin.authenticator [test]
[checker]
@@ -20,9 +15,17 @@
path = src/zamplugin/authenticator
-[coverage]
+[coverage-test]
+recipe = zc.recipe.testrunner
+eggs = zamplugin.authenticator [test]
+defaults = ['--coverage', '../../coverage']
+
+
+[coverage-report]
recipe = zc.recipe.egg
eggs = z3c.coverage
+scripts = coverage=coverage-report
+arguments = ('coverage', 'coverage/report')
[logs]
@@ -32,7 +35,9 @@
[app]
recipe = z3c.recipe.dev:app
-eggs = zamplugin.authenticator
+eggs = z3c.authenticator
+ zam.skin [app]
+ zamplugin.authenticator
server = zserver
zope.conf =
${var:zconfig}
Modified: zamplugin.authenticator/trunk/setup.py
===================================================================
--- zamplugin.authenticator/trunk/setup.py 2008-04-16 04:20:26 UTC (rev 85426)
+++ zamplugin.authenticator/trunk/setup.py 2008-04-16 04:26:15 UTC (rev 85427)
@@ -51,58 +51,19 @@
namespace_packages = ['zamplugin'],
extras_require = dict(
test = [
- 'z3c.coverage',
- 'z3c.testing',
- 'zope.app.appsetup',
- 'zope.app.authentication',
- 'zope.app.component',
- 'zope.app.keyreference',
- 'zope.app.publication',
- 'zope.app.schema',
'zope.app.testing',
- 'zope.copypastemove',
- 'zope.i18n',
- 'zope.publisher',
- 'zope.schema',
- 'zope.security',
- 'zope.securitypolicy',
- 'zope.session',
- 'zope.testing',
'zope.testbrowser',
+ 'z3c.testing',
],
),
install_requires = [
'setuptools',
'z3c.baseregistry',
- 'z3c.batching',
- 'z3c.configurator',
- 'z3c.schema',
- 'z3c.form',
- 'z3c.formui',
- 'z3c.layer.pagelet',
- 'z3c.layer.ready2go',
'z3c.menu.ready2go',
- 'z3c.pagelet',
- 'z3c.table',
- 'z3c.contents',
- 'z3c.batching',
'z3c.authenticator',
- 'z3c.zrtresource',
+ 'z3c.configurator',
'zam.api',
- 'zam.skin',
- 'zc.configuration',
- 'zope.app.component',
- 'zope.app.http',
- 'zope.app.intid',
- 'zope.app.publisher',
- 'zope.app.securitypolicy',
- 'zope.app.server',
- 'zope.app.twisted',
- 'zope.configuration',
- 'zope.interface',
- 'zope.publisher',
- 'zope.traversing',
- 'zope.viewlet',
+ 'zope.component',
],
zip_safe = False,
)
Modified: zamplugin.authenticator/trunk/src/zamplugin/authenticator/README.txt
===================================================================
--- zamplugin.authenticator/trunk/src/zamplugin/authenticator/README.txt 2008-04-16 04:20:26 UTC (rev 85426)
+++ zamplugin.authenticator/trunk/src/zamplugin/authenticator/README.txt 2008-04-16 04:26:15 UTC (rev 85427)
@@ -2,22 +2,437 @@
README
======
-This package contains the site manager part for the Zope Application
-Management.
+This package provides management pages for the z3c.authenticator implementation.
+The zam.skin is used as basic skin for this test.
-Login as manager first:
+First login as manager:
>>> from zope.testbrowser.testing import Browser
- >>> manager = Browser()
- >>> manager.addHeader('Authorization', 'Basic mgr:mgrpw')
+ >>> mgr = Browser()
+ >>> mgr.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:
+And go to the plugins page at the site root:
- >>> manager = Browser()
- >>> manager.handleErrors = False
- >>> manager.addHeader('Authorization', 'Basic mgr:mgrpw')
- >>> skinURL = 'http://localhost/++skin++ZAM/index.html'
- >>> manager.open(skinURL)
- >>> manager.url
- 'http://localhost/++skin++ZAM/index.html'
+ >>> rootURL = 'http://localhost/++skin++ZAM'
+ >>> mgr.open(rootURL + '/plugins.html')
+ >>> mgr.url
+ 'http://localhost/++skin++ZAM/plugins.html'
+
+and install the error plugins:
+
+ >>> mgr.getControl(name='zamplugin.authenticator.buttons.install').click()
+ >>> print mgr.contents
+ <!DOCTYPE ...
+ ...
+ <h1>ZAM Plugin Management</h1>
+ <fieldset id="pluginManagement">
+ <strong class="installedPlugin">Z3C Authenticator management</strong>
+ <div class="description">ZAM Authenticator Management.</div>
+ ...
+
+Let's add and setup an Authenticator utility:
+
+ >>> from zope.app.security.interfaces import IAuthentication
+ >>> from z3c.authenticator.authentication import Authenticator
+ >>> root = getRootFolder()
+ >>> sm = root.getSiteManager()
+ >>> auth = Authenticator()
+ >>> sm['auth'] = auth
+ >>> sm.registerUtility(auth, IAuthentication)
+
+Now you can see that we can access the authenticator utility at the site root:
+
+ >>> mgr.open(rootURL + '/++etc++site/auth/contents.html')
+ >>> print mgr.contents
+ <!DOCTYPE ...
+ ...
+ <ul>
+ <li class="selected">
+ <a href="http://localhost/++skin++ZAM/++etc++site/auth/contents.html"><span>Contents</span></a>
+ ...
+ ...
+ <table>
+ <thead>
+ <tr>
+ <th>X</th>
+ <th><a href="?contents-sortOn=contents-renameColumn-1&contents-sortOrder=descending" title="Sort">Name</a></th>
+ <th><a href="?contents-sortOn=contents-createdColumn-2&contents-sortOrder=ascending" title="Sort">Created</a></th>
+ <th><a href="?contents-sortOn=contents-modifiedColumn-3&contents-sortOrder=ascending" title="Sort">Modified</a></th>
+ </tr>
+ </thead>
+ <tbody>
+ </tbody>
+ </table>
+ ...
+
+The management page can be found at the edit.html page:
+
+ >>> mgr.handleErrors = False
+ >>> mgr.open(rootURL + '/++etc++site/auth/edit.html')
+ >>> print mgr.contents
+ <!DOCTYPE ...
+ ...
+ <div id="content">
+ <form action="http://localhost/++skin++ZAM/++etc++site/auth/edit.html"
+ method="post" enctype="multipart/form-data"
+ class="edit-form" name="form" id="form">
+ <div class="viewspace">
+ <h1>Edit Authenticator.</h1>
+ <div class="required-info">
+ <span class="required">*</span>
+ – required
+ </div>
+ <div>
+ <div id="form-widgets-credentialsPlugins-row"
+ class="row">
+ <div class="label">
+ <label for="form-widgets-credentialsPlugins">
+ <span>Credentials Plugins</span>
+ <span class="required">*</span>
+ </label>
+ </div>
+ <div class="widget"><script type="text/javascript">
+ function moveItems(from, to)
+ {
+ // shortcuts for selection fields
+ var src = document.getElementById(from);
+ var tgt = document.getElementById(to);
+ if (src.selectedIndex == -1) selectionError();
+ else
+ {
+ // iterate over all selected items
+ // --> attribute "selectedIndex" doesn't support multiple selection.
+ // Anyway, it works here, as a moved item isn't selected anymore,
+ // thus "selectedIndex" indicating the "next" selected item :)
+ while (src.selectedIndex > -1)
+ if (src.options[src.selectedIndex].selected)
+ {
+ // create a new virtal object with values of item to copy
+ temp = new Option(src.options[src.selectedIndex].text,
+ src.options[src.selectedIndex].value);
+ // append virtual object to targe
+ tgt.options[tgt.length] = temp;
+ // want to select newly created item
+ temp.selected = true;
+ // delete moved item in source
+ src.options[src.selectedIndex] = null;
+ }
+ }
+ }
+ // move item from "from" selection to "to" selection
+ function from2to(name)
+ {
+ moveItems(name+"-from", name+"-to");
+ copyDataForSubmit(name);
+ }
+ // move item from "to" selection back to "from" selection
+ function to2from(name)
+ {
+ moveItems(name+"-to", name+"-from");
+ copyDataForSubmit(name);
+ }
+ function swapFields(a, b)
+ {
+ // swap text
+ var temp = a.text;
+ a.text = b.text;
+ b.text = temp;
+ // swap value
+ temp = a.value;
+ a.value = b.value;
+ b.value = temp;
+ // swap selection
+ temp = a.selected;
+ a.selected = b.selected;
+ b.selected = temp;
+ }
+ // move selected item in "to" selection one up
+ function moveUp(name)
+ {
+ // shortcuts for selection field
+ var toSel = document.getElementById(name+"-to");
+ if (toSel.selectedIndex == -1)
+ selectionError();
+ else if (toSel.options[0].selected)
+ alert("Cannot move further up!");
+ else for (var i = 0; i < toSel.length; i++)
+ if (toSel.options[i].selected)
+ {
+ swapFields(toSel.options[i-1], toSel.options[i]);
+ copyDataForSubmit(name);
+ }
+ }
+ // move selected item in "to" selection one down
+ function moveDown(name)
+ {
+ // shortcuts for selection field
+ var toSel = document.getElementById(name+"-to");
+ if (toSel.selectedIndex == -1) {
+ selectionError();
+ } else if (toSel.options[toSel.length-1].selected) {
+ alert("Cannot move further down!");
+ } else {
+ for (var i = toSel.length-1; i >= 0; i--) {
+ if (toSel.options[i].selected) {
+ swapFields(toSel.options[i+1], toSel.options[i]);
+ }
+ }
+ copyDataForSubmit(name);
+ }
+ }
+ // copy each item of "toSel" into one hidden input field
+ function copyDataForSubmit(name)
+ {
+ // shortcuts for selection field and hidden data field
+ var toSel = document.getElementById(name+"-to");
+ var toDataContainer = document.getElementById(name+"-toDataContainer");
+ // delete all child nodes (--> complete content) of "toDataContainer" span
+ while (toDataContainer.hasChildNodes())
+ toDataContainer.removeChild(toDataContainer.firstChild);
+ // create new hidden input fields - one for each selection item of
+ // "to" selection
+ for (var i = 0; i < toSel.options.length; i++)
+ {
+ // create virtual node with suitable attributes
+ var newNode = document.createElement("input");
+ var newAttr = document.createAttribute("name");
+ newAttr.nodeValue = name.replace(/-/g, '.')+':list';
+ newNode.setAttributeNode(newAttr);
+ newAttr = document.createAttribute("type");
+ newAttr.nodeValue = "hidden";
+ newNode.setAttributeNode(newAttr);
+ newAttr = document.createAttribute("value");
+ newAttr.nodeValue = toSel.options[i].value;
+ newNode.setAttributeNode(newAttr);
+ // actually append virtual node to DOM tree
+ toDataContainer.appendChild(newNode);
+ }
+ }
+ // error message for missing selection
+ function selectionError()
+ {alert("Must select something!")}
+ </script>
+ <table border="0" class="ordered-selection-field">
+ <tr>
+ <td>
+ <select id="form-widgets-credentialsPlugins-from"
+ name="form.widgets.credentialsPlugins.from"
+ size="5" multiple="multiple"
+ class="required list-field">
+ </select>
+ </td>
+ <td>
+ <button name="from2toButton" type="button"
+ value="→"
+ onclick="javascript:from2to('form-widgets-credentialsPlugins')">→</button>
+ <br />
+ <button name="to2fromButton" type="button"
+ value="←"
+ onclick="javascript:to2from('form-widgets-credentialsPlugins')">←</button>
+ </td>
+ <td>
+ <select id="form-widgets-credentialsPlugins-to"
+ name="form.widgets.credentialsPlugins.to"
+ size="5" multiple="multiple"
+ class="required list-field">
+ </select>
+ <input name="form.widgets.credentialsPlugins-empty-marker"
+ type="hidden" />
+ <span id="form-widgets-credentialsPlugins-toDataContainer">
+ <script type="text/javascript">
+ copyDataForSubmit('form-widgets-credentialsPlugins');</script>
+ </span>
+ </td>
+ <td>
+ <button name="upButton" type="button" value="↑"
+ onclick="javascript:moveUp('form-widgets-credentialsPlugins')">↑</button>
+ <br />
+ <button name="downButton" type="button" value="↓"
+ onclick="javascript:moveDown('form-widgets-credentialsPlugins')">↓</button>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ <div id="form-widgets-authenticatorPlugins-row"
+ class="row">
+ <div class="label">
+ <label for="form-widgets-authenticatorPlugins">
+ <span>Authenticator Plugins</span>
+ <span class="required">*</span>
+ </label>
+ </div>
+ <div class="widget"><script type="text/javascript">
+ function moveItems(from, to)
+ {
+ // shortcuts for selection fields
+ var src = document.getElementById(from);
+ var tgt = document.getElementById(to);
+ if (src.selectedIndex == -1) selectionError();
+ else
+ {
+ // iterate over all selected items
+ // --> attribute "selectedIndex" doesn't support multiple selection.
+ // Anyway, it works here, as a moved item isn't selected anymore,
+ // thus "selectedIndex" indicating the "next" selected item :)
+ while (src.selectedIndex > -1)
+ if (src.options[src.selectedIndex].selected)
+ {
+ // create a new virtal object with values of item to copy
+ temp = new Option(src.options[src.selectedIndex].text,
+ src.options[src.selectedIndex].value);
+ // append virtual object to targe
+ tgt.options[tgt.length] = temp;
+ // want to select newly created item
+ temp.selected = true;
+ // delete moved item in source
+ src.options[src.selectedIndex] = null;
+ }
+ }
+ }
+ // move item from "from" selection to "to" selection
+ function from2to(name)
+ {
+ moveItems(name+"-from", name+"-to");
+ copyDataForSubmit(name);
+ }
+ // move item from "to" selection back to "from" selection
+ function to2from(name)
+ {
+ moveItems(name+"-to", name+"-from");
+ copyDataForSubmit(name);
+ }
+ function swapFields(a, b)
+ {
+ // swap text
+ var temp = a.text;
+ a.text = b.text;
+ b.text = temp;
+ // swap value
+ temp = a.value;
+ a.value = b.value;
+ b.value = temp;
+ // swap selection
+ temp = a.selected;
+ a.selected = b.selected;
+ b.selected = temp;
+ }
+ // move selected item in "to" selection one up
+ function moveUp(name)
+ {
+ // shortcuts for selection field
+ var toSel = document.getElementById(name+"-to");
+ if (toSel.selectedIndex == -1)
+ selectionError();
+ else if (toSel.options[0].selected)
+ alert("Cannot move further up!");
+ else for (var i = 0; i < toSel.length; i++)
+ if (toSel.options[i].selected)
+ {
+ swapFields(toSel.options[i-1], toSel.options[i]);
+ copyDataForSubmit(name);
+ }
+ }
+ // move selected item in "to" selection one down
+ function moveDown(name)
+ {
+ // shortcuts for selection field
+ var toSel = document.getElementById(name+"-to");
+ if (toSel.selectedIndex == -1) {
+ selectionError();
+ } else if (toSel.options[toSel.length-1].selected) {
+ alert("Cannot move further down!");
+ } else {
+ for (var i = toSel.length-1; i >= 0; i--) {
+ if (toSel.options[i].selected) {
+ swapFields(toSel.options[i+1], toSel.options[i]);
+ }
+ }
+ copyDataForSubmit(name);
+ }
+ }
+ // copy each item of "toSel" into one hidden input field
+ function copyDataForSubmit(name)
+ {
+ // shortcuts for selection field and hidden data field
+ var toSel = document.getElementById(name+"-to");
+ var toDataContainer = document.getElementById(name+"-toDataContainer");
+ // delete all child nodes (--> complete content) of "toDataContainer" span
+ while (toDataContainer.hasChildNodes())
+ toDataContainer.removeChild(toDataContainer.firstChild);
+ // create new hidden input fields - one for each selection item of
+ // "to" selection
+ for (var i = 0; i < toSel.options.length; i++)
+ {
+ // create virtual node with suitable attributes
+ var newNode = document.createElement("input");
+ var newAttr = document.createAttribute("name");
+ newAttr.nodeValue = name.replace(/-/g, '.')+':list';
+ newNode.setAttributeNode(newAttr);
+ newAttr = document.createAttribute("type");
+ newAttr.nodeValue = "hidden";
+ newNode.setAttributeNode(newAttr);
+ newAttr = document.createAttribute("value");
+ newAttr.nodeValue = toSel.options[i].value;
+ newNode.setAttributeNode(newAttr);
+ // actually append virtual node to DOM tree
+ toDataContainer.appendChild(newNode);
+ }
+ }
+ // error message for missing selection
+ function selectionError()
+ {alert("Must select something!")}
+ </script>
+ <table border="0" class="ordered-selection-field">
+ <tr>
+ <td>
+ <select id="form-widgets-authenticatorPlugins-from"
+ name="form.widgets.authenticatorPlugins.from"
+ size="5" multiple="multiple"
+ class="required list-field">
+ </select>
+ </td>
+ <td>
+ <button name="from2toButton" type="button"
+ value="→"
+ onclick="javascript:from2to('form-widgets-authenticatorPlugins')">→</button>
+ <br />
+ <button name="to2fromButton" type="button"
+ value="←"
+ onclick="javascript:to2from('form-widgets-authenticatorPlugins')">←</button>
+ </td>
+ <td>
+ <select id="form-widgets-authenticatorPlugins-to"
+ name="form.widgets.authenticatorPlugins.to"
+ size="5" multiple="multiple"
+ class="required list-field">
+ </select>
+ <input name="form.widgets.authenticatorPlugins-empty-marker"
+ type="hidden" />
+ <span id="form-widgets-authenticatorPlugins-toDataContainer">
+ <script type="text/javascript">
+ copyDataForSubmit('form-widgets-authenticatorPlugins');</script>
+ </span>
+ </td>
+ <td>
+ <button name="upButton" type="button" value="↑"
+ onclick="javascript:moveUp('form-widgets-authenticatorPlugins')">↑</button>
+ <br />
+ <button name="downButton" type="button" value="↓"
+ onclick="javascript:moveDown('form-widgets-authenticatorPlugins')">↓</button>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </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>
+ ...
\ No newline at end of file
Modified: zamplugin.authenticator/trunk/src/zamplugin/authenticator/configure.zcml
===================================================================
--- zamplugin.authenticator/trunk/src/zamplugin/authenticator/configure.zcml 2008-04-16 04:20:26 UTC (rev 85426)
+++ zamplugin.authenticator/trunk/src/zamplugin/authenticator/configure.zcml 2008-04-16 04:26:15 UTC (rev 85427)
@@ -2,6 +2,7 @@
xmlns="http://namespaces.zope.org/zope"
i18n_domain="zam">
+ <include package="z3c.authenticator" />
<include file="plugin.zcml" />
<!-- plugin management for IAuthenticatorPluginLayer -->
Modified: zamplugin.authenticator/trunk/src/zamplugin/authenticator/tests.py
===================================================================
--- zamplugin.authenticator/trunk/src/zamplugin/authenticator/tests.py 2008-04-16 04:20:26 UTC (rev 85426)
+++ zamplugin.authenticator/trunk/src/zamplugin/authenticator/tests.py 2008-04-16 04:26:15 UTC (rev 85427)
@@ -21,9 +21,14 @@
functional.defineLayer('TestLayer', 'ftesting.zcml')
+def getRootFolder():
+ return functional.FunctionalTestSetup().getRootFolder()
+
+
def test_suite():
suite = unittest.TestSuite()
- s = functional.FunctionalDocFileSuite('README.txt')
+ s = functional.FunctionalDocFileSuite('README.txt',
+ globs = {'getRootFolder': getRootFolder})
s.layer = TestLayer
suite.addTest(s)
More information about the Checkins
mailing list