From 81571f16e1b60dcd03bb64a736b1deb260a26027 Mon Sep 17 00:00:00 2001 From: chaoflow Date: Fri, 7 Nov 2008 23:09:33 +0000 Subject: [PATCH] paula: reorganized into one paula repo git-svn-id: https://svn.plone.org/svn/collective/paula/trunk@75253 db7f04ef-aaf3-0310-a811-c281ed44c4ad --- STATE.txt | 62 ++ paula.authentication/trunk/.gitignore | 14 + paula.authentication/trunk/README.txt | 18 + paula.authentication/trunk/bootstrap.py | 52 ++ paula.authentication/trunk/buildout.cfg | 13 + paula.authentication/trunk/docs/HISTORY.txt | 8 + paula.authentication/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.authentication/trunk/externals/EXTERNALS.txt | 1 + paula.authentication/trunk/setup.cfg | 2 + paula.authentication/trunk/setup.py | 46 ++ paula.authentication/trunk/src/paula/__init__.py | 6 + .../trunk/src/paula/authentication/README.txt | 211 +++++++ .../trunk/src/paula/authentication/__init__.py | 25 + .../trunk/src/paula/authentication/config.py | 23 + .../trunk/src/paula/authentication/configure.zcml | 18 + .../trunk/src/paula/authentication/ftesting.zcml | 16 + .../trunk/src/paula/authentication/interfaces.py | 68 +++ .../trunk/src/paula/authentication/pauplugins.py | 187 ++++++ .../trunk/src/paula/authentication/tests.py | 40 ++ paula.authutil/trunk/.gitignore | 14 + paula.authutil/trunk/README.txt | 4 + paula.authutil/trunk/bootstrap.py | 52 ++ paula.authutil/trunk/buildout.cfg | 14 + paula.authutil/trunk/docs/HISTORY.txt | 8 + paula.authutil/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.authutil/trunk/externals/EXTERNALS.txt | 2 + paula.authutil/trunk/setup.cfg | 2 + paula.authutil/trunk/setup.py | 47 ++ paula.authutil/trunk/src/paula/__init__.py | 6 + paula.authutil/trunk/src/paula/authutil/README.txt | 174 ++++++ .../trunk/src/paula/authutil/__init__.py | 25 + paula.authutil/trunk/src/paula/authutil/config.py | 23 + .../trunk/src/paula/authutil/configure.zcml | 15 + .../trunk/src/paula/authutil/ftesting.zcml | 17 + .../trunk/src/paula/authutil/interfaces.py | 55 ++ .../trunk/src/paula/authutil/subscribers.py | 76 +++ paula.authutil/trunk/src/paula/authutil/tests.py | 40 ++ paula.authutil/trunk/src/paula/authutil/utils.py | 184 ++++++ paula.examples/trunk/.gitignore | 14 + paula.examples/trunk/README.txt | 4 + paula.examples/trunk/bootstrap.py | 52 ++ paula.examples/trunk/buildout.cfg | 17 + paula.examples/trunk/docs/HISTORY.txt | 8 + paula.examples/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.examples/trunk/externals/EXTERNALS.txt | 5 + paula.examples/trunk/setup.cfg | 2 + paula.examples/trunk/setup.py | 48 ++ paula.examples/trunk/src/paula/__init__.py | 6 + paula.examples/trunk/src/paula/examples/README.txt | 83 +++ .../trunk/src/paula/examples/__init__.py | 22 + .../trunk/src/paula/examples/adapters.py | 135 +++++ .../trunk/src/paula/examples/adapters.zcml | 11 + paula.examples/trunk/src/paula/examples/config.py | 23 + .../trunk/src/paula/examples/configure.zcml | 8 + paula.examples/trunk/src/paula/examples/content.py | 137 +++++ .../trunk/src/paula/examples/content.zcml | 40 ++ .../trunk/src/paula/examples/ftesting.zcml | 19 + .../trunk/src/paula/examples/interfaces.py | 87 +++ paula.examples/trunk/src/paula/examples/tests.py | 40 ++ paula.groups/trunk/.gitignore | 15 + paula.groups/trunk/README.txt | 4 + paula.groups/trunk/bootstrap.py | 52 ++ paula.groups/trunk/buildout.cfg | 13 + paula.groups/trunk/docs/HISTORY.txt | 8 + paula.groups/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.groups/trunk/setup.cfg | 2 + paula.groups/trunk/setup.py | 47 ++ paula.groups/trunk/src/paula/__init__.py | 6 + paula.groups/trunk/src/paula/groups/README.txt | 0 paula.groups/trunk/src/paula/groups/__init__.py | 23 + paula.groups/trunk/src/paula/groups/config.py | 23 + paula.groups/trunk/src/paula/groups/configure.zcml | 9 + paula.groups/trunk/src/paula/groups/ftesting.zcml | 10 + paula.groups/trunk/src/paula/groups/interfaces.py | 35 ++ paula.groups/trunk/src/paula/groups/subscribers.py | 52 ++ paula.groups/trunk/src/paula/groups/tests.py | 40 ++ paula.grouputil/trunk/.gitignore | 15 + paula.grouputil/trunk/README.txt | 4 + paula.grouputil/trunk/bootstrap.py | 52 ++ paula.grouputil/trunk/buildout.cfg | 14 + paula.grouputil/trunk/docs/HISTORY.txt | 8 + paula.grouputil/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.grouputil/trunk/setup.cfg | 2 + paula.grouputil/trunk/setup.py | 46 ++ paula.grouputil/trunk/src/paula/__init__.py | 6 + .../trunk/src/paula/grouputil/README.txt | 2 + .../trunk/src/paula/grouputil/__init__.py | 23 + .../trunk/src/paula/grouputil/config.py | 23 + .../trunk/src/paula/grouputil/configure.zcml | 11 + .../trunk/src/paula/grouputil/ftesting.zcml | 17 + .../trunk/src/paula/grouputil/interfaces.py | 65 ++ .../trunk/src/paula/grouputil/subscribers.py | 69 +++ paula.grouputil/trunk/src/paula/grouputil/tests.py | 40 ++ paula.grouputil/trunk/src/paula/grouputil/utils.py | 125 ++++ paula.ploneexamples/trunk/.gitignore | 14 + paula.ploneexamples/trunk/README.txt | 4 + paula.ploneexamples/trunk/bootstrap.py | 52 ++ paula.ploneexamples/trunk/docs/HISTORY.txt | 8 + paula.ploneexamples/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.ploneexamples/trunk/setup.cfg | 2 + paula.ploneexamples/trunk/setup.py | 46 ++ paula.ploneexamples/trunk/src/paula/__init__.py | 6 + .../src/paula/ploneexamples/Extensions/Install.py | 62 ++ .../trunk/src/paula/ploneexamples/README.txt | 0 .../trunk/src/paula/ploneexamples/__init__.py | 31 + .../trunk/src/paula/ploneexamples/adapters.zcml | 7 + .../src/paula/ploneexamples/browser/__init__.py | 0 .../src/paula/ploneexamples/browser/basicgroup.png | Bin 0 -> 952 bytes .../src/paula/ploneexamples/browser/basicgroup.pt | 26 + .../src/paula/ploneexamples/browser/basicgroup.py | 33 + .../paula/ploneexamples/browser/basicgroup.zcml | 39 ++ .../src/paula/ploneexamples/browser/configure.zcml | 8 + .../src/paula/ploneexamples/browser/minplone.png | Bin 0 -> 952 bytes .../src/paula/ploneexamples/browser/minplone.pt | 26 + .../src/paula/ploneexamples/browser/minplone.py | 33 + .../src/paula/ploneexamples/browser/minplone.zcml | 39 ++ .../trunk/src/paula/ploneexamples/config.py | 23 + .../trunk/src/paula/ploneexamples/configure.zcml | 25 + .../trunk/src/paula/ploneexamples/content.py | 70 +++ .../trunk/src/paula/ploneexamples/content.zcml | 59 ++ .../trunk/src/paula/ploneexamples/profiles.zcml | 14 + .../ploneexamples/profiles/default/metadata.xml | 4 + .../paula/ploneexamples/profiles/default/types.xml | 6 + .../profiles/default/types/Paula_Basic_Group.xml | 27 + .../default/types/Paula_Minimal_Plone_User.xml | 27 + paula.plonepas/trunk/.gitignore | 15 + paula.plonepas/trunk/README.txt | 1 + paula.plonepas/trunk/bootstrap.py | 52 ++ paula.plonepas/trunk/buildout.cfg | 99 +++ paula.plonepas/trunk/docs/HISTORY.txt | 8 + paula.plonepas/trunk/docs/INSTALL.txt | 43 ++ paula.plonepas/trunk/docs/LICENSE.GPL | 222 +++++++ paula.plonepas/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.plonepas/trunk/externals/EXTERNALS.txt | 10 + paula.plonepas/trunk/products/README.txt | 1 + paula.plonepas/trunk/setup.cfg | 2 + paula.plonepas/trunk/setup.py | 44 ++ paula.plonepas/trunk/src/paula/__init__.py | 6 + paula.plonepas/trunk/src/paula/plonepas/README.txt | 162 +++++ .../trunk/src/paula/plonepas/__init__.py | 74 +++ .../trunk/src/paula/plonepas/configure.zcml | 18 + .../trunk/src/paula/plonepas/integration-paula.txt | 70 +++ .../trunk/src/paula/plonepas/plugins/__init__.py | 22 + .../trunk/src/paula/plonepas/plugins/auth.py | 135 +++++ .../trunk/src/paula/plonepas/plugins/groups.py | 96 +++ .../trunk/src/paula/plonepas/plugins/properties.py | 173 ++++++ .../trunk/src/paula/plonepas/profiles.zcml | 14 + .../profiles/default/componentregistry.xml | 36 ++ .../plonepas/profiles/default/import_steps.xml | 24 + .../paula/plonepas/profiles/default/metadata.xml | 4 + .../default/paula-plonepas-create-paula-suite.txt | 2 + .../default/paula-plonepas-setup-plugins.txt | 2 + .../trunk/src/paula/plonepas/setuphandlers.py | 127 ++++ .../trunk/src/paula/plonepas/tests/__init__.py | 2 + .../trunk/src/paula/plonepas/tests/config.py | 23 + .../trunk/src/paula/plonepas/tests/plone_base.py | 59 ++ .../src/paula/plonepas/tests/test_doctests.py | 39 ++ paula.plonepas/trunk/src/paula/plonepas/utils.py | 81 +++ .../plonepas/www/AuthenticationPluginForm.zpt | 56 ++ .../src/paula/plonepas/www/GroupsPluginForm.zpt | 56 ++ .../paula/plonepas/www/PropertiesPluginForm.zpt | 56 ++ paula.properties/trunk/.gitignore | 15 + paula.properties/trunk/README.txt | 4 + paula.properties/trunk/bootstrap.py | 52 ++ paula.properties/trunk/buildout.cfg | 13 + paula.properties/trunk/docs/HISTORY.txt | 8 + paula.properties/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.properties/trunk/externals/EXTERNALS.txt | 1 + paula.properties/trunk/setup.cfg | 2 + paula.properties/trunk/setup.py | 47 ++ paula.properties/trunk/src/paula/__init__.py | 6 + .../trunk/src/paula/properties/README.txt | 90 +++ .../trunk/src/paula/properties/__init__.py | 23 + .../trunk/src/paula/properties/config.py | 23 + .../trunk/src/paula/properties/configure.zcml | 9 + .../trunk/src/paula/properties/ftesting.zcml | 16 + .../trunk/src/paula/properties/interfaces.py | 54 ++ .../trunk/src/paula/properties/subscribers.py | 140 +++++ .../trunk/src/paula/properties/tests.py | 40 ++ paula.proputil/trunk/.gitignore | 15 + paula.proputil/trunk/README.txt | 4 + paula.proputil/trunk/bootstrap.py | 52 ++ paula.proputil/trunk/buildout.cfg | 14 + paula.proputil/trunk/docs/HISTORY.txt | 8 + paula.proputil/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.proputil/trunk/externals/EXTERNALS.txt | 2 + paula.proputil/trunk/setup.cfg | 2 + paula.proputil/trunk/setup.py | 46 ++ paula.proputil/trunk/src/paula/__init__.py | 6 + paula.proputil/trunk/src/paula/proputil/README.txt | 2 + .../trunk/src/paula/proputil/__init__.py | 24 + paula.proputil/trunk/src/paula/proputil/config.py | 23 + .../trunk/src/paula/proputil/configure.zcml | 11 + .../trunk/src/paula/proputil/ftesting.zcml | 17 + .../trunk/src/paula/proputil/interfaces.py | 52 ++ .../trunk/src/paula/proputil/subscribers.py | 76 +++ paula.proputil/trunk/src/paula/proputil/tests.py | 40 ++ paula.proputil/trunk/src/paula/proputil/utils.py | 183 ++++++ paula.suite/trunk/.gitignore | 14 + paula.suite/trunk/README.txt | 0 paula.suite/trunk/bootstrap.py | 52 ++ paula.suite/trunk/buildout.cfg | 20 + paula.suite/trunk/docs/HISTORY.txt | 8 + paula.suite/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.suite/trunk/externals/EXTERNALS.txt | 8 + paula.suite/trunk/setup.cfg | 2 + paula.suite/trunk/setup.py | 52 ++ paula.suite/trunk/src/paula/__init__.py | 6 + paula.suite/trunk/src/paula/suite/README.txt | 234 ++++++++ paula.suite/trunk/src/paula/suite/__init__.py | 115 ++++ paula.suite/trunk/src/paula/suite/config.py | 26 + paula.suite/trunk/src/paula/suite/configure.zcml | 12 + paula.suite/trunk/src/paula/suite/ftesting.zcml | 29 + paula.suite/trunk/src/paula/suite/tests.py | 40 ++ paula.testing/trunk/.gitignore | 13 + paula.testing/trunk/README.txt | 5 + paula.testing/trunk/bootstrap.py | 52 ++ paula.testing/trunk/buildout.cfg | 12 + paula.testing/trunk/docs/HISTORY.txt | 8 + paula.testing/trunk/docs/LICENSE.GPL | 339 +++++++++++ paula.testing/trunk/docs/LICENSE.txt | 661 +++++++++++++++++++++ paula.testing/trunk/setup.py | 41 ++ paula.testing/trunk/src/paula/__init__.py | 6 + paula.testing/trunk/src/paula/testing/README.txt | 13 + paula.testing/trunk/src/paula/testing/__init__.py | 26 + paula.testing/trunk/src/paula/testing/config.py | 23 + .../trunk/src/paula/testing/configure.zcml | 9 + .../trunk/src/paula/testing/ftesting.zcml | 10 + paula.testing/trunk/src/paula/testing/interact.py | 37 ++ paula.testing/trunk/src/paula/testing/module.py | 36 ++ .../trunk/src/paula/testing/package/__init__.py | 22 + .../trunk/src/paula/testing/package/module.py | 27 + .../paula/testing/package/subpackage/__init__.py | 22 + .../src/paula/testing/package/subpackage/module.py | 27 + paula.testing/trunk/src/paula/testing/testing.py | 266 +++++++++ paula.testing/trunk/src/paula/testing/tests.py | 40 ++ 236 files changed, 15758 insertions(+) create mode 100644 STATE.txt create mode 100644 paula.authentication/trunk/.gitignore create mode 100644 paula.authentication/trunk/README.txt create mode 100644 paula.authentication/trunk/bootstrap.py create mode 100644 paula.authentication/trunk/buildout.cfg create mode 100644 paula.authentication/trunk/docs/HISTORY.txt create mode 100644 paula.authentication/trunk/docs/LICENSE.txt create mode 100644 paula.authentication/trunk/externals/EXTERNALS.txt create mode 100644 paula.authentication/trunk/setup.cfg create mode 100644 paula.authentication/trunk/setup.py create mode 100644 paula.authentication/trunk/src/paula/__init__.py create mode 100644 paula.authentication/trunk/src/paula/authentication/README.txt create mode 100644 paula.authentication/trunk/src/paula/authentication/__init__.py create mode 100644 paula.authentication/trunk/src/paula/authentication/config.py create mode 100644 paula.authentication/trunk/src/paula/authentication/configure.zcml create mode 100644 paula.authentication/trunk/src/paula/authentication/ftesting.zcml create mode 100644 paula.authentication/trunk/src/paula/authentication/interfaces.py create mode 100644 paula.authentication/trunk/src/paula/authentication/pauplugins.py create mode 100644 paula.authentication/trunk/src/paula/authentication/tests.py create mode 100644 paula.authutil/trunk/.gitignore create mode 100644 paula.authutil/trunk/README.txt create mode 100644 paula.authutil/trunk/bootstrap.py create mode 100644 paula.authutil/trunk/buildout.cfg create mode 100644 paula.authutil/trunk/docs/HISTORY.txt create mode 100644 paula.authutil/trunk/docs/LICENSE.txt create mode 100644 paula.authutil/trunk/externals/EXTERNALS.txt create mode 100644 paula.authutil/trunk/setup.cfg create mode 100644 paula.authutil/trunk/setup.py create mode 100644 paula.authutil/trunk/src/paula/__init__.py create mode 100644 paula.authutil/trunk/src/paula/authutil/README.txt create mode 100644 paula.authutil/trunk/src/paula/authutil/__init__.py create mode 100644 paula.authutil/trunk/src/paula/authutil/config.py create mode 100644 paula.authutil/trunk/src/paula/authutil/configure.zcml create mode 100644 paula.authutil/trunk/src/paula/authutil/ftesting.zcml create mode 100644 paula.authutil/trunk/src/paula/authutil/interfaces.py create mode 100644 paula.authutil/trunk/src/paula/authutil/subscribers.py create mode 100644 paula.authutil/trunk/src/paula/authutil/tests.py create mode 100644 paula.authutil/trunk/src/paula/authutil/utils.py create mode 100644 paula.examples/trunk/.gitignore create mode 100644 paula.examples/trunk/README.txt create mode 100644 paula.examples/trunk/bootstrap.py create mode 100644 paula.examples/trunk/buildout.cfg create mode 100644 paula.examples/trunk/docs/HISTORY.txt create mode 100644 paula.examples/trunk/docs/LICENSE.txt create mode 100644 paula.examples/trunk/externals/EXTERNALS.txt create mode 100644 paula.examples/trunk/setup.cfg create mode 100644 paula.examples/trunk/setup.py create mode 100644 paula.examples/trunk/src/paula/__init__.py create mode 100644 paula.examples/trunk/src/paula/examples/README.txt create mode 100644 paula.examples/trunk/src/paula/examples/__init__.py create mode 100644 paula.examples/trunk/src/paula/examples/adapters.py create mode 100644 paula.examples/trunk/src/paula/examples/adapters.zcml create mode 100644 paula.examples/trunk/src/paula/examples/config.py create mode 100644 paula.examples/trunk/src/paula/examples/configure.zcml create mode 100644 paula.examples/trunk/src/paula/examples/content.py create mode 100644 paula.examples/trunk/src/paula/examples/content.zcml create mode 100644 paula.examples/trunk/src/paula/examples/ftesting.zcml create mode 100644 paula.examples/trunk/src/paula/examples/interfaces.py create mode 100644 paula.examples/trunk/src/paula/examples/tests.py create mode 100644 paula.groups/trunk/.gitignore create mode 100644 paula.groups/trunk/README.txt create mode 100644 paula.groups/trunk/bootstrap.py create mode 100644 paula.groups/trunk/buildout.cfg create mode 100644 paula.groups/trunk/docs/HISTORY.txt create mode 100644 paula.groups/trunk/docs/LICENSE.txt create mode 100644 paula.groups/trunk/setup.cfg create mode 100644 paula.groups/trunk/setup.py create mode 100644 paula.groups/trunk/src/paula/__init__.py create mode 100644 paula.groups/trunk/src/paula/groups/README.txt create mode 100644 paula.groups/trunk/src/paula/groups/__init__.py create mode 100644 paula.groups/trunk/src/paula/groups/config.py create mode 100644 paula.groups/trunk/src/paula/groups/configure.zcml create mode 100644 paula.groups/trunk/src/paula/groups/ftesting.zcml create mode 100644 paula.groups/trunk/src/paula/groups/interfaces.py create mode 100644 paula.groups/trunk/src/paula/groups/subscribers.py create mode 100644 paula.groups/trunk/src/paula/groups/tests.py create mode 100644 paula.grouputil/trunk/.gitignore create mode 100644 paula.grouputil/trunk/README.txt create mode 100644 paula.grouputil/trunk/bootstrap.py create mode 100644 paula.grouputil/trunk/buildout.cfg create mode 100644 paula.grouputil/trunk/docs/HISTORY.txt create mode 100644 paula.grouputil/trunk/docs/LICENSE.txt create mode 100644 paula.grouputil/trunk/setup.cfg create mode 100644 paula.grouputil/trunk/setup.py create mode 100644 paula.grouputil/trunk/src/paula/__init__.py create mode 100644 paula.grouputil/trunk/src/paula/grouputil/README.txt create mode 100644 paula.grouputil/trunk/src/paula/grouputil/__init__.py create mode 100644 paula.grouputil/trunk/src/paula/grouputil/config.py create mode 100644 paula.grouputil/trunk/src/paula/grouputil/configure.zcml create mode 100644 paula.grouputil/trunk/src/paula/grouputil/ftesting.zcml create mode 100644 paula.grouputil/trunk/src/paula/grouputil/interfaces.py create mode 100644 paula.grouputil/trunk/src/paula/grouputil/subscribers.py create mode 100644 paula.grouputil/trunk/src/paula/grouputil/tests.py create mode 100644 paula.grouputil/trunk/src/paula/grouputil/utils.py create mode 100644 paula.ploneexamples/trunk/.gitignore create mode 100644 paula.ploneexamples/trunk/README.txt create mode 100644 paula.ploneexamples/trunk/bootstrap.py create mode 100644 paula.ploneexamples/trunk/docs/HISTORY.txt create mode 100644 paula.ploneexamples/trunk/docs/LICENSE.txt create mode 100644 paula.ploneexamples/trunk/setup.cfg create mode 100644 paula.ploneexamples/trunk/setup.py create mode 100644 paula.ploneexamples/trunk/src/paula/__init__.py create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/Extensions/Install.py create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/README.txt create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/__init__.py create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/adapters.zcml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/__init__.py create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.png create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.pt create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.py create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.zcml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/configure.zcml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.png create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.pt create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.py create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.zcml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/config.py create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/configure.zcml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/content.py create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/content.zcml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/profiles.zcml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/metadata.xml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types.xml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types/Paula_Basic_Group.xml create mode 100644 paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types/Paula_Minimal_Plone_User.xml create mode 100644 paula.plonepas/trunk/.gitignore create mode 100644 paula.plonepas/trunk/README.txt create mode 100644 paula.plonepas/trunk/bootstrap.py create mode 100644 paula.plonepas/trunk/buildout.cfg create mode 100644 paula.plonepas/trunk/docs/HISTORY.txt create mode 100644 paula.plonepas/trunk/docs/INSTALL.txt create mode 100644 paula.plonepas/trunk/docs/LICENSE.GPL create mode 100644 paula.plonepas/trunk/docs/LICENSE.txt create mode 100644 paula.plonepas/trunk/externals/EXTERNALS.txt create mode 100644 paula.plonepas/trunk/products/README.txt create mode 100644 paula.plonepas/trunk/setup.cfg create mode 100644 paula.plonepas/trunk/setup.py create mode 100644 paula.plonepas/trunk/src/paula/__init__.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/README.txt create mode 100644 paula.plonepas/trunk/src/paula/plonepas/__init__.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/configure.zcml create mode 100644 paula.plonepas/trunk/src/paula/plonepas/integration-paula.txt create mode 100644 paula.plonepas/trunk/src/paula/plonepas/plugins/__init__.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/plugins/auth.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/plugins/groups.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/plugins/properties.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/profiles.zcml create mode 100644 paula.plonepas/trunk/src/paula/plonepas/profiles/default/componentregistry.xml create mode 100644 paula.plonepas/trunk/src/paula/plonepas/profiles/default/import_steps.xml create mode 100644 paula.plonepas/trunk/src/paula/plonepas/profiles/default/metadata.xml create mode 100644 paula.plonepas/trunk/src/paula/plonepas/profiles/default/paula-plonepas-create-paula-suite.txt create mode 100644 paula.plonepas/trunk/src/paula/plonepas/profiles/default/paula-plonepas-setup-plugins.txt create mode 100644 paula.plonepas/trunk/src/paula/plonepas/setuphandlers.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/tests/__init__.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/tests/config.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/tests/plone_base.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/tests/test_doctests.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/utils.py create mode 100644 paula.plonepas/trunk/src/paula/plonepas/www/AuthenticationPluginForm.zpt create mode 100644 paula.plonepas/trunk/src/paula/plonepas/www/GroupsPluginForm.zpt create mode 100644 paula.plonepas/trunk/src/paula/plonepas/www/PropertiesPluginForm.zpt create mode 100644 paula.properties/trunk/.gitignore create mode 100644 paula.properties/trunk/README.txt create mode 100644 paula.properties/trunk/bootstrap.py create mode 100644 paula.properties/trunk/buildout.cfg create mode 100644 paula.properties/trunk/docs/HISTORY.txt create mode 100644 paula.properties/trunk/docs/LICENSE.txt create mode 100644 paula.properties/trunk/externals/EXTERNALS.txt create mode 100644 paula.properties/trunk/setup.cfg create mode 100644 paula.properties/trunk/setup.py create mode 100644 paula.properties/trunk/src/paula/__init__.py create mode 100644 paula.properties/trunk/src/paula/properties/README.txt create mode 100644 paula.properties/trunk/src/paula/properties/__init__.py create mode 100644 paula.properties/trunk/src/paula/properties/config.py create mode 100644 paula.properties/trunk/src/paula/properties/configure.zcml create mode 100644 paula.properties/trunk/src/paula/properties/ftesting.zcml create mode 100644 paula.properties/trunk/src/paula/properties/interfaces.py create mode 100644 paula.properties/trunk/src/paula/properties/subscribers.py create mode 100644 paula.properties/trunk/src/paula/properties/tests.py create mode 100644 paula.proputil/trunk/.gitignore create mode 100644 paula.proputil/trunk/README.txt create mode 100644 paula.proputil/trunk/bootstrap.py create mode 100644 paula.proputil/trunk/buildout.cfg create mode 100644 paula.proputil/trunk/docs/HISTORY.txt create mode 100644 paula.proputil/trunk/docs/LICENSE.txt create mode 100644 paula.proputil/trunk/externals/EXTERNALS.txt create mode 100644 paula.proputil/trunk/setup.cfg create mode 100644 paula.proputil/trunk/setup.py create mode 100644 paula.proputil/trunk/src/paula/__init__.py create mode 100644 paula.proputil/trunk/src/paula/proputil/README.txt create mode 100644 paula.proputil/trunk/src/paula/proputil/__init__.py create mode 100644 paula.proputil/trunk/src/paula/proputil/config.py create mode 100644 paula.proputil/trunk/src/paula/proputil/configure.zcml create mode 100644 paula.proputil/trunk/src/paula/proputil/ftesting.zcml create mode 100644 paula.proputil/trunk/src/paula/proputil/interfaces.py create mode 100644 paula.proputil/trunk/src/paula/proputil/subscribers.py create mode 100644 paula.proputil/trunk/src/paula/proputil/tests.py create mode 100644 paula.proputil/trunk/src/paula/proputil/utils.py create mode 100644 paula.suite/trunk/.gitignore create mode 100644 paula.suite/trunk/README.txt create mode 100644 paula.suite/trunk/bootstrap.py create mode 100644 paula.suite/trunk/buildout.cfg create mode 100644 paula.suite/trunk/docs/HISTORY.txt create mode 100644 paula.suite/trunk/docs/LICENSE.txt create mode 100644 paula.suite/trunk/externals/EXTERNALS.txt create mode 100644 paula.suite/trunk/setup.cfg create mode 100644 paula.suite/trunk/setup.py create mode 100644 paula.suite/trunk/src/paula/__init__.py create mode 100644 paula.suite/trunk/src/paula/suite/README.txt create mode 100644 paula.suite/trunk/src/paula/suite/__init__.py create mode 100644 paula.suite/trunk/src/paula/suite/config.py create mode 100644 paula.suite/trunk/src/paula/suite/configure.zcml create mode 100644 paula.suite/trunk/src/paula/suite/ftesting.zcml create mode 100644 paula.suite/trunk/src/paula/suite/tests.py create mode 100644 paula.testing/trunk/.gitignore create mode 100644 paula.testing/trunk/README.txt create mode 100644 paula.testing/trunk/bootstrap.py create mode 100644 paula.testing/trunk/buildout.cfg create mode 100644 paula.testing/trunk/docs/HISTORY.txt create mode 100644 paula.testing/trunk/docs/LICENSE.GPL create mode 100644 paula.testing/trunk/docs/LICENSE.txt create mode 100644 paula.testing/trunk/setup.py create mode 100644 paula.testing/trunk/src/paula/__init__.py create mode 100644 paula.testing/trunk/src/paula/testing/README.txt create mode 100644 paula.testing/trunk/src/paula/testing/__init__.py create mode 100644 paula.testing/trunk/src/paula/testing/config.py create mode 100644 paula.testing/trunk/src/paula/testing/configure.zcml create mode 100644 paula.testing/trunk/src/paula/testing/ftesting.zcml create mode 100644 paula.testing/trunk/src/paula/testing/interact.py create mode 100644 paula.testing/trunk/src/paula/testing/module.py create mode 100644 paula.testing/trunk/src/paula/testing/package/__init__.py create mode 100644 paula.testing/trunk/src/paula/testing/package/module.py create mode 100644 paula.testing/trunk/src/paula/testing/package/subpackage/__init__.py create mode 100644 paula.testing/trunk/src/paula/testing/package/subpackage/module.py create mode 100644 paula.testing/trunk/src/paula/testing/testing.py create mode 100644 paula.testing/trunk/src/paula/testing/tests.py diff --git a/STATE.txt b/STATE.txt new file mode 100644 index 0000000..5ecade3 --- /dev/null +++ b/STATE.txt @@ -0,0 +1,62 @@ +unit tests pass for: + - paula.authentication + - paula.authutil + - paula.properties + - paula.proputil + - paula.examples + - paula.suite + - paula.plonepas +run from their dedicated, up-to-date zope3 buildouts, as well as from within +paula.plonepas buildout (zope-2.10.x). + +paula.suite contains the integration test for: + - PAU from zope.app.authentication with factories from principalfolder + - paula.authentication + - paula.authutil + - paula.properties + - paula.proputil + - paula.examples + - paula.suite +It passes in paula.suite's buildout with up-to-date zope3 eggs, as well as run +from within paula.plonepas buildout (zope-2.10.x) + +paula.suite supports authentication and properties. +paula.plonepas supports authentication, properties and groups. + + +DONE: + - make paula.ploneexamples content show up - thx jensens + + +TODO/IDEAS: + - fix login: strangely the test seem to pass, but a real login does not + work + - handle id collisions between users and groups + - register on plone.org/products + - open bug tracker + - check all doctest/doctexts + - get rid of hacks + - get rid of unnecessary code + - group in group support + - Code beautification + - camelCase for functions + - caching where necessary + - reacting to changing objects where necessary + - migration scripts + - IUserAddedPlugin.doAdduser with default location + - definition of roles on principals, i.e. IRolesPlugin.getRolesForPrincipal + support + - IUserEnumerationPlugin support + - IGroupEnumerationPlugin support + - IUserIntrospection support + getUserIds() + getUserNames() + getUsers() + - IUserManagement support + doChangeUser - passwort + doDeleteUser + - IMutablePropetiesPlugin + setPropertiesForUser + deleteUser + - ISchemaMutablePropertiesPlugin + addProperty diff --git a/paula.authentication/trunk/.gitignore b/paula.authentication/trunk/.gitignore new file mode 100644 index 0000000..013c539 --- /dev/null +++ b/paula.authentication/trunk/.gitignore @@ -0,0 +1,14 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old diff --git a/paula.authentication/trunk/README.txt b/paula.authentication/trunk/README.txt new file mode 100644 index 0000000..1bc9497 --- /dev/null +++ b/paula.authentication/trunk/README.txt @@ -0,0 +1,18 @@ +Introduction +============ + +paula.authentication provides a PAU (zope.app.authentication) authenticator +plugin and a PAU credentials plugin. + +Authenticator Plugin +-------------------- + +The authenticator plugin retrieves an authentication provider from a list of +providers and uses that for authentication. The list is registered as a +utility. + +Credentials Plugin +------------------ + +The credentials plugin accepts a simple mapping, makes sure that it claims to +provide IRequest and returns it. (Needed by internals of PAU.) diff --git a/paula.authentication/trunk/bootstrap.py b/paula.authentication/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.authentication/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.authentication/trunk/buildout.cfg b/paula.authentication/trunk/buildout.cfg new file mode 100644 index 0000000..cf49ce3 --- /dev/null +++ b/paula.authentication/trunk/buildout.cfg @@ -0,0 +1,13 @@ +[buildout] +develop = . + externals/paula.testing +parts = test py + +[test] +recipe = zc.recipe.testrunner +eggs = paula.authentication [test] + +[py] +recipe = zc.recipe.egg +interpreter = py +eggs = ${test:eggs} diff --git a/paula.authentication/trunk/docs/HISTORY.txt b/paula.authentication/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.authentication/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.authentication/trunk/docs/LICENSE.txt b/paula.authentication/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.authentication/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.authentication/trunk/externals/EXTERNALS.txt b/paula.authentication/trunk/externals/EXTERNALS.txt new file mode 100644 index 0000000..fa7fb20 --- /dev/null +++ b/paula.authentication/trunk/externals/EXTERNALS.txt @@ -0,0 +1 @@ +paula.testing https://svn.plone.org/svn/collective/paula/paula.testing/trunk diff --git a/paula.authentication/trunk/setup.cfg b/paula.authentication/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.authentication/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.authentication/trunk/setup.py b/paula.authentication/trunk/setup.py new file mode 100644 index 0000000..be141e1 --- /dev/null +++ b/paula.authentication/trunk/setup.py @@ -0,0 +1,46 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.authentication', + version=version, + description="Paula authentication PAU plugin", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.interface', + 'zope.schema', + 'zope.app.authentication', + ], + extras_require=dict( + test = [ + 'paula.testing>=0.59', + ], + ), + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.authentication/trunk/src/paula/__init__.py b/paula.authentication/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.authentication/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.authentication/trunk/src/paula/authentication/README.txt b/paula.authentication/trunk/src/paula/authentication/README.txt new file mode 100644 index 0000000..fc055a3 --- /dev/null +++ b/paula.authentication/trunk/src/paula/authentication/README.txt @@ -0,0 +1,211 @@ +Currently unused + + +paula.authentication README.txt +=============================== + +This file serves as an integration test of paula.authentication with +a PluggableAuthenticationUtility. + +Our configure.zcml registered our plugins globally, named "Paula Authenticator +Plugin" and "Paula Mapping Credentials Plugin". Let's check whether they are +there: + + >>> ap_name = 'Paula Authenticator Plugin' + >>> cp_name = 'Paula Mapping Credentials Plugin' + + >>> from zope.app.authentication import interfaces + >>> getUtility(interfaces.IAuthenticatorPlugin, ap_name) is not None + True + >>> getUtility(interfaces.ICredentialsPlugin, cp_name) is not None + True + + +In order to use them, you need to have a PAU and tell it about them. + + +PAU factories, provided globally as multi-adapters from +(IPrincipalInfo, IRequest) to the resp. factory interface. + + >>> from zope.app.authentication import principalfolder + >>> provideAdapter(principalfolder.AuthenticatedPrincipalFactory) + >>> provideAdapter(principalfolder.FoundPrincipalFactory) + +create a PAU, + + >>> from zope.app.authentication import PluggableAuthentication + >>> pau = PluggableAuthentication() + +register plugins. Take care, PAU won't complain, but just won't authenticated, +if you misspell... + + >>> pau.authenticatorPlugins = (ap_name,) + >>> pau.credentialsPlugins = (cp_name,) + + +In order to have authentication data, we use a mockup auth provider utility. +It is the job of paula.authutil to test its integration with us, here we do +not want to be dependent on its correct implementation. + +Create mockup auth provider and auth provider utility + + >>> from paula.authentication.interfaces import IAuthProvider + >>> from paula.authentication.interfaces import IAuthProviders + + >>> ap = Mock(id="global", validate = lambda login=None,password=None: \\ + ... password == "correct") + >>> alsoProvides(ap, IAuthProvider) + + >>> class MockAPU(object): + ... implements(IAuthProviders) + ... def __getitem__(self, id): + ... return ap + + >>> apu = MockAPU() + >>> provideUtility(apu, IAuthProviders) + + +Try to authenticate + + >>> import UserDict + >>> from zope.publisher.interfaces import IRequest + >>> req = UserDict.UserDict() + >>> alsoProvides(req, IRequest) + +no credentials + + >>> print pau.authenticate(req) + None + +wrong credentials + + >>> req['login'] = "global" + >>> req['password'] = "wrong" + >>> print pau.authenticate(req) + None + +correct credentials + + >>> req['password'] = "correct" + >>> pau.authenticate(req) + Principal('global') + + +Now all components (PAU, our AuthenticatorPlugin and credentials plugin, and +the mock AuthProviders) were registered globally. Let's make sure that +everything works, when providing context. + +Get the root folder and make sure it is a site + + >>> from zope.location.interfaces import ISite + >>> root = getRootFolder() + >>> ISite.providedBy(root) + True + +Check that our site's manager and the global site manager are different + + >>> gsm = getSiteManager() + >>> sm = root.getSiteManager() + >>> gsm is not sm + True + +make sure, that also zope.component's getSiteManager knows about this, +I managed to create situations, where it did not... + + >>> getSiteManager(context=root) is gsm + False + >>> getSiteManager(context=root) is sm + True + + + +create another pau, that is contained in our new site and let it now about the +same plugins, it should find them when being contained. + + >>> loc_pau = PluggableAuthentication() + >>> loc_pau.authenticatorPlugins = (ap_name,) + >>> loc_pau.credentialsPlugins = (cp_name,) + >>> root['loc_pau'] = loc_pau + +In the context of our local pau, we should get our site's site manager + + >>> getSiteManager(context=loc_pau) is sm + True + +However, we need to provide a different authenticator plugin, that is aware of +location, i.e. uses context for retrieving utilities. + + >>> from zope.app.authentication.interfaces import IAuthenticatorPlugin + >>> from paula.authentication import LocalAuthenticatorPlugin + >>> from paula.authentication.interfaces import ILocalAuthenticatorPlugin + + >>> loc_pau_ap = LocalAuthenticatorPlugin() + >>> root['loc_pau_ap'] = loc_pau_ap + + >>> getSiteManager(context=loc_pau_ap) is sm + True + + +as long as we do not register, it will not be in the context of our local pau + + >>> sm_pau_ap = getUtility(IAuthenticatorPlugin, context=loc_pau, + ... name=ap_name) + >>> ILocalAuthenticatorPlugin.providedBy(sm_pau_ap) + False + + >>> sm.registerUtility(loc_pau_ap, ILocalAuthenticatorPlugin, name=ap_name) + >>> sm_pau_ap = getUtility(IAuthenticatorPlugin, context=loc_pau, + ... name=ap_name) + >>> ILocalAuthenticatorPlugin.providedBy(sm_pau_ap) + True + + +Authentication with the credentials in the global registry still works + + >>> loc_pau.authenticate(req) + Principal('global') + + +Now, let's create a new auth provider utility, with a different auth provider + + >>> loc_ap = Mock(id="local", validate = lambda login=None,password=None: \ + ... password == "local") + >>> alsoProvides(loc_ap, IAuthProvider) + + >>> class MockAPU(object): + ... implements(IAuthProviders) + ... def __getitem__(self, id): + ... return loc_ap + + >>> loc_apu = MockAPU() + +still the global utility + + >>> sm.getUtility(IAuthProviders) is apu + True + +now the local one + + >>> sm.registerUtility(loc_apu, IAuthProviders) + >>> sm.getUtility(IAuthProviders) is loc_apu + True + +a request corresponding to the credentials in the local registry + + >>> loc_req = UserDict.UserDict() + >>> alsoProvides(loc_req, IRequest) + >>> loc_req['login'] = 'local' + >>> loc_req['password'] = 'local' + + +Both levels, global and local, do not collide. + + >>> loc_pau.authenticate(loc_req) + Principal('local') + >>> loc_pau.authenticate(req) is None + True + + >>> pau.authenticate(loc_req) is None + True + >>> pau.authenticate(req) + Principal('global') diff --git a/paula.authentication/trunk/src/paula/authentication/__init__.py b/paula.authentication/trunk/src/paula/authentication/__init__.py new file mode 100644 index 0000000..b2e5c58 --- /dev/null +++ b/paula.authentication/trunk/src/paula/authentication/__init__.py @@ -0,0 +1,25 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from pauplugins import AuthenticatorPlugin +from pauplugins import LocalAuthenticatorPlugin +from pauplugins import CredentialsFromMappingPlugin diff --git a/paula.authentication/trunk/src/paula/authentication/config.py b/paula.authentication/trunk/src/paula/authentication/config.py new file mode 100644 index 0000000..3d0f0ab --- /dev/null +++ b/paula.authentication/trunk/src/paula/authentication/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.authentication" diff --git a/paula.authentication/trunk/src/paula/authentication/configure.zcml b/paula.authentication/trunk/src/paula/authentication/configure.zcml new file mode 100644 index 0000000..277ccaa --- /dev/null +++ b/paula.authentication/trunk/src/paula/authentication/configure.zcml @@ -0,0 +1,18 @@ + + + + + diff --git a/paula.authentication/trunk/src/paula/authentication/ftesting.zcml b/paula.authentication/trunk/src/paula/authentication/ftesting.zcml new file mode 100644 index 0000000..3c1c978 --- /dev/null +++ b/paula.authentication/trunk/src/paula/authentication/ftesting.zcml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/paula.authentication/trunk/src/paula/authentication/interfaces.py b/paula.authentication/trunk/src/paula/authentication/interfaces.py new file mode 100644 index 0000000..ded7340 --- /dev/null +++ b/paula.authentication/trunk/src/paula/authentication/interfaces.py @@ -0,0 +1,68 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.interface import Interface +from zope.schema import TextLine + +from zope.app.authentication.interfaces import IAuthenticatorPlugin as IPauAP +from zope.app.authentication.interfaces import ICredentialsPlugin + +class IAuthenticatorPlugin(IPauAP): + """A paula authenticator plugin for PAU + """ + +class ILocalAuthenticatorPlugin(IAuthenticatorPlugin): + """A context-aware paula authenticator plugin for PAU + """ + +class ICredentialsFromMappingPlugin(ICredentialsPlugin): + """Marks a credentials plugin, that simply returns a mapping it + receives, after making sure, that it provides IRequest + + This is needed by PAU to find its factories. + """ + + +class IPrincipalId(Interface): + """A principals unique id + """ + id = TextLine( + title=u"Id", + description=u"The unique principal id.", + required=True, + ) + + +class IAuthProvider(IPrincipalId): + """ + """ + def validate(login=u"", password=u""): + """validates the password against a stored password + """ + + +class IAuthProviders(Interface): + """auth providers for authenticatable principals known to paula + """ + def __getitem__(id): + """returns a paula IAuthProvider object for the principal id + """ diff --git a/paula.authentication/trunk/src/paula/authentication/pauplugins.py b/paula.authentication/trunk/src/paula/authentication/pauplugins.py new file mode 100644 index 0000000..66f17d4 --- /dev/null +++ b/paula.authentication/trunk/src/paula/authentication/pauplugins.py @@ -0,0 +1,187 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +# this should be moved from zope.app.authentication to zope.authentication +from zope.app.authentication.interfaces import ICredentialsPlugin +from zope.app.authentication.principalfolder import PrincipalInfo + +from zope.app.container.contained import Contained +from zope.interface import implements, alsoProvides +from zope.component import getUtility +from zope.publisher.interfaces import IRequest + +from paula.authentication.interfaces import IAuthProviders +from paula.authentication.interfaces import IAuthenticatorPlugin +from paula.authentication.interfaces import ILocalAuthenticatorPlugin +from paula.authentication.interfaces import ICredentialsFromMappingPlugin + + +class AuthenticatorPlugin(object): + """Authenticate users with auth providers from an IAuthProviders + + May be registered globally, as only functionality is implemented. + + >>> import UserDict + >>> apu = UserDict.UserDict() + >>> alsoProvides(apu, IAuthProviders) + >>> provideUtility(apu) + + >>> m = Mock( + ... id='login', + ... validate = lambda login=None,password=None: \\ + ... password == 'correct', + ... ) + + >>> apu['login'] = m + + >>> ap = AuthenticatorPlugin() + + >>> p = ap.authenticateCredentials(None) + >>> p is None + True + + >>> credentials = { + ... 'login': 'login', + ... } + >>> p = ap.authenticateCredentials(credentials) + >>> p is None + True + + >>> credentials = { + ... 'password': 'correct', + ... } + >>> p = ap.authenticateCredentials(credentials) + >>> p is None + True + + >>> credentials = { + ... 'login': 'wrong', + ... 'password': 'correct', + ... } + >>> p = ap.authenticateCredentials(credentials) + >>> p is None + True + + >>> credentials['login'] = 'login' + >>> p = ap.authenticateCredentials(credentials) + >>> from zope.app.authentication.interfaces import IPrincipalInfo + >>> IPrincipalInfo.providedBy(p) + True + >>> p.id + 'login' + + >>> credentials['password'] = 'wrong' + >>> p = ap.authenticateCredentials(credentials) + >>> p is None + True + """ + implements(IAuthenticatorPlugin) + + def _getAPU(self): + """ + """ + return getUtility(IAuthProviders) + + def authenticateCredentials(self, creds): + try: + if not (creds.has_key('login') and creds.has_key('password')): + return None + except AttributeError: + return None + + # retrieve auth provider utility + apu = self._getAPU() + id = creds["login"] + try: + # retrieve auth provider for principal + ap = apu[id] + except KeyError: + return None + + # use authprovider to verify credentials + if not ap.validate(login=creds['login'],password=creds['password']): + return None + + login = id + title = description = u"" + return PrincipalInfo( id, login, title, description) + + def principalInfo(self, id): + apu = self._getAPU() + if not id in apu: + return None + login = id + title = description = u"" + return PrincipalInfo( id, login, title, description) + + +class LocalAuthenticatorPlugin( + AuthenticatorPlugin, + Contained, + ): + """XXX: still not sure whether this could be the same as AP + """ + implements(ILocalAuthenticatorPlugin) + +# def _getAPU(self): +# """when doing this in the version above, I am getting a +# ComponentLookupError... +# """ +# return getUtility(IAuthProviders, context=getSite()) + + +class CredentialsFromMappingPlugin(Contained): + """Just returns a mapping it is passed + + Useful, if you use paula and PAU just for authentication but not for + challenging, i.e./e.g. from PlonePAS you already get the credentials in a + mapping and don't need to bother with challenging. + + May be registered globally, as only functionality is implemented. + + >>> cp = CredentialsFromMappingPlugin() + >>> m = UserDict() + >>> c = cp.extractCredentials(m) + >>> c is m + True + >>> IRequest.providedBy(m) + True + """ + implements(ICredentialsFromMappingPlugin) + + def extractCredentials(self, mapping): + """ + """ + # tune the mapping, PAU needs an IRequest to find its factories + # If this does not work, better let the AttributeError go here, than + # later in the getMultiAdapter lookup of PAU + if not IRequest.providedBy(mapping): + alsoProvides(mapping, IRequest) + + return mapping + + def challenge(self, request): + pass # challenge is a no-op for this plugin + + def logout(self, request): + pass # logout is a no-op for this plugin + diff --git a/paula.authentication/trunk/src/paula/authentication/tests.py b/paula.authentication/trunk/src/paula/authentication/tests.py new file mode 100644 index 0000000..d98e803 --- /dev/null +++ b/paula.authentication/trunk/src/paula/authentication/tests.py @@ -0,0 +1,40 @@ +# paula.testing.tests.py +# +# You can simply copy this file to your package and adjust it to your needs +# +# pt.FunctionalDocFileSuite will load your package's ftesting.zcml and +# otherwise setup the same globs as pt.setUp - have a look at __init__.py +""" +""" + +import unittest +#from zope.testing import doctestunit +#from zope.component.testing import setUp + +from paula.testing import get_test_suite, SuiteGenerator + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +sg = SuiteGenerator(PACKAGE_NAME) + +tests = [ + # doctests in all submodules of the package are found by paula.testing + + # doctests in files need to be declared + #doctestunit.DocFileSuite( 'README.txt', + # package=PACKAGE_NAME, setUp=pt.setUp, tearDown=pt.tearDown + # ), + + # functional doctests in files, don't pass setUp/tearDown, except if you + # really know what you are doing... + #sg.FunctionalDocFileSuite('README.txt') + + ] + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') diff --git a/paula.authutil/trunk/.gitignore b/paula.authutil/trunk/.gitignore new file mode 100644 index 0000000..013c539 --- /dev/null +++ b/paula.authutil/trunk/.gitignore @@ -0,0 +1,14 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old diff --git a/paula.authutil/trunk/README.txt b/paula.authutil/trunk/README.txt new file mode 100644 index 0000000..f014ec2 --- /dev/null +++ b/paula.authutil/trunk/README.txt @@ -0,0 +1,4 @@ +Introduction +============ + + diff --git a/paula.authutil/trunk/bootstrap.py b/paula.authutil/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.authutil/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.authutil/trunk/buildout.cfg b/paula.authutil/trunk/buildout.cfg new file mode 100644 index 0000000..b7d30f1 --- /dev/null +++ b/paula.authutil/trunk/buildout.cfg @@ -0,0 +1,14 @@ +[buildout] +develop = . + externals/paula.authentication + externals/paula.testing +parts = test py + +[test] +recipe = zc.recipe.testrunner +eggs = paula.authutil [test] + +[py] +recipe = zc.recipe.egg +interpreter = py +eggs = ${test:eggs} diff --git a/paula.authutil/trunk/docs/HISTORY.txt b/paula.authutil/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.authutil/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.authutil/trunk/docs/LICENSE.txt b/paula.authutil/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.authutil/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.authutil/trunk/externals/EXTERNALS.txt b/paula.authutil/trunk/externals/EXTERNALS.txt new file mode 100644 index 0000000..0a10511 --- /dev/null +++ b/paula.authutil/trunk/externals/EXTERNALS.txt @@ -0,0 +1,2 @@ +paula.authentication https://svn.plone.org/svn/collective/paula/paula.authentication/trunk +paula.testing https://svn.plone.org/svn/collective/paula/paula.testing/trunk diff --git a/paula.authutil/trunk/setup.cfg b/paula.authutil/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.authutil/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.authutil/trunk/setup.py b/paula.authutil/trunk/setup.py new file mode 100644 index 0000000..eeaf758 --- /dev/null +++ b/paula.authutil/trunk/setup.py @@ -0,0 +1,47 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.authutil', + version=version, + description="Paula authentication provider utility", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.app.container', + 'zope.interface', + 'zope.schema', + 'paula.authentication>=0.59', + ], + extras_require=dict( + test = [ + 'paula.testing>=0.59', + ], + ), + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.authutil/trunk/src/paula/__init__.py b/paula.authutil/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.authutil/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.authutil/trunk/src/paula/authutil/README.txt b/paula.authutil/trunk/src/paula/authutil/README.txt new file mode 100644 index 0000000..b4f01e0 --- /dev/null +++ b/paula.authutil/trunk/src/paula/authutil/README.txt @@ -0,0 +1,174 @@ +Currently unused + + +paula.authutil Package Readme +============================= + +This file serves as an integration test of paula.authutil with +paula.authentication. + +Our configure.zcml registered a global RWAuthProviders. Let's check, +whether it is there + + >>> from paula.authutil.interfaces import IRWAuthProviders + >>> global_apu = getUtility(IRWAuthProviders) + >>> global_apu is not None + True + +Further, we included paula.authentication, so there should be a global +AuthenticatorPlugin available + + >>> from paula.authentication.interfaces import IAuthenticatorPlugin + >>> global_ap = getUtility( + ... IAuthenticatorPlugin, + ... 'Paula Authenticator Plugin', + ... ) + >>> global_ap is not None + True + +Let's create a subsite + + >>> from zope.app.component import site + >>> from zope.app.folder import Folder + >>> class SubSiteFolder(Folder, site.SiteManagerContainer): + ... pass + >>> subsite = SubSiteFolder() + >>> subsm = site.LocalSiteManager(subsite) + >>> subsite.setSiteManager(subsm) + + >>> root = getRootFolder() + >>> root['subsite'] = subsite + +and add authenticator plugin and auth provider utility + + >>> from paula.authentication import LocalAuthenticatorPlugin + >>> local_ap = LocalAuthenticatorPlugin() + >>> root['subsite']['local_ap'] = local_ap + + >>> from paula.authutil import LocalRWAuthProviders + >>> local_apu = LocalRWAuthProviders() + >>> root['subsite']['local_apu'] = local_apu + >>> subsm.registerUtility(local_apu, IRWAuthProviders) + + +auth provider content added directly to the root folder, should only end up +in the global auth provider utility and not the subsite one, and content +added to the subsite should only end up there and not in the global. + +The subscribers should be fine with objects that directly implement +IAuthProvider, further down, we will check, whether they also work with +IAuthProviderAdaptable. + +an incomplete mockup auth provider is added nowhere + + >>> ap1 = Mock(id="global", validate = lambda login=None,password=None: \ + ... passord is "correct") + >>> root['ap1'] = ap1 + >>> len(global_apu) + 0 + >>> len(local_apu) + 0 + >>> del root['ap1'] + +Let it provide IAuthProvider... + + >>> from paula.authentication.interfaces import IAuthProvider + >>> alsoProvides(ap1, IAuthProvider) + >>> root['ap1'] = ap1 + >>> len(global_apu) + 1 + >>> len(local_apu) + 0 + +Try to authenticate + + >>> g_creds = dict(login = "global", password = "correct") + >>> global_ap.authenticateCredentials(g_creds) + PrincipalInfo('global') + >>> local_ap.authenticateCredentials(g_creds) is None + True + +Let's add another one within the subsite + + >>> ap2 = Mock(id="global", validate = lambda login=None,password=None: \ + ... passord is "correct") + >>> root['subsite']['ap2'] = ap2 + >>> len(global_apu) + 1 + >>> len(local_apu) + 0 + >>> del root['subsite']['ap2'] + + >>> alsoProvides(ap2, IAuthProvider) + >>> root['subsite']['ap2'] = ap2 + >>> len(global_apu) + 1 + >>> len(local_apu) + 1 + +The global is still only in the global + + >>> global_ap.authenticateCredentials(g_creds) + PrincipalInfo('global') + >>> local_ap.authenticateCredentials(g_creds) is None + True + +and the local is only in the local + + >>> loc_creds = dict(login = "local", password = "correct") + >>> global_ap.authenticateCredentials(loc_creds) is None + True + >>> local_ap.authenticateCredentials(loc_creds) + PrincipalInfo('local') + + +Removing them from the hierarchy needs to remove them from the utilities. + + >>> del root['ap1'] + >>> len(global_apu) + 0 + >>> len(local_apu) + 1 + >>> del root['subsite']['ap2'] + >>> len(global_apu) + 0 + >>> len(local_apu) + 0 + +The same should happen for IAuthProviderAdaptable, if there is an adapter +available. + + >>> from paula.authutil.interfaces import IAuthProviderAdaptable + + >>> class MockAdapter(object): + ... adapts(IAuthProviderAdaptable) + ... implements(IAuthProvider) + ... def __init__(self, context): + ... self.context = context + ... def __getattr__(self, attr): + ... getattr(self.context, attr) + + >>> ap3 = Mock(id="global", validate = lambda login=None,password=None: \ + ... passord is "correct") + >>> alsoProvides(ap3, IAuthProviderAdaptable) + + >>> root['ap3'] = ap3 #doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + foo + TypeError: foo + >>> del root['ap3'] + + >>> provideAdapter(MockAdapter) + >>> root['ap3'] = ap3 + >>> len(global_apu) + 1 + >>> len(local_apu) + 0 + >>> del root['ap3'] + >>> len(global_apu) + 0 + >>> len(local_apu) + 0 + + +XXX: test persistency? diff --git a/paula.authutil/trunk/src/paula/authutil/__init__.py b/paula.authutil/trunk/src/paula/authutil/__init__.py new file mode 100644 index 0000000..61115ba --- /dev/null +++ b/paula.authutil/trunk/src/paula/authutil/__init__.py @@ -0,0 +1,25 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from utils import RWAuthProviders +from subscribers import checkRegister +from subscribers import checkUnregister diff --git a/paula.authutil/trunk/src/paula/authutil/config.py b/paula.authutil/trunk/src/paula/authutil/config.py new file mode 100644 index 0000000..5cd5288 --- /dev/null +++ b/paula.authutil/trunk/src/paula/authutil/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.authutil" diff --git a/paula.authutil/trunk/src/paula/authutil/configure.zcml b/paula.authutil/trunk/src/paula/authutil/configure.zcml new file mode 100644 index 0000000..713b444 --- /dev/null +++ b/paula.authutil/trunk/src/paula/authutil/configure.zcml @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/paula.authutil/trunk/src/paula/authutil/ftesting.zcml b/paula.authutil/trunk/src/paula/authutil/ftesting.zcml new file mode 100644 index 0000000..158e203 --- /dev/null +++ b/paula.authutil/trunk/src/paula/authutil/ftesting.zcml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/paula.authutil/trunk/src/paula/authutil/interfaces.py b/paula.authutil/trunk/src/paula/authutil/interfaces.py new file mode 100644 index 0000000..b17cd5b --- /dev/null +++ b/paula.authutil/trunk/src/paula/authutil/interfaces.py @@ -0,0 +1,55 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.interface import Interface + +from paula.authentication.interfaces import IAuthProviders + + +class PrincipalIdAlreadyTaken(Exception): + """Indicates that a principal with the same id is already registered + """ + +class IAuthProviderAdaptable(Interface): + """Marker interface for objects that can be adapted to IAuthProvider + """ + +class IRWAuthProviders(IAuthProviders): + """A IAuthProviders where objects can be registered/unregistered. + """ + + def register(obj): + """Register an object + + It is assumed that the object provides IAuthProviderAdaptable and + an adapter for IAuthProvider is available, an AdaptationError is + raised otherwise. + + Fails with PrincipalIdAlreadyTaken, in case an object with the same + principal id is registered already. + """ + + def unregister(obj): + """Unregister an object. + + Fails with KeyError, if the object is not registered. + """ diff --git a/paula.authutil/trunk/src/paula/authutil/subscribers.py b/paula.authutil/trunk/src/paula/authutil/subscribers.py new file mode 100644 index 0000000..2fe1f56 --- /dev/null +++ b/paula.authutil/trunk/src/paula/authutil/subscribers.py @@ -0,0 +1,76 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.app.container.interfaces import IObjectAddedEvent +from zope.app.container.interfaces import IObjectRemovedEvent + +from zope.component import adapter, queryUtility + +from zope.location.interfaces import ILocation + +from paula.authentication.interfaces import IAuthProvider + +from paula.authutil.interfaces import IRWAuthProviders +from paula.authutil.interfaces import IAuthProviderAdaptable + + +@adapter(ILocation, IObjectAddedEvent) +def checkRegister(obj, event): + """A subscriber to ObjectAddedEvent + + Registers an object with the nearest IRWAuthProviders, iff either + IAuthProviderAdaptable or IAuthProvider is provided by the object. + """ + if not IAuthProviderAdaptable.providedBy(obj) and \ + not IAuthProvider.providedBy(obj): + return + + # we are registered globally and might run in a context without + # IRWAuthProviders + util = queryUtility(IRWAuthProviders) #, context=event.newParent) + # XXX: not working, util is False?! + #if util: + if util is not None: + util.register(obj) + + +@adapter(ILocation, IObjectRemovedEvent) +def checkUnregister(obj, event): + """A subscriber to ObjectRemovedEvent + + Unregisters an object with the nearest IRWAuthProviders, iff either + IAuthProviderAdaptable or IAuthProvider is provided by the object. + """ + if not IAuthProviderAdaptable.providedBy(obj) and \ + not IAuthProvider.providedBy(obj): + return + + # we are registered globally and might run in a context without + # IRWAuthProviders + util = queryUtility(IRWAuthProviders) #, context=event.oldParent) + # XXX: not working, apu is False?! + #if apu: + if util is not None: + try: + util.unregister(obj) + except KeyError: + pass diff --git a/paula.authutil/trunk/src/paula/authutil/tests.py b/paula.authutil/trunk/src/paula/authutil/tests.py new file mode 100644 index 0000000..d98e803 --- /dev/null +++ b/paula.authutil/trunk/src/paula/authutil/tests.py @@ -0,0 +1,40 @@ +# paula.testing.tests.py +# +# You can simply copy this file to your package and adjust it to your needs +# +# pt.FunctionalDocFileSuite will load your package's ftesting.zcml and +# otherwise setup the same globs as pt.setUp - have a look at __init__.py +""" +""" + +import unittest +#from zope.testing import doctestunit +#from zope.component.testing import setUp + +from paula.testing import get_test_suite, SuiteGenerator + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +sg = SuiteGenerator(PACKAGE_NAME) + +tests = [ + # doctests in all submodules of the package are found by paula.testing + + # doctests in files need to be declared + #doctestunit.DocFileSuite( 'README.txt', + # package=PACKAGE_NAME, setUp=pt.setUp, tearDown=pt.tearDown + # ), + + # functional doctests in files, don't pass setUp/tearDown, except if you + # really know what you are doing... + #sg.FunctionalDocFileSuite('README.txt') + + ] + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') diff --git a/paula.authutil/trunk/src/paula/authutil/utils.py b/paula.authutil/trunk/src/paula/authutil/utils.py new file mode 100644 index 0000000..1f82066 --- /dev/null +++ b/paula.authutil/trunk/src/paula/authutil/utils.py @@ -0,0 +1,184 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from BTrees import OOBTree +from persistent import Persistent + +from zope.app.container.contained import Contained + +from zope.component import queryUtility +from zope.component.interfaces import IFactory + +from zope.interface import implements + +from paula.authentication.interfaces import IAuthProvider + +from paula.authutil.interfaces import IRWAuthProviders +from paula.authutil.interfaces import PrincipalIdAlreadyTaken + + +class RWAuthProviders(Persistent, Contained): + """Utility delivering IAuthProvider for principal ids + + IAuthProvider objects are generated by dynamic adapter lookup from + IAuthProviderAdaptable objects, which are retrieved from an internal + mapping. Objects enter/leave the mapping through register/unregister. + + Currently we do not support modification of principal id for registered + objects; before doing anything that modifies the prinicipal id of an object, + you need to unregister and reregister the object. + + Currently, we maintain a two-way mapping, having a feeling that this comes + in handy, in case of ObjectModifiedEvents, which might overcome the + limitation about not changing registered objects. It is already used to + prevent unregistered objects with the same principal id as an registered + object, to remove the latter's mapping, when being passed to unregister. + + This utility should be registered as a local utility, you probably want + the persistent version (see below). + + This utility could be registered globally and works outside of an + application server. However, the adapter lookup for IAuthProvider needs + to be supported. + + + Mappings are empty, for a new utility + + >>> apu = RWAuthProviders() + >>> len(apu._ids) + 0 + >>> len(apu._objs) + 0 + >>> len(apu) + 0 + + Suitable object ends up in both mappings, strings work as id + + >>> a = Mock(id = '1') + >>> alsoProvides(a, IAuthProvider) + >>> apu.register(a) + >>> len(apu._ids) + 1 + >>> len(apu._objs) + 1 + >>> len(apu) + 1 + >>> apu._ids[a] is '1' + True + >>> apu._objs['1'] is a + True + + Object with same id as registered object triggers PrincipalIdAlreadyTaken + + >>> b = Mock(id = '1') + >>> alsoProvides(b, IAuthProvider) + >>> apu.register(b) + Traceback (most recent call last): + blah + PrincipalIdAlreadyTaken: 1 + + Unsuitable object triggers TypeError + + >>> b = Mock(id = '2') + >>> apu.register(b) # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + blah + TypeError: blah + + More than one object can be added + + >>> b = Mock(id = '2') + >>> alsoProvides(b, IAuthProvider) + >>> apu.register(b) + >>> len(apu._ids) + 2 + >>> len(apu._objs) + 2 + + Objects are retrieved correctly + + >>> apu['1'] is a + True + >>> apu['2'] is b + True + """ + implements(IRWAuthProviders) + + def __init__(self): + """ + """ + # XXX: + # self might be stored in a persistent container + # _ids and _objs are our only attributes and they won't change + # I assume it is enough that the BTrees are persistent and that self + # does not need to be... + self._ids = queryUtility(IFactory, 'OOBTree', OOBTree.OOBTree)() + self._objs = queryUtility(IFactory, 'OOBTree', OOBTree.OOBTree)() + + def __contains__(self, id): + return self.has_key(id) + + def __getitem__(self, id): + """get IAuthProvider object for principal id + """ + obj = self._objs[id] + ap = IAuthProvider(obj) + return ap + + def __len__(self): + return self._ids.__len__() + + def has_key(self, id): + # I currently consider this a broken BTree + return bool(self._objs.has_key(id)) + + def keys(self): + # I currently consider this a broken BTree + return list(self._objs.keys()) + + def register(self, obj): + """Register an object. + + It is assumed that an adapter lookup for IAuthProvider succeeds. + + Fails with PrincipalIdAlreadyTaken, in case an object with the same + principal id is registered already. + """ + id = IAuthProvider(obj).id + if self._objs.has_key(id): + if self._objs[id] is not obj: + raise PrincipalIdAlreadyTaken, id + return + self._objs[id] = obj + self._ids[obj] = id + #notify(AuthProviderAdded(ob, event)) + + def unregister(self, obj): + """Unregister an object. + + Fails with KeyError, if the object is not registered. + """ + # get id for obj, implicit check that obj is registered + id = self._ids[obj] + del self._objs[id] + del self._ids[obj] + #notify(AuthProviderRemoved(ob, event)) diff --git a/paula.examples/trunk/.gitignore b/paula.examples/trunk/.gitignore new file mode 100644 index 0000000..013c539 --- /dev/null +++ b/paula.examples/trunk/.gitignore @@ -0,0 +1,14 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old diff --git a/paula.examples/trunk/README.txt b/paula.examples/trunk/README.txt new file mode 100644 index 0000000..f014ec2 --- /dev/null +++ b/paula.examples/trunk/README.txt @@ -0,0 +1,4 @@ +Introduction +============ + + diff --git a/paula.examples/trunk/bootstrap.py b/paula.examples/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.examples/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.examples/trunk/buildout.cfg b/paula.examples/trunk/buildout.cfg new file mode 100644 index 0000000..6008b4c --- /dev/null +++ b/paula.examples/trunk/buildout.cfg @@ -0,0 +1,17 @@ +[buildout] +develop = . + externals/paula.authutil + externals/paula.authentication + externals/paula.proputil + externals/paula.properties + externals/paula.testing +parts = test py + +[test] +recipe = zc.recipe.testrunner +eggs = paula.examples [test] + +[py] +recipe = zc.recipe.egg +interpreter = py +eggs = ${test:eggs} diff --git a/paula.examples/trunk/docs/HISTORY.txt b/paula.examples/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.examples/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.examples/trunk/docs/LICENSE.txt b/paula.examples/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.examples/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.examples/trunk/externals/EXTERNALS.txt b/paula.examples/trunk/externals/EXTERNALS.txt new file mode 100644 index 0000000..83942a7 --- /dev/null +++ b/paula.examples/trunk/externals/EXTERNALS.txt @@ -0,0 +1,5 @@ +paula.authentication https://svn.plone.org/svn/collective/paula/paula.authentication/trunk +paula.authutil https://svn.plone.org/svn/collective/paula/paula.authutil/trunk +paula.properties https://svn.plone.org/svn/collective/paula/paula.properties/trunk +paula.proputil https://svn.plone.org/svn/collective/paula/paula.proputil/trunk +paula.testing https://svn.plone.org/svn/collective/paula/paula.testing/trunk diff --git a/paula.examples/trunk/setup.cfg b/paula.examples/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.examples/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.examples/trunk/setup.py b/paula.examples/trunk/setup.py new file mode 100644 index 0000000..b9264d1 --- /dev/null +++ b/paula.examples/trunk/setup.py @@ -0,0 +1,48 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.examples', + version=version, + description="Paula example content types", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.component', + 'zope.interface', + 'zope.schema', + 'paula.authutil>=0.59', + 'paula.proputil>=0.59', + ], + extras_require=dict( + test = [ + 'paula.testing>=0.59', + ], + ), + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.examples/trunk/src/paula/__init__.py b/paula.examples/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.examples/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.examples/trunk/src/paula/examples/README.txt b/paula.examples/trunk/src/paula/examples/README.txt new file mode 100644 index 0000000..840d646 --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/README.txt @@ -0,0 +1,83 @@ +Currently unused + + + +paula.examples Package Readme +============================= + +XXX: zcml testing + + >>> from zope.component import provideAdapter + >>> from zope.interface import providedBy + +Create minimal plone user used for testing: + + >>> from paula.examples.content import MinimalPloneUser + >>> user = MinimalPloneUser( + ... name='user', + ... password='pass', + ... email='foo@bar.com', + ... realname='Max Mustermann', + ... ) + + +Test integration with auth utility: + +Setup adapters + + >>> from paula.examples.adapters import AuthProviderFromBasicUser + >>> provideAdapter(AuthProviderFromBasicUser) + +Create paula auth utility + + >>> from paula.authutil import RWAuthProviders + >>> apu = RWAuthProviders() + +Register user with auth provider utility + + >>> apu.register(user) + +Check whether user can be retrieved and used for validation + + >>> from paula.authentication.interfaces import IAuthProvider + >>> authutil = IAuthProvider(apu['user']) + >>> authutil.validate(login='user', password='pass') + True + + +Test integration with property utility: + +Setup adapters + + >>> from paula.examples.adapters import BasicPropertyProvider + >>> provideAdapter(BasicPropertyProvider) + +Create paula property utility + + >>> from paula.proputil import RWPropertyProviders + >>> ppu = RWPropertyProviders() + +Register user with property utility + + >>> ppu.register(user) + +Check whether properties can be retrieved + + >>> from paula.properties.interfaces import IPropertyProvider + >>> from paula.examples.interfaces import IMinimalPloneProperties + >>> pps = ppu['user'] + >>> len(pps) == 1 + True + >>> pp = pps[0] + >>> IPropertyProvider.providedBy(pp) + True + >>> IMinimalPloneProperties.providedBy(pp) + True + >>> pp.id + 'user' + >>> getattr(pp, 'password', 'foo') + 'foo' + >>> pp.email + 'foo@bar.com' + >>> pp.realname + 'Max Mustermann' diff --git a/paula.examples/trunk/src/paula/examples/__init__.py b/paula.examples/trunk/src/paula/examples/__init__.py new file mode 100644 index 0000000..d7e97a9 --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/__init__.py @@ -0,0 +1,22 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + diff --git a/paula.examples/trunk/src/paula/examples/adapters.py b/paula.examples/trunk/src/paula/examples/adapters.py new file mode 100644 index 0000000..eb3f122 --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/adapters.py @@ -0,0 +1,135 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.component import adapts +from zope.interface import alsoProvides, implements, Interface +from zope.interface import providedBy + +from paula.authentication.interfaces import IAuthProvider + +from paula.grouputil.interfaces import IMembershipProvider + +from paula.properties.interfaces import IPropertyProvider +from paula.properties.interfaces import IPropertyInterface + +from paula.examples.interfaces import IBasicUser +from paula.examples.interfaces import IBasicGroup + + +class AuthProviderFromBasicUser(object): + """Basically a read-only wrapper demonstrating the concept + + >>> content = Mock(title='user', password='correct') + >>> adapter = AuthProviderFromBasicUser(content) + >>> adapter.id == content.title + True + >>> adapter.validate(login='foo', password='correct') + True + >>> adapter.validate(login='foo', password='wrong') + False + """ + adapts(IBasicUser) + implements(IAuthProvider) + + @property + def id(self): + return self.context.title + + def __init__(self, context): + self.context = context + + def validate(self, login=u"", password=u""): + return password == self.context.password + + +class BasicPropertyProvider(object): + """This provides the same IPropertyInterface-providing interfaces as the + adpated context provides, and all attributes not defined on self, + are passed on to the context. + + >>> from zope.interface import alsoProvides, Attribute + >>> content = Mock( + ... title='login', + ... password='pass', + ... email='foo@bar', + ... ) + + >>> class IA(Interface): + ... email = Attribute('email') + + >>> alsoProvides(content, IA) + >>> alsoProvides(IA, IPropertyInterface) + + >>> adapter = BasicPropertyProvider(content) + >>> adapter.id == content.title + True + >>> adapter.email == content.email + True + >>> getattr(adapter, 'password', 'foo') + 'foo' + >>> IPropertyProvider.providedBy(adapter) + True + >>> IA.providedBy(adapter) + True + """ + adapts(Interface) + implements(IPropertyProvider) + + @property + def id(self): + return self.context.title + + def __init__(self, context): + """ + """ + propifs = filter( + IPropertyInterface.providedBy, + list(providedBy(context)), + ) + alsoProvides(self, propifs) + self.context = context + + def __getattr__(self, name): + props = [] + for x in list(providedBy(self)): + props += list(x) + if name not in props: + raise AttributeError + return getattr(self.context, name) + + +class MembershipProviderFromBasicGroup(object): + """ + """ + adapts(IBasicGroup) + implements(IMembershipProvider) + + def __init__(self, context): + self.context = context + + @property + def groups(self): + return (self.context.title,) + + @property + def members(self): + return tuple(self.context.members) diff --git a/paula.examples/trunk/src/paula/examples/adapters.zcml b/paula.examples/trunk/src/paula/examples/adapters.zcml new file mode 100644 index 0000000..20b4767 --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/adapters.zcml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/paula.examples/trunk/src/paula/examples/config.py b/paula.examples/trunk/src/paula/examples/config.py new file mode 100644 index 0000000..55abc4f --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.examples" diff --git a/paula.examples/trunk/src/paula/examples/configure.zcml b/paula.examples/trunk/src/paula/examples/configure.zcml new file mode 100644 index 0000000..ce1b1fa --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/configure.zcml @@ -0,0 +1,8 @@ + + + + + + diff --git a/paula.examples/trunk/src/paula/examples/content.py b/paula.examples/trunk/src/paula/examples/content.py new file mode 100644 index 0000000..7a96859 --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/content.py @@ -0,0 +1,137 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from persistent import Persistent + +from zope.app.container.contained import Contained +from zope.component.factory import Factory +from zope.interface import implements + +from paula.examples.interfaces import IBasicUser +from paula.examples.interfaces import IMinimalPloneUser +from paula.examples.interfaces import IMinimalPloneProperties + +from paula.examples.interfaces import IBasicGroup + +from paula.authutil.interfaces import IAuthProviderAdaptable +from paula.proputil.interfaces import IPropertyProviderAdaptable +from paula.grouputil.interfaces import IMembershipProviderAdaptable + + +class BasicUser(Persistent, Contained): + """A very basic user + + >>> title = u'name' + >>> password = u'password' + + >>> b = BasicUser( + ... title=title, + ... password=password, + ... ) + >>> b.title == title + True + >>> b.password == password + True + """ + implements( + IBasicUser, + IAuthProviderAdaptable, + ) + + title = u"" + password = u"" + + def __init__(self, title=None, password=None): + self.title = title + self.password = password + + +class MinimalPloneUser(BasicUser): + """User content with minimal properties for plone + + >>> title = u'name' + >>> password = u'password' + >>> realname = u'realname' + >>> email = u'email' + + >>> b = MinimalPloneUser( + ... title=title, + ... password=password, + ... realname=realname, + ... email=email, + ... ) + >>> b.realname == realname + True + >>> b.email == email + True + """ + # it is important to explicitly provide IMinimalPloneProperties + # at least for our BasicPropertyProvider adapter + implements( + IMinimalPloneUser, + IMinimalPloneProperties, + IPropertyProviderAdaptable, + ) + + realname = u"" + email = u"" + + def __init__(self, + title=None, + password=None, + realname=None, + email=None, + ): + BasicUser.__init__( + self, + title=title, + password=password, + ) + self.realname = realname + self.email = email + +minimalPloneUserFactory = Factory( + MinimalPloneUser, + title=u"Create a minimal plone user", + description=u"This factory instantiates new minimal plone users", + ) + + +class BasicGroup(Persistent, Contained): + """ + """ + implements( + IBasicGroup, + IMembershipProviderAdaptable, + ) + + title = u"" + members = [] + + +basicGroupFactory = Factory( + BasicGroup, + title=u"Create a basic group", + description=u"This factory instantiates new basic groups", + ) + + diff --git a/paula.examples/trunk/src/paula/examples/content.zcml b/paula.examples/trunk/src/paula/examples/content.zcml new file mode 100644 index 0000000..48dc6b5 --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/content.zcml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + diff --git a/paula.examples/trunk/src/paula/examples/ftesting.zcml b/paula.examples/trunk/src/paula/examples/ftesting.zcml new file mode 100644 index 0000000..53152ab --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/ftesting.zcml @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/paula.examples/trunk/src/paula/examples/interfaces.py b/paula.examples/trunk/src/paula/examples/interfaces.py new file mode 100644 index 0000000..95069b1 --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/interfaces.py @@ -0,0 +1,87 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.interface import Interface, alsoProvides +from zope.schema import List, Object, TextLine, Password + +from paula.properties.interfaces import IPropertyInterface + + +class IBasicUser(Interface): + """Basic user + + Everything needed to do authentication, nothing more or less. + """ + title = TextLine( + title=u"Name", + description=u"The user's login name (unique within an" + "authentication realm).", + required=True, + ) + + password = Password( + title=u"Password", + description=u"The user password.", + required=True, + ) + + +class IMinimalPloneProperties(Interface): + """Minimal properties for plone + """ + realname = TextLine( + title=u"Realname", + description=u"The user's realname.", + required=True, + ) + + email = TextLine( + title=u"Email", + description=u"Email for user contact and password reset.", + required=True, + ) + +alsoProvides(IMinimalPloneProperties, IPropertyInterface) + + +class IMinimalPloneUser(IBasicUser,IMinimalPloneProperties): + """A user with minimal properties needed for plone + """ + + +class IBasicGroup(Interface): + """Basic group content type + + Everything needed to store information about group members in one place. + This is a good thing to inherit from, for more sophisticated content types. + """ + + title = TextLine( + title=u"Name", + description=u"The group name (unique within an authentication realm).", + required=True, + ) + + members = List( + title=u"Members", + description=u"List of member principal ids.", + ) diff --git a/paula.examples/trunk/src/paula/examples/tests.py b/paula.examples/trunk/src/paula/examples/tests.py new file mode 100644 index 0000000..d98e803 --- /dev/null +++ b/paula.examples/trunk/src/paula/examples/tests.py @@ -0,0 +1,40 @@ +# paula.testing.tests.py +# +# You can simply copy this file to your package and adjust it to your needs +# +# pt.FunctionalDocFileSuite will load your package's ftesting.zcml and +# otherwise setup the same globs as pt.setUp - have a look at __init__.py +""" +""" + +import unittest +#from zope.testing import doctestunit +#from zope.component.testing import setUp + +from paula.testing import get_test_suite, SuiteGenerator + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +sg = SuiteGenerator(PACKAGE_NAME) + +tests = [ + # doctests in all submodules of the package are found by paula.testing + + # doctests in files need to be declared + #doctestunit.DocFileSuite( 'README.txt', + # package=PACKAGE_NAME, setUp=pt.setUp, tearDown=pt.tearDown + # ), + + # functional doctests in files, don't pass setUp/tearDown, except if you + # really know what you are doing... + #sg.FunctionalDocFileSuite('README.txt') + + ] + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') diff --git a/paula.groups/trunk/.gitignore b/paula.groups/trunk/.gitignore new file mode 100644 index 0000000..36a34b9 --- /dev/null +++ b/paula.groups/trunk/.gitignore @@ -0,0 +1,15 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old +/externals diff --git a/paula.groups/trunk/README.txt b/paula.groups/trunk/README.txt new file mode 100644 index 0000000..f014ec2 --- /dev/null +++ b/paula.groups/trunk/README.txt @@ -0,0 +1,4 @@ +Introduction +============ + + diff --git a/paula.groups/trunk/bootstrap.py b/paula.groups/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.groups/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.groups/trunk/buildout.cfg b/paula.groups/trunk/buildout.cfg new file mode 100644 index 0000000..67760a4 --- /dev/null +++ b/paula.groups/trunk/buildout.cfg @@ -0,0 +1,13 @@ +[buildout] +develop = . + externals/paula.testing +parts = test py + +[test] +recipe = zc.recipe.testrunner +eggs = paula.groups [test] + +[py] +recipe = zc.recipe.egg +interpreter = py +eggs = ${test:eggs} diff --git a/paula.groups/trunk/docs/HISTORY.txt b/paula.groups/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.groups/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.groups/trunk/docs/LICENSE.txt b/paula.groups/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.groups/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.groups/trunk/setup.cfg b/paula.groups/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.groups/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.groups/trunk/setup.py b/paula.groups/trunk/setup.py new file mode 100644 index 0000000..ef5d012 --- /dev/null +++ b/paula.groups/trunk/setup.py @@ -0,0 +1,47 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.groups', + version=version, + description="Paula subscriber and plugin to handle groups", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.app.authentication', + 'zope.component', + 'zope.interface', + 'zope.schema', + ], + extras_require=dict( + test = [ + 'paula.testing>=0.59', + ], + ), + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.groups/trunk/src/paula/__init__.py b/paula.groups/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.groups/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.groups/trunk/src/paula/groups/README.txt b/paula.groups/trunk/src/paula/groups/README.txt new file mode 100644 index 0000000..e69de29 diff --git a/paula.groups/trunk/src/paula/groups/__init__.py b/paula.groups/trunk/src/paula/groups/__init__.py new file mode 100644 index 0000000..4de3f3f --- /dev/null +++ b/paula.groups/trunk/src/paula/groups/__init__.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from subscribers import setGroupsForPrincipal diff --git a/paula.groups/trunk/src/paula/groups/config.py b/paula.groups/trunk/src/paula/groups/config.py new file mode 100644 index 0000000..f26584a --- /dev/null +++ b/paula.groups/trunk/src/paula/groups/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.groups" diff --git a/paula.groups/trunk/src/paula/groups/configure.zcml b/paula.groups/trunk/src/paula/groups/configure.zcml new file mode 100644 index 0000000..29840da --- /dev/null +++ b/paula.groups/trunk/src/paula/groups/configure.zcml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/paula.groups/trunk/src/paula/groups/ftesting.zcml b/paula.groups/trunk/src/paula/groups/ftesting.zcml new file mode 100644 index 0000000..27bd0c8 --- /dev/null +++ b/paula.groups/trunk/src/paula/groups/ftesting.zcml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/paula.groups/trunk/src/paula/groups/interfaces.py b/paula.groups/trunk/src/paula/groups/interfaces.py new file mode 100644 index 0000000..5a5f5d9 --- /dev/null +++ b/paula.groups/trunk/src/paula/groups/interfaces.py @@ -0,0 +1,35 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.interface import Interface + + +class IMemberships(Interface): + """A utility that returns knows about group membership + """ + def getGroupsForPrincipal(id): + """ + """ + + def getMembersForGroup(id): + """ + """ diff --git a/paula.groups/trunk/src/paula/groups/subscribers.py b/paula.groups/trunk/src/paula/groups/subscribers.py new file mode 100644 index 0000000..0cbd244 --- /dev/null +++ b/paula.groups/trunk/src/paula/groups/subscribers.py @@ -0,0 +1,52 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.app.authentication.interfaces import IPrincipalCreated +from zope.app.component.hooks import getSite + +from zope.security.interfaces import IGroupAwarePrincipal +from zope.component import adapter, queryUtility + +from paula.groups.interfaces import IMemberships + + +@adapter(IPrincipalCreated) +def setGroupsForPrincipal(event): + """Put groups onto the principal + """ + principal = event.principal + if not IGroupAwarePrincipal.providedBy(principal): + return None + + # we search for a group membership utility in the context of the auth + # plugin that authenticated the principal, if there is none, we do + # nothing + mu = queryUtility( + IMemberships, + # context=getSite(), + ) + # XXX: for some reason a mu is False + if mu is None: + return + + groups = mu.getGroupsForPrincipal(principal.id) + principal.groups.extend(groups) diff --git a/paula.groups/trunk/src/paula/groups/tests.py b/paula.groups/trunk/src/paula/groups/tests.py new file mode 100644 index 0000000..d98e803 --- /dev/null +++ b/paula.groups/trunk/src/paula/groups/tests.py @@ -0,0 +1,40 @@ +# paula.testing.tests.py +# +# You can simply copy this file to your package and adjust it to your needs +# +# pt.FunctionalDocFileSuite will load your package's ftesting.zcml and +# otherwise setup the same globs as pt.setUp - have a look at __init__.py +""" +""" + +import unittest +#from zope.testing import doctestunit +#from zope.component.testing import setUp + +from paula.testing import get_test_suite, SuiteGenerator + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +sg = SuiteGenerator(PACKAGE_NAME) + +tests = [ + # doctests in all submodules of the package are found by paula.testing + + # doctests in files need to be declared + #doctestunit.DocFileSuite( 'README.txt', + # package=PACKAGE_NAME, setUp=pt.setUp, tearDown=pt.tearDown + # ), + + # functional doctests in files, don't pass setUp/tearDown, except if you + # really know what you are doing... + #sg.FunctionalDocFileSuite('README.txt') + + ] + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') diff --git a/paula.grouputil/trunk/.gitignore b/paula.grouputil/trunk/.gitignore new file mode 100644 index 0000000..36a34b9 --- /dev/null +++ b/paula.grouputil/trunk/.gitignore @@ -0,0 +1,15 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old +/externals diff --git a/paula.grouputil/trunk/README.txt b/paula.grouputil/trunk/README.txt new file mode 100644 index 0000000..f014ec2 --- /dev/null +++ b/paula.grouputil/trunk/README.txt @@ -0,0 +1,4 @@ +Introduction +============ + + diff --git a/paula.grouputil/trunk/bootstrap.py b/paula.grouputil/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.grouputil/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.grouputil/trunk/buildout.cfg b/paula.grouputil/trunk/buildout.cfg new file mode 100644 index 0000000..648c3a0 --- /dev/null +++ b/paula.grouputil/trunk/buildout.cfg @@ -0,0 +1,14 @@ +[buildout] +develop = . + externals/paula.groups + externals/paula.testing +parts = test py + +[test] +recipe = zc.recipe.testrunner +eggs = paula.grouputil [test] + +[py] +recipe = zc.recipe.egg +interpreter = py +eggs = ${test:eggs} diff --git a/paula.grouputil/trunk/docs/HISTORY.txt b/paula.grouputil/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.grouputil/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.grouputil/trunk/docs/LICENSE.txt b/paula.grouputil/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.grouputil/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.grouputil/trunk/setup.cfg b/paula.grouputil/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.grouputil/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.grouputil/trunk/setup.py b/paula.grouputil/trunk/setup.py new file mode 100644 index 0000000..a084d30 --- /dev/null +++ b/paula.grouputil/trunk/setup.py @@ -0,0 +1,46 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.grouputil', + version=version, + description="Paula group membership provider utility", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.app.container', + 'zope.interface', + 'paula.groups>=0.59', + ], + extras_require=dict( + test = [ + 'paula.testing>=0.59', + ], + ), + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.grouputil/trunk/src/paula/__init__.py b/paula.grouputil/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.grouputil/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.grouputil/trunk/src/paula/grouputil/README.txt b/paula.grouputil/trunk/src/paula/grouputil/README.txt new file mode 100644 index 0000000..ecc6c20 --- /dev/null +++ b/paula.grouputil/trunk/src/paula/grouputil/README.txt @@ -0,0 +1,2 @@ +paula.grouputil Package Readme +============================== diff --git a/paula.grouputil/trunk/src/paula/grouputil/__init__.py b/paula.grouputil/trunk/src/paula/grouputil/__init__.py new file mode 100644 index 0000000..4da6088 --- /dev/null +++ b/paula.grouputil/trunk/src/paula/grouputil/__init__.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from utils import RWMemberships diff --git a/paula.grouputil/trunk/src/paula/grouputil/config.py b/paula.grouputil/trunk/src/paula/grouputil/config.py new file mode 100644 index 0000000..07ac089 --- /dev/null +++ b/paula.grouputil/trunk/src/paula/grouputil/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.grouputil" diff --git a/paula.grouputil/trunk/src/paula/grouputil/configure.zcml b/paula.grouputil/trunk/src/paula/grouputil/configure.zcml new file mode 100644 index 0000000..ae2e4cc --- /dev/null +++ b/paula.grouputil/trunk/src/paula/grouputil/configure.zcml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/paula.grouputil/trunk/src/paula/grouputil/ftesting.zcml b/paula.grouputil/trunk/src/paula/grouputil/ftesting.zcml new file mode 100644 index 0000000..a220e84 --- /dev/null +++ b/paula.grouputil/trunk/src/paula/grouputil/ftesting.zcml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/paula.grouputil/trunk/src/paula/grouputil/interfaces.py b/paula.grouputil/trunk/src/paula/grouputil/interfaces.py new file mode 100644 index 0000000..2503b01 --- /dev/null +++ b/paula.grouputil/trunk/src/paula/grouputil/interfaces.py @@ -0,0 +1,65 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.interface import Interface +from zope.schema import List + +from paula.groups.interfaces import IMemberships + + +class IMembershipProvider(Interface): + """A membership provider associates 1..n principals with 1..m groups + + In order to get all members of a group and all groups of a principal, + the information of several providers is combined. + + The most common providers will associate one group with several members + (classic group) or one member with several groups (groups stored on the + prinicipal). + """ + groups = List( + title=u"Groups", + description=u"The groups this provider defines members for", + ) + + members = List( + title=u"Members", + description=u"The members of the groups", + ) + + +class IMembershipProviderAdaptable(Interface): + """Marker interface for objects that can be adapted to IMembershipProvider + """ + + +class IRWMemberships(IMemberships): + """ + """ + + def register(obj): + """Register an object + """ + + def unregister(obj): + """Unregister an object. + """ diff --git a/paula.grouputil/trunk/src/paula/grouputil/subscribers.py b/paula.grouputil/trunk/src/paula/grouputil/subscribers.py new file mode 100644 index 0000000..d5836a2 --- /dev/null +++ b/paula.grouputil/trunk/src/paula/grouputil/subscribers.py @@ -0,0 +1,69 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.app.container.interfaces import IObjectAddedEvent +from zope.app.container.interfaces import IObjectRemovedEvent + +from zope.component import adapter, queryUtility + +from zope.location.interfaces import ILocation + +from paula.grouputil.interfaces import IMembershipProvider +from paula.grouputil.interfaces import IMembershipProviderAdaptable +from paula.grouputil.interfaces import IRWMemberships + + +@adapter(ILocation, IObjectAddedEvent) +def checkRegister(obj, event): + """A subscriber to ObjectAddedEvent + """ + if not IMembershipProviderAdaptable.providedBy(obj) and \ + not IMembershipProvider.providedBy(obj): + return + + # we are registered globally and might run in a context without + # IRWMemberships + util = queryUtility(IRWMemberships) #, context=event.newParent) + # XXX: not working, util is False?! + #if util: + if util is not None: + util.register(obj) + + +@adapter(ILocation, IObjectRemovedEvent) +def checkUnregister(obj, event): + """A subscriber to ObjectRemovedEvent + """ + if not IMembershipProviderAdaptable.providedBy(obj) and \ + not IMembershipProvider.providedBy(obj): + return + + # we are registered globally and might run in a context without + # IRWMemberships + util = queryUtility(IRWMemberships) #, context=event.newParent) + # XXX: not working, util is False?! + #if util: + if util is not None: + try: + util.unregister(obj) + except KeyError: + pass diff --git a/paula.grouputil/trunk/src/paula/grouputil/tests.py b/paula.grouputil/trunk/src/paula/grouputil/tests.py new file mode 100644 index 0000000..d98e803 --- /dev/null +++ b/paula.grouputil/trunk/src/paula/grouputil/tests.py @@ -0,0 +1,40 @@ +# paula.testing.tests.py +# +# You can simply copy this file to your package and adjust it to your needs +# +# pt.FunctionalDocFileSuite will load your package's ftesting.zcml and +# otherwise setup the same globs as pt.setUp - have a look at __init__.py +""" +""" + +import unittest +#from zope.testing import doctestunit +#from zope.component.testing import setUp + +from paula.testing import get_test_suite, SuiteGenerator + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +sg = SuiteGenerator(PACKAGE_NAME) + +tests = [ + # doctests in all submodules of the package are found by paula.testing + + # doctests in files need to be declared + #doctestunit.DocFileSuite( 'README.txt', + # package=PACKAGE_NAME, setUp=pt.setUp, tearDown=pt.tearDown + # ), + + # functional doctests in files, don't pass setUp/tearDown, except if you + # really know what you are doing... + #sg.FunctionalDocFileSuite('README.txt') + + ] + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') diff --git a/paula.grouputil/trunk/src/paula/grouputil/utils.py b/paula.grouputil/trunk/src/paula/grouputil/utils.py new file mode 100644 index 0000000..0e0cd9c --- /dev/null +++ b/paula.grouputil/trunk/src/paula/grouputil/utils.py @@ -0,0 +1,125 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from BTrees import OOBTree +from persistent import Persistent +from persistent.list import PersistentList + +from zope.app.container.contained import Contained + +from zope.component import adapter, queryUtility +from zope.component.interfaces import IFactory + +from zope.interface import implements + +from paula.grouputil.interfaces import IMembershipProvider + +from paula.grouputil.interfaces import IMembershipProviderAdaptable +from paula.grouputil.interfaces import IRWMemberships + + +class RWMemberships(Persistent, Contained): + """ + + >>> mp1 = Mock( + ... groups=('g1',), + ... members=('p1','p2'), + ... alsoProvides=(IMembershipProvider,), + ... ) + >>> mp2 = Mock( + ... groups=('g1','g2'), + ... members=('p1', 'p3','p4'), + ... alsoProvides=(IMembershipProvider,), + ... ) + >>> mp3 = Mock( + ... groups=('g2','g3'), + ... members=('p1','p5'), + ... alsoProvides=(IMembershipProvider,), + ... ) + + >>> mu = RWMemberships() + >>> interact( locals() ) + """ + implements(IRWMemberships) + + def __init__(self): + """ + """ + self._objs = PersistentList() + self._members = queryUtility(IFactory, 'OOBTree', OOBTree.OOBTree)() + self._groups = queryUtility(IFactory, 'OOBTree', OOBTree.OOBTree)() + + def getGroupsForPrincipal(self, id): + """ + """ + try: + return tuple(set(self._groups[id])) + except KeyError: + return () + + def getMembersForGroup(self, id): + """ + """ + try: + return tuple(set(self._members[id])) + except KeyError: + return () + + def register(self, obj): + """Register an object. + + It is assumed that an adapter lookup for IMembershipProvider + succeeds. + """ + mp = IMembershipProvider(obj) + for id in mp.members: + try: + groups = self._groups[id] + except KeyError: + self._groups[id] = PersistentList() + groups = self._groups[id] + groups.extend(mp.groups) + + for id in mp.groups: + try: + members = self._members[id] + except KeyError: + self._members[id] = PersistentList() + members = self._members[id] + members.extend(mp.members) + + self._objs.append(obj) + + def unregister(self, obj): + """Unregister an object. + + Fails with ValueError, if the object is not registered. + """ + mp = IMembershipProvider(obj) + self._objs[id].remove(obj) + for id in mp.members: + for x in mp.groups: + self._groups[id].remove(x) + + for id in mp.groups: + for x in mp.members: + self._members[id].remove(x) diff --git a/paula.ploneexamples/trunk/.gitignore b/paula.ploneexamples/trunk/.gitignore new file mode 100644 index 0000000..013c539 --- /dev/null +++ b/paula.ploneexamples/trunk/.gitignore @@ -0,0 +1,14 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old diff --git a/paula.ploneexamples/trunk/README.txt b/paula.ploneexamples/trunk/README.txt new file mode 100644 index 0000000..f014ec2 --- /dev/null +++ b/paula.ploneexamples/trunk/README.txt @@ -0,0 +1,4 @@ +Introduction +============ + + diff --git a/paula.ploneexamples/trunk/bootstrap.py b/paula.ploneexamples/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.ploneexamples/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.ploneexamples/trunk/docs/HISTORY.txt b/paula.ploneexamples/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.ploneexamples/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.ploneexamples/trunk/docs/LICENSE.txt b/paula.ploneexamples/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.ploneexamples/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.ploneexamples/trunk/setup.cfg b/paula.ploneexamples/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.ploneexamples/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.ploneexamples/trunk/setup.py b/paula.ploneexamples/trunk/setup.py new file mode 100644 index 0000000..83635bf --- /dev/null +++ b/paula.ploneexamples/trunk/setup.py @@ -0,0 +1,46 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.ploneexamples', + version=version, + description="Paula example content types for Plone", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.component', + 'zope.interface', + 'zope.schema', + ], + extras_require=dict( + test = [ + 'paula.testing>=0.59', + ], + ), + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.ploneexamples/trunk/src/paula/__init__.py b/paula.ploneexamples/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/Extensions/Install.py b/paula.ploneexamples/trunk/src/paula/ploneexamples/Extensions/Install.py new file mode 100644 index 0000000..fb41dac --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/Extensions/Install.py @@ -0,0 +1,62 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +import transaction +from Products.CMFCore.utils import getToolByName + +PRODUCT_DEPENDENCIES = () + +EXTENSION_PROFILES = ( + 'paula.ploneexamples:default', + ) + +def install(self, reinstall=False): + """Install a set of products (which themselves may either use Install.py + or GenericSetup extension profiles for their configuration) and then + install a set of extension profiles. + + One of the extension profiles we install is that of this product. This + works because an Install.py installation script (such as this one) takes + precedence over extension profiles for the same product in + portal_quickinstaller. + + We do this because it is not possible to install other products during + the execution of an extension profile (i.e. we cannot do this during + the importVarious step for this profile). + """ + + portal_quickinstaller = getToolByName(self, 'portal_quickinstaller') + portal_setup = getToolByName(self, 'portal_setup') + + for product in PRODUCT_DEPENDENCIES: + if reinstall and portal_quickinstaller.isProductInstalled(product): + portal_quickinstaller.reinstallProducts([product]) + transaction.savepoint() + elif not portal_quickinstaller.isProductInstalled(product): + portal_quickinstaller.installProduct(product) + transaction.savepoint() + + for extension_id in EXTENSION_PROFILES: + portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False) + product_name = extension_id.split(':')[0] + portal_quickinstaller.notifyInstalled(product_name) + transaction.savepoint() diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/README.txt b/paula.ploneexamples/trunk/src/paula/ploneexamples/README.txt new file mode 100644 index 0000000..e69de29 diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/__init__.py b/paula.ploneexamples/trunk/src/paula/ploneexamples/__init__.py new file mode 100644 index 0000000..ecea1fa --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/__init__.py @@ -0,0 +1,31 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from Products.CMFCore.permissions import setDefaultRoles + +setDefaultRoles("Paula: Add Minimal Plone User", ('Manager',)) +setDefaultRoles("Paula: Add Basic Group", ('Manager',)) + +def initialize(context): + """Intializer called when used as a Zope 2 product. + """ + pass diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/adapters.zcml b/paula.ploneexamples/trunk/src/paula/ploneexamples/adapters.zcml new file mode 100644 index 0000000..9f79ba9 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/adapters.zcml @@ -0,0 +1,7 @@ + + + + + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/__init__.py b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.png b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.png new file mode 100644 index 0000000000000000000000000000000000000000..333a075f62a17d596686419d720e3172213f98bd GIT binary patch literal 952 zcwTe&bhEHb6krfw_|Cu}E-r3lWaQ`P7aSZM9UWb^{Y%}Bj~B)HFHY5Zu|)9YdbziI zv<@!|xW2>t-4VSH=WO4f4*7U4^20^n50|qhPoBJN*|PQP*Ej9`+O_{v+rh8h2S0Tk z`r3Eo+vKC4XP*4B=**X;=fAGG_;tyL$KJg)7G%{5bjW$GJy8Z#;f=>G|)=&wpKg@%zS$Uw7a9e(?79!?(X5z5Da{ z{hy~F{yhKq=hf#wZ@&C__x10`?|;Ak{P*k6zyJULGmL^!KnnQp@L%yK3nP%hpabHA z@&p6N6o&ttG9DWe9Jx4zrDS#-I^Hj9mNrLXgMebEf^FV`0|E*Sj$DRJUk(^5v$TrK z@wfeX;MmN_r5Yr}VyU3$Bw)neG)LiKBQu+5Q=JGCqbnDiR>=tg#Rm!#SOujbE(ktu z=;UEZ`xG#N!I4$cGDBv^gwS+eab>Fzfy74)?M$hxK`(9yI<)eNKhV?hSn&Sd{)Yc- IEDY9M0Jb;LqW}N^ literal 0 HcwPel00001 diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.pt b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.pt new file mode 100644 index 0000000..a304c5c --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.pt @@ -0,0 +1,26 @@ + + + + + +
+ +
+ +

+ +
+ +
+ +
+ +
+ +
+ + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.py b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.py new file mode 100644 index 0000000..b117ac1 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.py @@ -0,0 +1,33 @@ +from zope.component import createObject +from zope.formlib import form + +from plone.app.form import base + +from paula.examples.interfaces import IBasicGroup + + +basicgroup_form_fields = form.Fields(IBasicGroup) + +class BasicGroupAddForm(base.AddForm): + """Add form for Basic Groups + """ + + form_fields = basicgroup_form_fields + + label = u"Add Basic Group" + form_name = u"Basic Group settings" + + def create(self, data): + basicgroup = createObject(u"paula.ploneexamples.BasicGroup") + form.applyChanges(basicgroup, self.form_fields, data) + return basicgroup + + +class BasicGroupEditForm(base.EditForm): + """Edit form for Basic Groups + """ + + form_fields = basicgroup_form_fields + + label = u"Edit Basic Group" + form_name = u"Basic Group settings" diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.zcml b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.zcml new file mode 100644 index 0000000..74c1ce6 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/basicgroup.zcml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/configure.zcml b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/configure.zcml new file mode 100644 index 0000000..dd8397e --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/configure.zcml @@ -0,0 +1,8 @@ + + + + + + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.png b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.png new file mode 100644 index 0000000000000000000000000000000000000000..333a075f62a17d596686419d720e3172213f98bd GIT binary patch literal 952 zcwTe&bhEHb6krfw_|Cu}E-r3lWaQ`P7aSZM9UWb^{Y%}Bj~B)HFHY5Zu|)9YdbziI zv<@!|xW2>t-4VSH=WO4f4*7U4^20^n50|qhPoBJN*|PQP*Ej9`+O_{v+rh8h2S0Tk z`r3Eo+vKC4XP*4B=**X;=fAGG_;tyL$KJg)7G%{5bjW$GJy8Z#;f=>G|)=&wpKg@%zS$Uw7a9e(?79!?(X5z5Da{ z{hy~F{yhKq=hf#wZ@&C__x10`?|;Ak{P*k6zyJULGmL^!KnnQp@L%yK3nP%hpabHA z@&p6N6o&ttG9DWe9Jx4zrDS#-I^Hj9mNrLXgMebEf^FV`0|E*Sj$DRJUk(^5v$TrK z@wfeX;MmN_r5Yr}VyU3$Bw)neG)LiKBQu+5Q=JGCqbnDiR>=tg#Rm!#SOujbE(ktu z=;UEZ`xG#N!I4$cGDBv^gwS+eab>Fzfy74)?M$hxK`(9yI<)eNKhV?hSn&Sd{)Yc- IEDY9M0Jb;LqW}N^ literal 0 HcwPel00001 diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.pt b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.pt new file mode 100644 index 0000000..a304c5c --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.pt @@ -0,0 +1,26 @@ + + + + + +
+ +
+ +

+ +
+ +
+ +
+ +
+ +
+ + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.py b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.py new file mode 100644 index 0000000..b2ab044 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.py @@ -0,0 +1,33 @@ +from zope.component import createObject +from zope.formlib import form + +from plone.app.form import base + +from paula.examples.interfaces import IMinimalPloneUser + + +minplone_form_fields = form.Fields(IMinimalPloneUser) + +class MinimalPloneUserAddForm(base.AddForm): + """Add form for Minimal Plone Users + """ + + form_fields = minplone_form_fields + + label = u"Add Minimal Plone User" + form_name = u"Minimal Plone User settings" + + def create(self, data): + minplone = createObject(u"paula.ploneexamples.MinimalPloneUser") + form.applyChanges(minplone, self.form_fields, data) + return minplone + + +class MinimalPloneUserEditForm(base.EditForm): + """Edit form for Minimal Plone Users + """ + + form_fields = minplone_form_fields + + label = u"Edit Minimal Plone User" + form_name = u"Minimal Plone User settings" diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.zcml b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.zcml new file mode 100644 index 0000000..82929db --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/browser/minplone.zcml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/config.py b/paula.ploneexamples/trunk/src/paula/ploneexamples/config.py new file mode 100644 index 0000000..ec5465a --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.ploneexamples" diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/configure.zcml b/paula.ploneexamples/trunk/src/paula/ploneexamples/configure.zcml new file mode 100644 index 0000000..036d998 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/configure.zcml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/content.py b/paula.ploneexamples/trunk/src/paula/ploneexamples/content.py new file mode 100644 index 0000000..25934e3 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/content.py @@ -0,0 +1,70 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from plone.app.content.interfaces import INameFromTitle +from plone.app.content.container import Container + +from plone.locking.interfaces import ITTWLockable + +from zope.component.factory import Factory +from zope.interface import implements + +from paula.examples.content import MinimalPloneUser as MinimalPloneUserBase +from paula.examples.content import BasicGroup as BasicGroupBase + + +class MinimalPloneUser(Container, MinimalPloneUserBase): + """User content with minimal properties for plone + + realized as a container content type + """ + implements(ITTWLockable, INameFromTitle) + meta_type = portal_type = "Paula Minimal Plone User" + + def __init__(self, id=None, **kws): + Container.__init__(self, id) + MinimalPloneUserBase.__init__(self, **kws) + +minimalPloneUserFactory = Factory( + MinimalPloneUser, + title=u"Create a minimal plone user", + description=u"This factory instantiates new minimal plone users", + ) + + +class BasicGroup(Container, BasicGroupBase): + """Basic Group content + + realized as a container content type + """ + implements(ITTWLockable, INameFromTitle) + meta_type = portal_type = "Paula Basic Group" + + def __init__(self, id=None, **kws): + Container.__init__(self, id) + BasicGroupBase.__init__(self, **kws) + +basicGroupFactory = Factory( + BasicGroup, + title=u"Create a basic group", + description=u"This factory instantiates new basic groups", + ) diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/content.zcml b/paula.ploneexamples/trunk/src/paula/ploneexamples/content.zcml new file mode 100644 index 0000000..6c4ab99 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/content.zcml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles.zcml b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles.zcml new file mode 100644 index 0000000..ddbbfb7 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles.zcml @@ -0,0 +1,14 @@ + + + + + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/metadata.xml b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/metadata.xml new file mode 100644 index 0000000..5e44646 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/metadata.xml @@ -0,0 +1,4 @@ + + Paula Plone Examples + 0.60 + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types.xml b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types.xml new file mode 100644 index 0000000..6773531 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types.xml @@ -0,0 +1,6 @@ + + + + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types/Paula_Basic_Group.xml b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types/Paula_Basic_Group.xml new file mode 100644 index 0000000..40ad765 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types/Paula_Basic_Group.xml @@ -0,0 +1,27 @@ + + + Basic Group + A basic group + ++resource++paula_ploneexamples_basic_group_icon.png + Paula Basic Group + + paula.ploneexamples.BasicGroup + @@edit + True + False + + False + + + + + + + + + + diff --git a/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types/Paula_Minimal_Plone_User.xml b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types/Paula_Minimal_Plone_User.xml new file mode 100644 index 0000000..8107673 --- /dev/null +++ b/paula.ploneexamples/trunk/src/paula/ploneexamples/profiles/default/types/Paula_Minimal_Plone_User.xml @@ -0,0 +1,27 @@ + + + Minimal Plone User + A minimal plone user + ++resource++paula_ploneexamples_minimal_plone_user_icon.png + Paula Minimal Plone User + + paula.ploneexamples.MinimalPloneUser + @@edit + True + False + + False + + + + + + + + + + diff --git a/paula.plonepas/trunk/.gitignore b/paula.plonepas/trunk/.gitignore new file mode 100644 index 0000000..33be638 --- /dev/null +++ b/paula.plonepas/trunk/.gitignore @@ -0,0 +1,15 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old +/var diff --git a/paula.plonepas/trunk/README.txt b/paula.plonepas/trunk/README.txt new file mode 100644 index 0000000..b885b64 --- /dev/null +++ b/paula.plonepas/trunk/README.txt @@ -0,0 +1 @@ +Nothing useful here, yet diff --git a/paula.plonepas/trunk/bootstrap.py b/paula.plonepas/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.plonepas/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.plonepas/trunk/buildout.cfg b/paula.plonepas/trunk/buildout.cfg new file mode 100644 index 0000000..375b77f --- /dev/null +++ b/paula.plonepas/trunk/buildout.cfg @@ -0,0 +1,99 @@ +[buildout] +develop = . + externals/paula.authentication + externals/paula.authutil + externals/paula.groups + externals/paula.grouputil + externals/paula.properties + externals/paula.proputil + externals/paula.suite + externals/paula.examples + externals/paula.ploneexamples + externals/paula.testing +parts = + plone + zope2 + fakezope2eggs + productdistros + instance + zopepy +eggs = + elementtree + paula.authentication + paula.authutil + paula.groups + paula.grouputil + paula.properties + paula.proputil + paula.suite + paula.examples + paula.ploneexamples + paula.testing + paula.plonepas + Products.Clouseau + Products.DocFinderTab + +# Add additional egg download sources here. dist.plone.org contains archives +# of Plone packages. +find-links = + http://dist.plone.org + http://download.zope.org/ppix/ + http://download.zope.org/distribution/ + http://effbot.org/downloads + +[plone] +recipe = plone.recipe.plone<=3.1.9999 + +[zope2] +recipe = plone.recipe.zope2install +url = ${plone:zope2-url} + +[fakezope2eggs] +recipe = z3c.recipe.fakezope2eggs + +# Use this section to download additional old-style products. +# List any number of URLs for product tarballs under URLs (separate +# with whitespace, or break over several lines, with subsequent lines +# indented). If any archives contain several products inside a top-level +# directory, list the archive file name (i.e. the last part of the URL, +# normally with a .tar.gz suffix or similar) under 'nested-packages'. +# If any archives extract to a product directory with a version suffix, list +# the archive name under 'version-suffix-packages'. +[productdistros] +recipe = plone.recipe.distros +urls = +nested-packages = +version-suffix-packages = + +[instance] +recipe = plone.recipe.zope2instance +zope2-location = ${zope2:location} +user = admin:test +http-address = 8080 +#debug-mode = on +#verbose-security = on + +# If you want Zope to know about any additional eggs, list them here. +# This should include any development eggs you listed in develop-eggs above, +# e.g. eggs = ${buildout:eggs} ${plone:eggs} my.package +eggs = + ${buildout:eggs} + ${plone:eggs} + +# If you want to register ZCML slugs for any packages, list them here. +# e.g. zcml = my.package my.other.package +zcml = + paula.plonepas + paula.ploneexamples + +products = + ${buildout:directory}/products + ${productdistros:location} + ${plone:products} + +[zopepy] +recipe = zc.recipe.egg +eggs = ${instance:eggs} +interpreter = zopepy +extra-paths = ${zope2:location}/lib/python +scripts = zopepy diff --git a/paula.plonepas/trunk/docs/HISTORY.txt b/paula.plonepas/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.plonepas/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.plonepas/trunk/docs/INSTALL.txt b/paula.plonepas/trunk/docs/INSTALL.txt new file mode 100644 index 0000000..e56fe60 --- /dev/null +++ b/paula.plonepas/trunk/docs/INSTALL.txt @@ -0,0 +1,43 @@ +paula.plonepas Installation +========================== + +To install paula.plonepas into the global Python environment (or a workingenv), +using a traditional Zope 2 instance, you can do this: + + * When you're reading this you have probably already run + ``easy_install paula.plonepas``. Find out how to install setuptools + (and EasyInstall) here: + http://peak.telecommunity.com/DevCenter/EasyInstall + + * Create a file called ``paula.plonepas-configure.zcml`` in the + ``/path/to/instance/etc/package-includes`` directory. The file + should only contain this:: + + + + +Alternatively, if you are using zc.buildout and the plone.recipe.zope2instance +recipe to manage your project, you can do this: + + * Add ``paula.plonepas`` to the list of eggs to install, e.g.: + + [buildout] + ... + eggs = + ... + paula.plonepas + + * Tell the plone.recipe.zope2instance recipe to install a ZCML slug: + + [instance] + recipe = plone.recipe.zope2instance + ... + zcml = + paula.plonepas + + * Re-run buildout, e.g. with: + + $ ./bin/buildout + +You can skip the ZCML slug if you are going to explicitly include the package +from another package's configure.zcml file. diff --git a/paula.plonepas/trunk/docs/LICENSE.GPL b/paula.plonepas/trunk/docs/LICENSE.GPL new file mode 100644 index 0000000..ba9543b --- /dev/null +++ b/paula.plonepas/trunk/docs/LICENSE.GPL @@ -0,0 +1,222 @@ + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/paula.plonepas/trunk/docs/LICENSE.txt b/paula.plonepas/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.plonepas/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.plonepas/trunk/externals/EXTERNALS.txt b/paula.plonepas/trunk/externals/EXTERNALS.txt new file mode 100644 index 0000000..f80ed04 --- /dev/null +++ b/paula.plonepas/trunk/externals/EXTERNALS.txt @@ -0,0 +1,10 @@ +paula.authentication https://svn.plone.org/svn/collective/paula/paula.authentication/trunk +paula.authutil https://svn.plone.org/svn/collective/paula/paula.authutil/trunk +paula.groups https://svn.plone.org/svn/collective/paula/paula.groups/trunk +paula.grouputil https://svn.plone.org/svn/collective/paula/paula.grouputil/trunk +paula.properties https://svn.plone.org/svn/collective/paula/paula.properties/trunk +paula.proputil https://svn.plone.org/svn/collective/paula/paula.proputil/trunk +paula.suite https://svn.plone.org/svn/collective/paula/paula.suite/trunk +paula.examples https://svn.plone.org/svn/collective/paula/paula.examples/trunk +paula.ploneexamples https://svn.plone.org/svn/collective/paula/paula.ploneexamples/trunk +paula.testing https://svn.plone.org/svn/collective/paula/paula.testing/trunk diff --git a/paula.plonepas/trunk/products/README.txt b/paula.plonepas/trunk/products/README.txt new file mode 100644 index 0000000..67e3423 --- /dev/null +++ b/paula.plonepas/trunk/products/README.txt @@ -0,0 +1 @@ +Zope2 Products diff --git a/paula.plonepas/trunk/setup.cfg b/paula.plonepas/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.plonepas/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.plonepas/trunk/setup.py b/paula.plonepas/trunk/setup.py new file mode 100644 index 0000000..19ef7c4 --- /dev/null +++ b/paula.plonepas/trunk/setup.py @@ -0,0 +1,44 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.plonepas', + version=version, + description="Paula PlonePAS plugins facilitating PAU", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Plone'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.component', + 'zope.interface', + 'zope.schema', + 'zope.app.authentication', + 'paula.suite>=0.59', + 'paula.testing>=0.59', + ], + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.plonepas/trunk/src/paula/__init__.py b/paula.plonepas/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.plonepas/trunk/src/paula/plonepas/README.txt b/paula.plonepas/trunk/src/paula/plonepas/README.txt new file mode 100644 index 0000000..4052ab4 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/README.txt @@ -0,0 +1,162 @@ +paula.plonepas package readme +============================= + +Set things up (thx optilux) +--------------------------- + + >>> from Products.Five.testbrowser import Browser + >>> browser = Browser() + >>> portal_url = self.portal.absolute_url() + +The following is useful when writing and debugging testbrowser tests. It lets +us see error messages properly. + + >>> browser.handleErrors = False + >>> self.portal.error_log._ignored_exceptions = () + +We then turn off the various portlets, because they sometimes duplicate links +and text (e.g. the navtree, the recent recent items listing) that we wish to +test for in our own views. Having no portlets makes things easier. + + >>> from zope.component import getMultiAdapter, getUtility + >>> from plone.portlets.interfaces import IPortletManager + >>> from plone.portlets.interfaces import IPortletAssignmentMapping + + >>> left_column = getUtility(IPortletManager, name=u"plone.leftcolumn") + >>> left_assignable = getMultiAdapter((self.portal, left_column), IPortletAssignmentMapping) + >>> for name in left_assignable.keys(): + ... del left_assignable[name] + + >>> right_column = getUtility(IPortletManager, name=u"plone.rightcolumn") + >>> right_assignable = getMultiAdapter((self.portal, right_column), IPortletAssignmentMapping) + >>> for name in right_assignable.keys(): + ... del right_assignable[name] + + +Start testing +------------- + +Make sure all components have been registered + + >>> from zope.app.security.interfaces import IAuthentication + >>> from paula.authentication.interfaces import ILocalAuthenticatorPlugin + >>> from paula.authentication.interfaces import \ + ... ICredentialsFromMappingPlugin + >>> from paula.authentication.interfaces import IAuthProviders + >>> from paula.properties.interfaces import IPropertyProviders + >>> from paula.groups.interfaces import IMemberships + + >>> pau = getUtility(IAuthentication, context=portal) + >>> pau.__parent__ = portal + >>> pau + + >>> ap = getUtility(ILocalAuthenticatorPlugin, context=portal, + ... name='Paula PAU AuthenticatorPlugin') + >>> ap.__parent__ = portal + >>> ap + + >>> cp = getUtility(ICredentialsFromMappingPlugin, context=portal, + ... name='Paula PAU CredentialsFromMappingPlugin') + >>> cp.__parent__ = portal + >>> cp + + >>> apu = getUtility(IAuthProviders, context=portal) + >>> apu.__parent__ = portal + >>> apu + + >>> ppu = getUtility(IPropertyProviders, context=portal) + >>> ppu.__parent__ = portal + >>> ppu + + >>> mu = getUtility(IMemberships, context=portal) + >>> mu.__parent__ = portal + >>> mu + + + +Add a user to the site + + >>> from zope.component import createObject + >>> user = createObject('paula.ploneexamples.MinimalPloneUser', "user") + >>> user.title = u"user" + >>> user.password = u'password' + >>> user.email = u"foo@bar.com" + >>> user.realname = u"Foo Bar" + >>> portal['user'] = user + +credentials for the user, for PAU/Paula testing + + >>> from zope.publisher.interfaces import IRequest + >>> pau_req = UserDict(login="user", password="password") + >>> alsoProvides(pau_req, IRequest) + + +Add groups + + >>> g1 = createObject('paula.ploneexamples.BasicGroup', 'g1') + >>> g1.title = 'g1' + >>> g1.members = ('user',) + + >>> g2 = createObject('paula.ploneexamples.BasicGroup', 'g2') + >>> g2.title = 'g2' + >>> g2.members = ('g1',) + + >>> portal['g1'] = g1 + >>> portal['g2'] = g2 + + +Test PAU/Paula subsystem + + >>> principal = pau.authenticate(pau_req) + >>> principal + Principal('user') + + >>> principal.email + u'foo@bar.com' + >>> principal.realname + u'Foo Bar' + + >>> principal.groups + ['g1'] + + +Paula PAS auth plugin + + >>> p = portal.acl_users.paula_auth.authenticateCredentials(pau_req) + >>> p + ('user', 'user') + +make a plone user + + >>> from Products.PlonePAS.plugins.ufactory import PloneUser + >>> pu = PloneUser(p[1]) + >>> pu + + +Paula PAS properties plugin + + >>> psheet = portal.acl_users.paula_properties.getPropertiesForUser(pu) + >>> psheet.propertyItems() + [('email', u'foo@bar.com'), ('realname', u'Foo Bar')] + +Paula PAS group plugin + + >>> portal.acl_users.paula_groups.getGroupsForPrincipal(pu) + ('g1',) + + +try to authenticate + + >>> browser.open(portal_url + '/login_form?came_from=' + portal_url) + >>> browser.getControl(name='__ac_name').value = u"user" + >>> browser.getControl(name='__ac_password').value = u"wrong" + >>> browser.getControl(name='submit').click() + >>> 'Login failed' in browser.contents + True + + >>> browser.open(portal_url + '/login_form?came_from=' + portal_url) + >>> browser.getControl(name='__ac_name').value = u"user" + >>> browser.getControl(name='__ac_password').value = u"password" + >>> browser.getControl(name='submit').click() + >>> 'Login failed' in browser.contents + False diff --git a/paula.plonepas/trunk/src/paula/plonepas/__init__.py b/paula.plonepas/trunk/src/paula/plonepas/__init__.py new file mode 100644 index 0000000..3ae6ce6 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/__init__.py @@ -0,0 +1,74 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + + +from AccessControl.Permissions import add_user_folders +from Products.PluggableAuthService import registerMultiPlugin + +from paula.plonepas.plugins import auth +from paula.plonepas.plugins import groups +from paula.plonepas.plugins import properties + + +def initialize(context): + """ + """ + registerMultiPlugin(auth.AuthenticationPlugin.meta_type) + + context.registerClass( + auth.AuthenticationPlugin, + permission = add_user_folders, + #icon='www/paula.gif', + constructors = ( + auth.manage_addAuthenticationPluginForm, + auth.addAuthenticationPlugin, + ), + visibility = None, + ) + + + registerMultiPlugin(groups.GroupsPlugin.meta_type) + + context.registerClass( + groups.GroupsPlugin, + permission = add_user_folders, + #icon='www/paula.gif', + constructors = ( + groups.manage_addGroupsPluginForm, + groups.addGroupsPlugin, + ), + visibility = None, + ) + + + registerMultiPlugin(properties.PropertiesPlugin.meta_type) + + context.registerClass( + properties.PropertiesPlugin, + permission = add_user_folders, + #icon='www/paula.gif', + constructors = ( + properties.manage_addPropertiesPluginForm, + properties.addPropertiesPlugin, + ), + visibility = None, + ) diff --git a/paula.plonepas/trunk/src/paula/plonepas/configure.zcml b/paula.plonepas/trunk/src/paula/plonepas/configure.zcml new file mode 100644 index 0000000..aed1c55 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/configure.zcml @@ -0,0 +1,18 @@ + + + + + + + + + + + diff --git a/paula.plonepas/trunk/src/paula/plonepas/integration-paula.txt b/paula.plonepas/trunk/src/paula/plonepas/integration-paula.txt new file mode 100644 index 0000000..c4f03ae --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/integration-paula.txt @@ -0,0 +1,70 @@ +Currently unused + + +paula.plonepas Package Readme +============================= + + >>> from paula.suite import createPaulaSuite + >>> root = getRootFolder() + >>> creatPaulaSuite(root, create_pau=True, create_credplugin=True) + + + + +A minimal plone user: + + >>> from paula.examples.content import MinimalPloneUser + >>> user = MinimalPloneUser( + ... name=u"login", + ... password=u"correct", + ... email=u"foo@bar.com", + ... realname=u"Foo Bar", + ... ) + + +Create our PlonePAS authentication plugin and try to authenticate + + >>> from paula.plonepas.plugins.auth import AuthenticationPlugin + >>> pas_ap = AuthenticationPlugin('pas_ap') + +wrong password + + >>> creds = {} + >>> creds['login']="login" + >>> creds['password']="wrong" + >>> pas_ap.authenticateCredentials(creds) is None + True + +matching credentials + + >>> creds['password']="correct" + >>> pas_ap.authenticateCredentials(creds) + ('login', 'login') + +non-existant username + + >>> creds['login']="wrong" + >>> pas_ap.authenticateCredentials(creds) is None + True + + + + + + + +Create our PlonePAS properties plugin and try to fetch properties + + >>> from paula.plonepas.plugins.properties import PropertiesPlugin + >>> pas_pp = PropertiesPlugin('pas_pp') + +a mock plone user + + >>> ploneuser = Mock(getId = lambda : u"login") + >>> psheet = pas_pp.getPropertiesForUser(ploneuser) + >>> psheet.getId() + 'pas_pp' + >>> psheet.propertyIds() + ['email', 'realname'] + >>> psheet.propertyValues() + [u'foo@bar.com', u'Foo Bar'] diff --git a/paula.plonepas/trunk/src/paula/plonepas/plugins/__init__.py b/paula.plonepas/trunk/src/paula/plonepas/plugins/__init__.py new file mode 100644 index 0000000..d7e97a9 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/plugins/__init__.py @@ -0,0 +1,22 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + diff --git a/paula.plonepas/trunk/src/paula/plonepas/plugins/auth.py b/paula.plonepas/trunk/src/paula/plonepas/plugins/auth.py new file mode 100644 index 0000000..f55078f --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/plugins/auth.py @@ -0,0 +1,135 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +import UserDict + +from AccessControl import ClassSecurityInfo +from Globals import InitializeClass +from Products.PageTemplates.PageTemplateFile import PageTemplateFile + +from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin +from Products.PluggableAuthService.interfaces.plugins \ + import IAuthenticationPlugin + +from zope.app.security.interfaces import IAuthentication +from zope.interface import implements, alsoProvides +from zope.component import getUtility +from zope.publisher.interfaces import IRequest + + +manage_addAuthenticationPluginForm = PageTemplateFile( + '../www/AuthenticationPluginForm', + globals(), __name__='manage_addAuthenticationPluginForm' ) + + +def addAuthenticationPlugin( dispatcher, id, title=None, REQUEST=None ): + """Add a paula.plonepas AuthenticationPlugin to a PluggableAuthService. + """ + plugin = AuthenticationPlugin(id, title) + dispatcher._setObject(plugin.getId(), plugin) + + if REQUEST is not None: + REQUEST['RESPONSE'].redirect( + '%s/manage_workspace' + '?manage_tabs_message=' + 'paula.plonepas.AuthenticationPlugin+added.' + % dispatcher.absolute_url()) + + +class AuthenticationPlugin(BasePlugin): + """ + """ + security = ClassSecurityInfo() + + implements(IAuthenticationPlugin) + + meta_type = "Paula PAS Authentication Plugin" + + def __init__(self, id, title=None): + self._id = self.id = id + self.title = title + + security.declarePrivate('authenticateCredentials') + def authenticateCredentials(self, credentials): + """ credentials -> (userid, login) + + o 'credentials' will be a mapping, as returned by IExtractionPlugin. + + o Return a tuple consisting of user ID (which may be different + from the login name) and login + + o If the credentials cannot be authenticated, return None. + + Mock principal + + >>> p = Mock(id = 'login') + + Mockup IAuthentication + + >>> au = Mock(authenticate = \\ + ... lambda x : IRequest.providedBy(x) \\ + ... and x.has_key('login') \\ + ... and x.has_key('password') \\ + ... and p, + ... alsoProvides=(IAuthentication,)) + >>> provideUtility(au, IAuthentication) + + our authentication plugin + + >>> ap = AuthenticationPlugin('ap') + + wrong credentials + + >>> creds = {} + >>> creds['login'] = 'foo' + >>> ap.authenticateCredentials(creds) is None + True + + correct credentials + + >>> creds['password'] = 'foo' + >>> ap.authenticateCredentials(creds) + ('login', 'login') + + and otherway wrong creds + + >>> del creds['login'] + >>> ap.authenticateCredentials(creds) is None + True + """ + pau = getUtility(IAuthentication) + + # pau expects something providing request + # our fake credentials plugin is fine with a mapping + request = UserDict.UserDict(credentials) + alsoProvides(request, IRequest) + + principal = pau.authenticate(request) + if principal: + return (principal.id, principal.id) + + #if credentials['login'] is 'adam': + # return ('adam', 'adam') + + return None + +InitializeClass( AuthenticationPlugin) diff --git a/paula.plonepas/trunk/src/paula/plonepas/plugins/groups.py b/paula.plonepas/trunk/src/paula/plonepas/plugins/groups.py new file mode 100644 index 0000000..ba2dfa8 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/plugins/groups.py @@ -0,0 +1,96 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + + +from AccessControl import ClassSecurityInfo + +from Globals import InitializeClass + +from Products.PageTemplates.PageTemplateFile import PageTemplateFile + +from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin +from Products.PluggableAuthService.interfaces.plugins \ + import IGroupsPlugin + +from zope.app.security.interfaces import IAuthentication +from zope.app.security.interfaces import PrincipalLookupError +from zope.component import getUtility +from zope.interface import implements + + +manage_addGroupsPluginForm = PageTemplateFile( + '../www/GroupsPluginForm', + globals(), __name__='manage_addGroupsPluginForm' ) + + +def addGroupsPlugin( dispatcher, id, title=None, REQUEST=None ): + """Add a paula.plonepas GroupsPlugin to a PluggableAuthService. + """ + plugin = GroupsPlugin(id, title) + dispatcher._setObject(plugin.getId(), plugin) + + if REQUEST is not None: + REQUEST['RESPONSE'].redirect( + '%s/manage_workspace' + '?manage_tabs_message=' + 'paula.plonepas.GroupsPlugin+added.' + % dispatcher.absolute_url()) + + +class GroupsPlugin(BasePlugin): + """ + """ + security = ClassSecurityInfo() + + implements(IGroupsPlugin) + + meta_type = "Paula PAS Groups Plugin" + + def __init__(self, id, title=None): + self._id = self.id = id + self.title = title + + security.declarePrivate('getGroupsForPrincipal') + def getGroupsForPrincipal(self, principal, request=None): + """ principal -> ( group_1, ... group_N ) + + o Return a sequence of group names to which the principal + (either a user or another group) belongs. + + o May assign groups based on values in the REQUEST object, if present + """ + # get principal from pau + pau = getUtility(IAuthentication) + try: + p = pau.getPrincipal(principal.getId()) + except PrincipalLookupError: + return {} + + if not p: + return {} + + # eventually we need to return allGroups from an + # IGroupClousureAwarePrincipal + return tuple(p.groups) + + +InitializeClass( GroupsPlugin) diff --git a/paula.plonepas/trunk/src/paula/plonepas/plugins/properties.py b/paula.plonepas/trunk/src/paula/plonepas/plugins/properties.py new file mode 100644 index 0000000..3c3971a --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/plugins/properties.py @@ -0,0 +1,173 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + + +from AccessControl import ClassSecurityInfo +from Globals import InitializeClass + +from Products.PageTemplates.PageTemplateFile import PageTemplateFile +from Products.PlonePAS.sheet import MutablePropertySheet + +from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin +from Products.PluggableAuthService.interfaces.plugins \ + import IPropertiesPlugin + +from zope.app.security.interfaces import IAuthentication +from zope.app.security.interfaces import PrincipalLookupError +from zope.component import getUtility +from zope.interface import alsoProvides, implements + +from paula.properties.interfaces import IPropertyInterface + + +manage_addPropertiesPluginForm = PageTemplateFile( + '../www/PropertiesPluginForm', + globals(), __name__='manage_addPropertiesPluginForm' ) + + +def addPropertiesPlugin( dispatcher, id, title=None, REQUEST=None ): + """Add a paula.plonepas PropertiesPlugin to a PluggableAuthService. + """ + plugin = PropertiesPlugin(id, title) + dispatcher._setObject(plugin.getId(), plugin) + + if REQUEST is not None: + REQUEST['RESPONSE'].redirect( + '%s/manage_workspace' + '?manage_tabs_message=' + 'paula.plonepas.PropertiesPlugin+added.' + % dispatcher.absolute_url()) + + +class PropertiesPlugin(BasePlugin): + """ + """ + security = ClassSecurityInfo() + + implements(IPropertiesPlugin) + + meta_type = "Paula PAS Properties Plugin" + + def __init__(self, id, title=None): + self._id = self.id = id + self.title = title + + security.declarePrivate('getPropertiesForUser') + def getPropertiesForUser(self, user, request=None): + """ user -> {} + + o User will implement IPropertiedUser. + + o Plugin should return a dictionary or an object providing + IPropertySheet. + + o Plugin may scribble on the user, if needed (but must still + return a mapping, even if empty). + + o May assign properties based on values in the REQUEST object, if + present + + Create a sophisticated mock principal + + >>> from zope.interface import Interface, Attribute + + property interfaces + + >>> class IA(Interface): + ... id = Attribute('id') + ... a1 = Attribute("a1") + ... a2 = Attribute("a2") + + >>> class IB(Interface): + ... b1 = Attribute("b1") + + >>> alsoProvides(IA, IPropertyInterface) + >>> alsoProvides(IB, IPropertyInterface) + >>> IPropertyInterface.providedBy(IA) + True + >>> IPropertyInterface.providedBy(IB) + True + + and the mock principal + + >>> class MockPrincipal(object): + ... implements(IA,IB) + ... id = 'login' + ... a1 = 1 + ... a2 = 2 + ... b1 = 1 + ... c1 = 'will not show up' + + >>> p = MockPrincipal() + + Mockup IAuthentication + + >>> from zope.component import provideUtility + >>> au = Mock(getPrincipal = lambda x : x == "login" and p) + >>> alsoProvides(au, IAuthentication) + >>> provideUtility(au, IAuthentication) + + our property plugin + + >>> pp = PropertiesPlugin('pp') + + a mockup plone user + + >>> ploneuser = Mock(getId = lambda : u"login") + >>> psheet = pp.getPropertiesForUser(ploneuser) + >>> psheet.getId() + 'pp' + >>> psheet.propertyIds() + ['a1', 'a2', 'b1'] + >>> psheet.propertyValues() + [1, 2, 1] + + and for a non-existing user + + >>> ploneuser = Mock(getId = lambda : u"foo") + >>> pp.getPropertiesForUser(ploneuser) + {} + """ + # get principal from pau + pau = getUtility(IAuthentication) + try: + principal = pau.getPrincipal(user.getId()) + except PrincipalLookupError: + return {} + + if not principal: + return {} + + # create property dictionary from all attributes, which belong to + # property schemas + properties = {} + for schema in list(principal.__provides__): + if IPropertyInterface.providedBy(schema): + for name in list(schema): + properties[name] = getattr(principal, name) + + if properties.has_key('id'): + del properties['id'] + + return MutablePropertySheet(self.id, **properties) + +InitializeClass( PropertiesPlugin) diff --git a/paula.plonepas/trunk/src/paula/plonepas/profiles.zcml b/paula.plonepas/trunk/src/paula/plonepas/profiles.zcml new file mode 100644 index 0000000..1614850 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/profiles.zcml @@ -0,0 +1,14 @@ + + + + + diff --git a/paula.plonepas/trunk/src/paula/plonepas/profiles/default/componentregistry.xml b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/componentregistry.xml new file mode 100644 index 0000000..0c3e476 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/componentregistry.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + diff --git a/paula.plonepas/trunk/src/paula/plonepas/profiles/default/import_steps.xml b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/import_steps.xml new file mode 100644 index 0000000..2d8361d --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/import_steps.xml @@ -0,0 +1,24 @@ + + + + + + Install Paula PAS plug-ins + + + + + Install Paula Suite + + + diff --git a/paula.plonepas/trunk/src/paula/plonepas/profiles/default/metadata.xml b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/metadata.xml new file mode 100644 index 0000000..aabcd79 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/metadata.xml @@ -0,0 +1,4 @@ + + Paula PlonePAS + 0.60 + diff --git a/paula.plonepas/trunk/src/paula/plonepas/profiles/default/paula-plonepas-create-paula-suite.txt b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/paula-plonepas-create-paula-suite.txt new file mode 100644 index 0000000..426c518 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/paula-plonepas-create-paula-suite.txt @@ -0,0 +1,2 @@ +The createPaulaSuite import step will be run if this file is present in +the profile. diff --git a/paula.plonepas/trunk/src/paula/plonepas/profiles/default/paula-plonepas-setup-plugins.txt b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/paula-plonepas-setup-plugins.txt new file mode 100644 index 0000000..0886634 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/profiles/default/paula-plonepas-setup-plugins.txt @@ -0,0 +1,2 @@ +The setupPlugins import step will be run if this file is present in +the profile. diff --git a/paula.plonepas/trunk/src/paula/plonepas/setuphandlers.py b/paula.plonepas/trunk/src/paula/plonepas/setuphandlers.py new file mode 100644 index 0000000..3ecd123 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/setuphandlers.py @@ -0,0 +1,127 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from StringIO import StringIO + +from Products.CMFCore.utils import getToolByName + +from Products.PluggableAuthService.interfaces.plugins \ + import IAuthenticationPlugin + +from Products.PlonePAS.Extensions.Install import activatePluginInterfaces + +from plone.app.content.container import Container + +#from zope.component import getUtility + +from zope.app.authentication.interfaces import IPluggableAuthentication +from paula.authentication.interfaces import ILocalAuthenticatorPlugin +from paula.authentication.interfaces import ICredentialsFromMappingPlugin +from paula.authentication.interfaces import IAuthProviders +from paula.groups.interfaces import IMemberships +from paula.properties.interfaces import IPropertyProviders + +from paula import suite + + +def _setupPlugins(portal, out): + """ + Install and prioritize the Paula PAS plug-ins. + """ + uf = getToolByName(portal, 'acl_users') + + paula = uf.manage_addProduct['paula.plonepas'] + existing = uf.objectIds() + + if 'paula_auth' not in existing: + paula.addAuthenticationPlugin('paula_auth') + print >> out, "Added Paula PAS Authentication Plugin." + activatePluginInterfaces(portal, 'paula_auth', out) + + #plugins = uf.plugins + #plugins.movePluginsUp(IAuthenticationPlugin, ['paula']) + + if 'paula_properties' not in existing: + paula.addPropertiesPlugin('paula_properties') + print >> out, "Added Paula PAS Properties Plugin." + activatePluginInterfaces(portal, 'paula_properties', out) + + if 'paula_groups' not in existing: + paula.addGroupsPlugin('paula_groups') + print >> out, "Added Paula PAS Groups Plugin." + activatePluginInterfaces(portal, 'paula_groups', out) + + +def setupPlugins(context): + """initialize paula plugins + """ + if context.readDataFile('paula-plonepas-setup-plugins.txt') is None: + return + + portal = context.getSite() + out = StringIO() + _setupPlugins(portal, out) + logger = context.getLogger("plugins") + logger.info(out.getvalue()) + + +def _createPaulaSuite(portal, out): + """ + """ + #suite.createPaulaSuite(portal, create_pau=True, create_credplugin=True, + # ContainerType=Container) +# for x, name in ( +# (IPluggableAuthentication, +# ''), +# (ILocalAuthenticatorPlugin, +# 'Paula PAU AuthenticatorPlugin'), +# (ICredentialsFromMappingPlugin, +# 'Paula PAU CredentialsFromMappingPlugin'), +# (IAuthProviders, +# ''), +# (IPropertyProviders, +# ''), +# (IMemberships, +# '')): +# util = getUtility(x, name=name, context=portal) +# if not util.__parent__: +# util.__parent__ = portal +# pau = getUtility(IPluggableAuthentication, context=portal) +# # these three don't work ?! - hardcoded now in utils.py +# # probably something about persistency +# pau.authenticatorPlugins = ('Paula PAU AuthenticatorPlugin',) +# pau.credentialsPlugins = ('Paula PAU CredentialsFromMappingPlugin',) +# pau.abcdef = 1 + print >> out, "Added Paula Suite to Portal." + +def createPaulaSuite(context): + """ + """ + if context.readDataFile('paula-plonepas-create-paula-suite.txt') is None: + return + + portal = context.getSite() + out = StringIO() + _createPaulaSuite(portal, out) + logger = context.getLogger("plugins") + logger.info(out.getvalue()) + diff --git a/paula.plonepas/trunk/src/paula/plonepas/tests/__init__.py b/paula.plonepas/trunk/src/paula/plonepas/tests/__init__.py new file mode 100644 index 0000000..c0f6f28 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/tests/__init__.py @@ -0,0 +1,2 @@ +""" +""" diff --git a/paula.plonepas/trunk/src/paula/plonepas/tests/config.py b/paula.plonepas/trunk/src/paula/plonepas/tests/config.py new file mode 100644 index 0000000..36921a0 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/tests/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.plonepas" diff --git a/paula.plonepas/trunk/src/paula/plonepas/tests/plone_base.py b/paula.plonepas/trunk/src/paula/plonepas/tests/plone_base.py new file mode 100644 index 0000000..2c87bbd --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/tests/plone_base.py @@ -0,0 +1,59 @@ +from Products.Five import zcml +from Products.Five import fiveconfigure + +from Testing import ZopeTestCase as ztc + +from Products.PloneTestCase import PloneTestCase as ptc +from Products.PloneTestCase.layer import onsetup, PloneSite + +from plone.app.controlpanel.tests import ControlPanelTestCase +from kss.core.tests.base import KSSLayer, KSSViewTestCase + +@onsetup +def setup_paula_plonepas(): + """Set up the additional products required for the Optilux Cinema Content. + + The @onsetup decorator causes the execution of this body to be deferred + until the setup of the Plone site testing layer. + """ + + # Load the ZCML configuration for the optilux.policy package. + # This includes the other products below as well. + + fiveconfigure.debug_mode = True + import paula.plonepas + zcml.load_config('configure.zcml', paula.plonepas) + fiveconfigure.debug_mode = False + + # We need to tell the testing framework that these products + # should be available. This can't happen until after we have loaded + # the ZCML. + + ztc.installPackage('paula.plonepas') + +# The order here is important: We first call the (deferred) function which +# installs the products we need for the Optilux package. Then, we let +# PloneTestCase set up this product on installation. + +setup_paula_plonepas() +ptc.setupPloneSite(products=['paula.plonepas']) + +class PaulaTestCase(ptc.PloneTestCase): + """Base class used for test cases + """ + +class PaulaFunctionalTestCase(ptc.FunctionalTestCase): + """Test case class used for functional (doc-)tests + """ + +class PaulaPanelTestCase(PaulaFunctionalTestCase, ControlPanelTestCase): + """Test case used for the control panel tests, with some convenience + methods from plone.app.controlpanel. + """ + +class PaulaKSSTestCase(PaulaFunctionalTestCase, KSSViewTestCase): + """Test case used for KSS tests + """ + + class layer(KSSLayer, PloneSite): + pass diff --git a/paula.plonepas/trunk/src/paula/plonepas/tests/test_doctests.py b/paula.plonepas/trunk/src/paula/plonepas/tests/test_doctests.py new file mode 100644 index 0000000..172dff5 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/tests/test_doctests.py @@ -0,0 +1,39 @@ +# paula.testing.test_doctests.py +# +# Just put a copy of this in your tests subpackage and all your modules' +# doctests will be found recursively. +# +# There are several globs available, have a look at paula.testing.testing.py +""" +""" + +import unittest +import doctest + +from Testing import ZopeTestCase as ztc + +from paula.testing import get_test_suite, test_globs + +from paula.plonepas.tests import plone_base as base + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +tests = [ + # Demonstrate the main content types + ztc.ZopeDocFileSuite( + 'README.txt', package='paula.plonepas', + test_class=base.PaulaFunctionalTestCase, + globs=test_globs, + optionflags= \ + doctest.NORMALIZE_WHITESPACE | \ + doctest.ELLIPSIS), + ] + + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') diff --git a/paula.plonepas/trunk/src/paula/plonepas/utils.py b/paula.plonepas/trunk/src/paula/plonepas/utils.py new file mode 100644 index 0000000..316fd8d --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/utils.py @@ -0,0 +1,81 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from OFS.SimpleItem import SimpleItem + +from paula.authentication import LocalAuthenticatorPlugin as \ + AuthenticatorPluginBase +from paula.authentication import CredentialsFromMappingPlugin as \ + CredentialsFromMappingPluginBase +from paula.authutil import RWAuthProviders as \ + RWAuthProvidersBase +from paula.proputil import RWPropertyProviders as \ + RWPropertyProvidersBase +from paula.grouputil import RWMemberships as \ + RWMembershipsBase +from zope.app.authentication.authentication import PluggableAuthentication as \ + PluggableAuthenticationBase + + +class PluggableAuthentication(SimpleItem, PluggableAuthenticationBase): + """ + """ + authenticatorPlugins = ('Paula PAU AuthenticatorPlugin',) + credentialsPlugins = ('Paula PAU CredentialsFromMappingPlugin',) + + def __init__(self): + super(PluggableAuthentication, self).__init__() + + +class AuthenticatorPlugin(SimpleItem, AuthenticatorPluginBase): + """ + """ + def __init__(self): + super(AuthenticatorPlugin, self).__init__() + + +class CredentialsFromMappingPlugin(SimpleItem, CredentialsFromMappingPluginBase): + """ + """ + def __init__(self): + super(CredentialsFromMappingPlugin, self).__init__() + + +class RWAuthProviders(SimpleItem, RWAuthProvidersBase): + """ + """ + def __init__(self): + super(RWAuthProviders, self).__init__() + + +class RWPropertyProviders(SimpleItem, RWPropertyProvidersBase): + """ + """ + def __init__(self): + super(RWPropertyProviders, self).__init__() + + +class RWMemberships(SimpleItem, RWMembershipsBase): + """ + """ + def __init__(self): + super(RWMemberships, self).__init__() diff --git a/paula.plonepas/trunk/src/paula/plonepas/www/AuthenticationPluginForm.zpt b/paula.plonepas/trunk/src/paula/plonepas/www/AuthenticationPluginForm.zpt new file mode 100644 index 0000000..97e9686 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/www/AuthenticationPluginForm.zpt @@ -0,0 +1,56 @@ +

Header

+ +

Form Title

+ +

+ Paula uses PAU +

+ +
+ + + + + + + + + + + + + + + + + +
+
+ Id +
+
+ +
+
+ Title +
+
+ +
+
+ Delegate user folder path +
+
+ +
+ +
+ +
+
+
+ +

Footer

+ diff --git a/paula.plonepas/trunk/src/paula/plonepas/www/GroupsPluginForm.zpt b/paula.plonepas/trunk/src/paula/plonepas/www/GroupsPluginForm.zpt new file mode 100644 index 0000000..8f3c3f3 --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/www/GroupsPluginForm.zpt @@ -0,0 +1,56 @@ +

Header

+ +

Form Title

+ +

+ Paula uses PAU +

+ +
+ + + + + + + + + + + + + + + + + +
+
+ Id +
+
+ +
+
+ Title +
+
+ +
+
+ Delegate user folder path +
+
+ +
+ +
+ +
+
+
+ +

Footer

+ diff --git a/paula.plonepas/trunk/src/paula/plonepas/www/PropertiesPluginForm.zpt b/paula.plonepas/trunk/src/paula/plonepas/www/PropertiesPluginForm.zpt new file mode 100644 index 0000000..fad325f --- /dev/null +++ b/paula.plonepas/trunk/src/paula/plonepas/www/PropertiesPluginForm.zpt @@ -0,0 +1,56 @@ +

Header

+ +

Form Title

+ +

+ Paula uses PAU +

+ +
+ + + + + + + + + + + + + + + + + +
+
+ Id +
+
+ +
+
+ Title +
+
+ +
+
+ Delegate user folder path +
+
+ +
+ +
+ +
+
+
+ +

Footer

+ diff --git a/paula.properties/trunk/.gitignore b/paula.properties/trunk/.gitignore new file mode 100644 index 0000000..36a34b9 --- /dev/null +++ b/paula.properties/trunk/.gitignore @@ -0,0 +1,15 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old +/externals diff --git a/paula.properties/trunk/README.txt b/paula.properties/trunk/README.txt new file mode 100644 index 0000000..f014ec2 --- /dev/null +++ b/paula.properties/trunk/README.txt @@ -0,0 +1,4 @@ +Introduction +============ + + diff --git a/paula.properties/trunk/bootstrap.py b/paula.properties/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.properties/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.properties/trunk/buildout.cfg b/paula.properties/trunk/buildout.cfg new file mode 100644 index 0000000..5dd59c8 --- /dev/null +++ b/paula.properties/trunk/buildout.cfg @@ -0,0 +1,13 @@ +[buildout] +develop = . + externals/paula.testing +parts = test py + +[test] +recipe = zc.recipe.testrunner +eggs = paula.properties [test] + +[py] +recipe = zc.recipe.egg +interpreter = py +eggs = ${test:eggs} diff --git a/paula.properties/trunk/docs/HISTORY.txt b/paula.properties/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.properties/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.properties/trunk/docs/LICENSE.txt b/paula.properties/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.properties/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.properties/trunk/externals/EXTERNALS.txt b/paula.properties/trunk/externals/EXTERNALS.txt new file mode 100644 index 0000000..fa7fb20 --- /dev/null +++ b/paula.properties/trunk/externals/EXTERNALS.txt @@ -0,0 +1 @@ +paula.testing https://svn.plone.org/svn/collective/paula/paula.testing/trunk diff --git a/paula.properties/trunk/setup.cfg b/paula.properties/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.properties/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.properties/trunk/setup.py b/paula.properties/trunk/setup.py new file mode 100644 index 0000000..3c035c1 --- /dev/null +++ b/paula.properties/trunk/setup.py @@ -0,0 +1,47 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.properties', + version=version, + description="Paula subscriber to set PAU principal properties", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.app.authentication', + 'zope.component', + 'zope.interface', + 'zope.schema', + ], + extras_require=dict( + test = [ + 'paula.testing>=0.59', + ], + ), + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.properties/trunk/src/paula/__init__.py b/paula.properties/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.properties/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.properties/trunk/src/paula/properties/README.txt b/paula.properties/trunk/src/paula/properties/README.txt new file mode 100644 index 0000000..c9650fd --- /dev/null +++ b/paula.properties/trunk/src/paula/properties/README.txt @@ -0,0 +1,90 @@ +Currently unused + + +paula.properties Package Readme +=============================== + +XXX: eventually we just test this inside of paula.suite or wherever we do +the overall testing, it is way to bothersome to do it here... + +Create two PAU's + + >>> from zope.app.authentication + + + +test whether properties end up on principals created by a PAU + + +nested + +two principals with the same name + +two provider on one level for the same principal + +another provider for another principal + + + + + A mockup principal + + >>> p = Mock(id='1') + + A mockup property provider + + >>> class IA(Interface): + ... a1 = Attribute(u"a1") + ... a2 = Attribute(u"a2") + >>> alsoProvides(IA, IPropertyInterface) + + >>> class IB(Interface): + ... b = Attribute(u"b") + >>> alsoProvides(IB, IPropertyInterface) + + >>> class IC(Interface): + ... c = Attribute(u"c") + + >>> pp1 = Mock( + ... a1=1, + ... a2=2, + ... b=3, + ... c='not copied', + ... alsoProvides=(IA,IB), + ... ) + + And another one + + >>> class ID(Interface): + ... d = Attribute(u"d") + >>> alsoProvides(ID, IPropertyInterface) + + >>> pp2 = Mock(d=4, alsoProvides=(ID,)) + + A mockup property provider utility + + >>> import UserDict + >>> ppu = UserDict.UserDict() + >>> ppu["1"] = [pp1, pp2] + + Call and check which attributes made it + + >>> _copy_attributes_from_ppu(p, ppu) + >>> IA.providedBy(p) + True + >>> IB.providedBy(p) + True + >>> IC.providedBy(p) + False + >>> ID.providedBy(p) + True + >>> p.a1 + 1 + >>> p.a2 + 2 + >>> p.b + 3 + >>> getattr(p, 'c', 'foo') + 'foo' + >>> p.d + 4 diff --git a/paula.properties/trunk/src/paula/properties/__init__.py b/paula.properties/trunk/src/paula/properties/__init__.py new file mode 100644 index 0000000..1292771 --- /dev/null +++ b/paula.properties/trunk/src/paula/properties/__init__.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from subscribers import setPropertiesForPrincipal diff --git a/paula.properties/trunk/src/paula/properties/config.py b/paula.properties/trunk/src/paula/properties/config.py new file mode 100644 index 0000000..ae6d134 --- /dev/null +++ b/paula.properties/trunk/src/paula/properties/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.properties" diff --git a/paula.properties/trunk/src/paula/properties/configure.zcml b/paula.properties/trunk/src/paula/properties/configure.zcml new file mode 100644 index 0000000..a097240 --- /dev/null +++ b/paula.properties/trunk/src/paula/properties/configure.zcml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/paula.properties/trunk/src/paula/properties/ftesting.zcml b/paula.properties/trunk/src/paula/properties/ftesting.zcml new file mode 100644 index 0000000..905288c --- /dev/null +++ b/paula.properties/trunk/src/paula/properties/ftesting.zcml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/paula.properties/trunk/src/paula/properties/interfaces.py b/paula.properties/trunk/src/paula/properties/interfaces.py new file mode 100644 index 0000000..d94d2c9 --- /dev/null +++ b/paula.properties/trunk/src/paula/properties/interfaces.py @@ -0,0 +1,54 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.interface import Interface +from zope.interface.interfaces import IInterface +from zope.schema import TextLine + + +class IPropertyInterface(IInterface): + """Interfaces providing this interface are recognizes as interfaces defining + properties. + """ + +class IPropertyProvider(Interface): + """A property provider provides certain interfaces that provide + IPropertyInterface, and makes property values available through attribute + access. Other interfaces that might be provided also are ignored. + + For each attribute a value needs to be retrievable (at least None), + otherwise an AttributeError will be raised. + + The principal will carry copies of the properties as attributes and provide + the same IPropertyInterface-providing interfaces. + """ + id = TextLine( + title=u"Id", + description=u"The principal id this provider works for", + ) + +class IPropertyProviders(Interface): + """A utility that returns property providers for principals + """ + def __getitem__(id): + """returns list of IPropertyProvider for principal id + """ diff --git a/paula.properties/trunk/src/paula/properties/subscribers.py b/paula.properties/trunk/src/paula/properties/subscribers.py new file mode 100644 index 0000000..ee4c627 --- /dev/null +++ b/paula.properties/trunk/src/paula/properties/subscribers.py @@ -0,0 +1,140 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.app.authentication.interfaces import IPrincipalCreated + +from zope.component import adapter, queryUtility +from zope.interface import alsoProvides + +from paula.properties.interfaces import IPropertyInterface +from paula.properties.interfaces import IPropertyProvider +from paula.properties.interfaces import IPropertyProviders + +def _copy_attributes_from_ppu( principal, pps): + """ + A mockup principal + + >>> p = Mock(id='1') + + A mockup property provider + + >>> class IA(Interface): + ... a1 = Attribute(u"a1") + ... a2 = Attribute(u"a2") + >>> alsoProvides(IA, IPropertyInterface) + + >>> class IB(Interface): + ... b = Attribute(u"b") + >>> alsoProvides(IB, IPropertyInterface) + + >>> class IC(Interface): + ... c = Attribute(u"c") + + >>> pp1 = Mock( + ... a1=1, + ... a2=2, + ... b=3, + ... c='not copied', + ... alsoProvides=(IA,IB), + ... ) + + And another one + + >>> class ID(Interface): + ... d = Attribute(u"d") + >>> alsoProvides(ID, IPropertyInterface) + + >>> pp2 = Mock(d=4, alsoProvides=(ID,)) + + A list of property provider utilities + + >>> pps = [pp1, pp2] + + Call and check which attributes made it + + >>> _copy_attributes_from_ppu(p, pps) + >>> IA.providedBy(p) + True + >>> IB.providedBy(p) + True + >>> IC.providedBy(p) + False + >>> ID.providedBy(p) + True + >>> p.a1 + 1 + >>> p.a2 + 2 + >>> p.b + 3 + >>> getattr(p, 'c', 'foo') + 'foo' + >>> p.d + 4 + """ + for pp in pps: + schemas = list(pp.__provides__) + for schema in schemas: + # only use interfaces that defined properties + if not IPropertyInterface.providedBy(schema): + continue + # iterate over schema fields and copy values + # also see comment below, dynamic lookup would be great + for name in list(schema): + value = getattr(schema(pp), name) + setattr(principal, name, value) + alsoProvides(principal, schema) + + + #XXX: this is not working, as property object most probably + # do magic inside of __getattr__ and rely on classes to + # interpret them correctly. + # Another way would be to monkey-patch user's + # __getattr__... + # For now we leave it static, i.e. the values are taken + # only once and are not dynamically updated. Not sure, + # whether it is useful anyway, as I don't know how long + # Principals exist at all. + #prop = property( lambda self: getattr(principal, name)) + #setattr(user, name, prop) + + +@adapter(IPrincipalCreated) +def setPropertiesForPrincipal(event): + """Put properties onto the principal + + The properties are directly stored as attributes. Magic happens in + _copy_attributes_from_ppu, here we just get the utility and are tested + in README.txt + """ + principal = event.principal + # we search for a property provider utility in the context of the auth + # plugin that authenticated the principal, if there is none, we do + # nothing + ppu = queryUtility( + IPropertyProviders, + # context=getSite(), + ) + # XXX: for some reason a ppu is False + if ppu is not None and principal.id in ppu: + pps = ppu[principal.id] + _copy_attributes_from_ppu( principal, pps) diff --git a/paula.properties/trunk/src/paula/properties/tests.py b/paula.properties/trunk/src/paula/properties/tests.py new file mode 100644 index 0000000..d98e803 --- /dev/null +++ b/paula.properties/trunk/src/paula/properties/tests.py @@ -0,0 +1,40 @@ +# paula.testing.tests.py +# +# You can simply copy this file to your package and adjust it to your needs +# +# pt.FunctionalDocFileSuite will load your package's ftesting.zcml and +# otherwise setup the same globs as pt.setUp - have a look at __init__.py +""" +""" + +import unittest +#from zope.testing import doctestunit +#from zope.component.testing import setUp + +from paula.testing import get_test_suite, SuiteGenerator + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +sg = SuiteGenerator(PACKAGE_NAME) + +tests = [ + # doctests in all submodules of the package are found by paula.testing + + # doctests in files need to be declared + #doctestunit.DocFileSuite( 'README.txt', + # package=PACKAGE_NAME, setUp=pt.setUp, tearDown=pt.tearDown + # ), + + # functional doctests in files, don't pass setUp/tearDown, except if you + # really know what you are doing... + #sg.FunctionalDocFileSuite('README.txt') + + ] + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') diff --git a/paula.proputil/trunk/.gitignore b/paula.proputil/trunk/.gitignore new file mode 100644 index 0000000..36a34b9 --- /dev/null +++ b/paula.proputil/trunk/.gitignore @@ -0,0 +1,15 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old +/externals diff --git a/paula.proputil/trunk/README.txt b/paula.proputil/trunk/README.txt new file mode 100644 index 0000000..f014ec2 --- /dev/null +++ b/paula.proputil/trunk/README.txt @@ -0,0 +1,4 @@ +Introduction +============ + + diff --git a/paula.proputil/trunk/bootstrap.py b/paula.proputil/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.proputil/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.proputil/trunk/buildout.cfg b/paula.proputil/trunk/buildout.cfg new file mode 100644 index 0000000..10b6b8b --- /dev/null +++ b/paula.proputil/trunk/buildout.cfg @@ -0,0 +1,14 @@ +[buildout] +develop = . + externals/paula.properties + externals/paula.testing +parts = test py + +[test] +recipe = zc.recipe.testrunner +eggs = paula.proputil [test] + +[py] +recipe = zc.recipe.egg +interpreter = py +eggs = ${test:eggs} diff --git a/paula.proputil/trunk/docs/HISTORY.txt b/paula.proputil/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.proputil/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.proputil/trunk/docs/LICENSE.txt b/paula.proputil/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.proputil/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.proputil/trunk/externals/EXTERNALS.txt b/paula.proputil/trunk/externals/EXTERNALS.txt new file mode 100644 index 0000000..2decd39 --- /dev/null +++ b/paula.proputil/trunk/externals/EXTERNALS.txt @@ -0,0 +1,2 @@ +paula.properties https://svn.plone.org/svn/collective/paula/paula.properties/trunk +paula.testing https://svn.plone.org/svn/collective/paula/paula.testing/trunk diff --git a/paula.proputil/trunk/setup.cfg b/paula.proputil/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.proputil/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.proputil/trunk/setup.py b/paula.proputil/trunk/setup.py new file mode 100644 index 0000000..f99cd9f --- /dev/null +++ b/paula.proputil/trunk/setup.py @@ -0,0 +1,46 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.proputil', + version=version, + description="Paula property provider utility", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.app.container', + 'zope.interface', + 'paula.properties>=0.59', + ], + extras_require=dict( + test = [ + 'paula.testing>=0.59', + ], + ), + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.proputil/trunk/src/paula/__init__.py b/paula.proputil/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.proputil/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.proputil/trunk/src/paula/proputil/README.txt b/paula.proputil/trunk/src/paula/proputil/README.txt new file mode 100644 index 0000000..1eacaf7 --- /dev/null +++ b/paula.proputil/trunk/src/paula/proputil/README.txt @@ -0,0 +1,2 @@ +paula.proputil Package Readme +============================= diff --git a/paula.proputil/trunk/src/paula/proputil/__init__.py b/paula.proputil/trunk/src/paula/proputil/__init__.py new file mode 100644 index 0000000..ebf2f88 --- /dev/null +++ b/paula.proputil/trunk/src/paula/proputil/__init__.py @@ -0,0 +1,24 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from utils import RWPropertyProviders +from subscribers import checkRegister, checkUnregister diff --git a/paula.proputil/trunk/src/paula/proputil/config.py b/paula.proputil/trunk/src/paula/proputil/config.py new file mode 100644 index 0000000..ff1ff0b --- /dev/null +++ b/paula.proputil/trunk/src/paula/proputil/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.proputil" diff --git a/paula.proputil/trunk/src/paula/proputil/configure.zcml b/paula.proputil/trunk/src/paula/proputil/configure.zcml new file mode 100644 index 0000000..747feb9 --- /dev/null +++ b/paula.proputil/trunk/src/paula/proputil/configure.zcml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/paula.proputil/trunk/src/paula/proputil/ftesting.zcml b/paula.proputil/trunk/src/paula/proputil/ftesting.zcml new file mode 100644 index 0000000..caa07c2 --- /dev/null +++ b/paula.proputil/trunk/src/paula/proputil/ftesting.zcml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/paula.proputil/trunk/src/paula/proputil/interfaces.py b/paula.proputil/trunk/src/paula/proputil/interfaces.py new file mode 100644 index 0000000..f1436dd --- /dev/null +++ b/paula.proputil/trunk/src/paula/proputil/interfaces.py @@ -0,0 +1,52 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.interface import Interface + +from paula.properties.interfaces import IPropertyProviders + + +class IPropertyProviderAdaptable(Interface): + """Marker interface for objects that can be adapted to IPropertyProvider + """ + +class IRWPropertyProviders(IPropertyProviders): + """A utility that returns property providers for principals + """ + + def register(obj): + """Register an object + + It is assumed that the object provides IPropertyProviderAdaptable and + an adapter for IPropertyProvider is available, a TypeError is raised + otherwise. + """ + + def unregister(obj): + """Unregister an object. + + Fails with ValueError, if the object is not registered. + """ + +class ILocalRWPropertyProviders(IRWPropertyProviders): + """ + """ diff --git a/paula.proputil/trunk/src/paula/proputil/subscribers.py b/paula.proputil/trunk/src/paula/proputil/subscribers.py new file mode 100644 index 0000000..f749827 --- /dev/null +++ b/paula.proputil/trunk/src/paula/proputil/subscribers.py @@ -0,0 +1,76 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.app.container.interfaces import IObjectAddedEvent +from zope.app.container.interfaces import IObjectRemovedEvent + +from zope.component import adapter, queryUtility + +from zope.location.interfaces import ILocation + +from paula.properties.interfaces import IPropertyProvider + +from paula.proputil.interfaces import IPropertyProviderAdaptable +from paula.proputil.interfaces import IRWPropertyProviders + + +@adapter(ILocation, IObjectAddedEvent) +def checkRegister(obj, event): + """A subscriber to ObjectAddedEvent + + Registers an object with all nearest IRWPropertyProviders, iff + IPropertyProviderAdaptable is provided by the object. + """ + if not IPropertyProviderAdaptable.providedBy(obj) and \ + not IPropertyProvider.providedBy(obj): + return + + # we are registered globally and might run in a context without + # IRWPropertyProviders + util = queryUtility(IRWPropertyProviders) #, context=event.newParent) + # XXX: not working, ppu is False?! + #if ppu: + if util is not None: + util.register(obj) + + +@adapter(ILocation, IObjectRemovedEvent) +def checkUnregister(obj, event): + """A subscriber to ObjectRemovedEvent + + Unregisters an object from all nearest IRWPropertyProviders, iff + IPropertyProviderAdaptable is provided by the object. + """ + if not IPropertyProviderAdaptable.providedBy(obj) and \ + not IPropertyProvider.providedBy(obj): + return + + # we are registered globally and might run in a context without + # IRWPropertyProviders + util = queryUtility(IRWPropertyProviders) #, context=event.oldParent) + # XXX: not working, ppu is False?! + #if ppu: + if util is not None: + try: + util.unregister(obj) + except KeyError: + pass diff --git a/paula.proputil/trunk/src/paula/proputil/tests.py b/paula.proputil/trunk/src/paula/proputil/tests.py new file mode 100644 index 0000000..d98e803 --- /dev/null +++ b/paula.proputil/trunk/src/paula/proputil/tests.py @@ -0,0 +1,40 @@ +# paula.testing.tests.py +# +# You can simply copy this file to your package and adjust it to your needs +# +# pt.FunctionalDocFileSuite will load your package's ftesting.zcml and +# otherwise setup the same globs as pt.setUp - have a look at __init__.py +""" +""" + +import unittest +#from zope.testing import doctestunit +#from zope.component.testing import setUp + +from paula.testing import get_test_suite, SuiteGenerator + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +sg = SuiteGenerator(PACKAGE_NAME) + +tests = [ + # doctests in all submodules of the package are found by paula.testing + + # doctests in files need to be declared + #doctestunit.DocFileSuite( 'README.txt', + # package=PACKAGE_NAME, setUp=pt.setUp, tearDown=pt.tearDown + # ), + + # functional doctests in files, don't pass setUp/tearDown, except if you + # really know what you are doing... + #sg.FunctionalDocFileSuite('README.txt') + + ] + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') diff --git a/paula.proputil/trunk/src/paula/proputil/utils.py b/paula.proputil/trunk/src/paula/proputil/utils.py new file mode 100644 index 0000000..c15a623 --- /dev/null +++ b/paula.proputil/trunk/src/paula/proputil/utils.py @@ -0,0 +1,183 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from BTrees import OOBTree + +from persistent import Persistent +from persistent.list import PersistentList + +from zope.app.container.contained import Contained + +from zope.component import queryUtility +from zope.component.interfaces import IFactory + +from zope.interface import implements + +from paula.properties.interfaces import IPropertyProvider +from paula.proputil.interfaces import IRWPropertyProviders + + +class RWPropertyProviders(Persistent, Contained): + """Utility delivering IPropertyProviders for principal ids + + IPropertyProvider objects are generated by dynamic adapter lookup from + IPropertyProviderAdaptable objects, which are retrieved from an internal + mapping. Objects enter/leave the mapping through register/unregister. + + Currently we do not support modification of principal id for registered + objects; before doing anything that modifies the prinicipal id of an object, + you need to unregister and reregister the object. + + This utility could be registered globally and works outside of an + application server. However, the adapter lookup for IPropertyProvider + needs to be supported. + + + Mappings are empty, for a new utility + + >>> ppu = RWPropertyProviders() + >>> len(ppu._objs) + 0 + + Suitable objects end up in the mapping, strings work as id + + >>> a = Mock(id = '1') + >>> alsoProvides(a, IPropertyProvider) + >>> ppu.register(a) + >>> len(ppu._objs['1']) + 1 + >>> ppu._objs['1'][0] is a + True + + Object with same id is appended to the same list + + >>> b = Mock(id = '1') + >>> alsoProvides(b, IPropertyProvider) + >>> ppu.register(b) + >>> len(ppu._objs['1']) + 2 + >>> ppu._objs['1'][0] is a + True + >>> ppu._objs['1'][1] is b + True + + Unsuitable object triggers TypeError + + >>> c = Mock(id = '2') + >>> ppu.register(c) # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + blah + TypeError: blah + + Object with different id enters new list + + >>> c = Mock(id = '2') + >>> alsoProvides(c, IPropertyProvider) + >>> ppu.register(c) + >>> len(ppu._objs['2']) + 1 + >>> ppu._objs['2'][0] is c + True + + Objects are retrieved correctly + + >>> ppu['1'][0] is a + True + >>> ppu['1'][1] is b + True + >>> ppu['2'][0] is c + True + + has_key is working + + >>> ppu.has_key('1') + True + >>> ppu.has_key('0') + False + + in operator is working + + >>> '1' in ppu + True + >>> '0' in ppu + False + + list of all keys can be given + + >>> ppu.keys() + ['1', '2'] + + len() is working and contains the number of ids, we have providers for + + >>> len(ppu) + 2 + """ + implements(IRWPropertyProviders) + + def __init__(self): + """ + """ + self._objs = queryUtility(IFactory, 'OOBTree', OOBTree.OOBTree)() + + def __contains__(self, id): + return self.has_key(id) + + def __getitem__(self, id): + """retrieve IPropertyProvider list for principal id + """ + pps = [IPropertyProvider(x) for x in self._objs[id]] + return pps + + def __len__(self): + return self._objs.__len__() + + def has_key(self, id): + # I currently consider this a broken BTree + return bool(self._objs.has_key(id)) + + def keys(self): + # I currently consider this a broken BTree + return list(self._objs.keys()) + + def register(self, obj): + """Register an object. + + It is assumed that an adapter lookup for IPropertyProvider succeeds. + """ + id = IPropertyProvider(obj).id + try: + objs = self._objs[id] + except KeyError: + self._objs[id] = PersistentList() + objs = self._objs[id] + else: + if obj in objs: + return + self._objs[id].append(obj) + + def unregister(self, obj): + """Unregister an object. + + Fails with ValueError, if the object is not registered. + """ + id = IPropertyProvider(obj).id + self._objs[id].remove(obj) diff --git a/paula.suite/trunk/.gitignore b/paula.suite/trunk/.gitignore new file mode 100644 index 0000000..013c539 --- /dev/null +++ b/paula.suite/trunk/.gitignore @@ -0,0 +1,14 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/externals/ +/parts +setup.py.old diff --git a/paula.suite/trunk/README.txt b/paula.suite/trunk/README.txt new file mode 100644 index 0000000..e69de29 diff --git a/paula.suite/trunk/bootstrap.py b/paula.suite/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.suite/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.suite/trunk/buildout.cfg b/paula.suite/trunk/buildout.cfg new file mode 100644 index 0000000..b236504 --- /dev/null +++ b/paula.suite/trunk/buildout.cfg @@ -0,0 +1,20 @@ +[buildout] +develop = . + externals/paula.authentication + externals/paula.authutil + externals/paula.groups + externals/paula.grouputil + externals/paula.properties + externals/paula.proputil + externals/paula.testing + externals/paula.examples +parts = test py + +[test] +recipe = zc.recipe.testrunner +eggs = paula.suite [test] + +[py] +recipe = zc.recipe.egg +interpreter = py +eggs = ${test:eggs} diff --git a/paula.suite/trunk/docs/HISTORY.txt b/paula.suite/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..85cdac5 --- /dev/null +++ b/paula.suite/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.1 - Unreleased +---------------- + +* Initial release + diff --git a/paula.suite/trunk/docs/LICENSE.txt b/paula.suite/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.suite/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.suite/trunk/externals/EXTERNALS.txt b/paula.suite/trunk/externals/EXTERNALS.txt new file mode 100644 index 0000000..26315d9 --- /dev/null +++ b/paula.suite/trunk/externals/EXTERNALS.txt @@ -0,0 +1,8 @@ +paula.authentication https://svn.plone.org/svn/collective/paula/paula.authentication/trunk +paula.authutil https://svn.plone.org/svn/collective/paula/paula.authutil/trunk +paula.groups https://svn.plone.org/svn/collective/paula/paula.groups/trunk +paula.grouputil https://svn.plone.org/svn/collective/paula/paula.grouputil/trunk +paula.properties https://svn.plone.org/svn/collective/paula/paula.properties/trunk +paula.proputil https://svn.plone.org/svn/collective/paula/paula.proputil/trunk +paula.examples https://svn.plone.org/svn/collective/paula/paula.examples/trunk +paula.testing https://svn.plone.org/svn/collective/paula/paula.testing/trunk diff --git a/paula.suite/trunk/setup.cfg b/paula.suite/trunk/setup.cfg new file mode 100644 index 0000000..3c2fdf5 --- /dev/null +++ b/paula.suite/trunk/setup.cfg @@ -0,0 +1,2 @@ +[egg_info] +tag_build = dev diff --git a/paula.suite/trunk/setup.py b/paula.suite/trunk/setup.py new file mode 100644 index 0000000..973ee33 --- /dev/null +++ b/paula.suite/trunk/setup.py @@ -0,0 +1,52 @@ +from setuptools import setup, find_packages +import os + +version = '0.60' + +setup(name='paula.suite', + version=version, + description="Suite of Paula's zope part", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.interface', + 'zope.schema', + 'paula.authentication>=0.59', + 'paula.authutil>=0.59', + 'paula.properties>=0.59', + 'paula.proputil>=0.59', + 'paula.groups>=0.59', + 'paula.grouputil>=0.59', + ], + extras_require=dict( + test = [ + 'paula.testing>=0.59', + 'paula.examples>=0.59', + ], + ), + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.suite/trunk/src/paula/__init__.py b/paula.suite/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.suite/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.suite/trunk/src/paula/suite/README.txt b/paula.suite/trunk/src/paula/suite/README.txt new file mode 100644 index 0000000..2980648 --- /dev/null +++ b/paula.suite/trunk/src/paula/suite/README.txt @@ -0,0 +1,234 @@ +paula.suite package Readme +========================== + +This file serves for documentation and integration testing of all zope3 +based paula packages with a PAU: + - zope.app.authentication.authentication.PluggableAuthentication + - paula.authentication + - paula.authutil + - paula.properties, not yet + - paula.proputil, not yet + - paula.groups, not yet + - paula.grouputil, not yet + - paula.examples + +If you install paula.suite, by calling the apropriate functions, you will +end up with all of these (except paula.examples, which is just pulled in +for testing) in a 'paula' subfolder of a folder of your choice (see below) + +Let's start out with a folder hierarchy containing two nested sites. + + >>> from zope.app.folder import Folder + >>> from zope.app.component import site + + >>> class SubSiteFolder(Folder, site.SiteManagerContainer): + ... pass + >>> subsite = SubSiteFolder() + >>> subsm = site.LocalSiteManager(subsite) + >>> subsite.setSiteManager(subsm) + + >>> root = getRootFolder() + >>> root['subsite'] = subsite + +Make sure that we are really dealing with two different component +registries: + + >>> getSiteManager(root) is not getSiteManager(subsite) + True + + +Let's add a paula.suite, we want it to create a PAU with a kind of fake +credentials plugin, that allows the PAU to authenticate against plain +mappings. + + >>> from paula.suite import createPaulaSuite + +# This is currently not true, but leads to a mess-up +#If we don't pass a container, createPauleSuite registers globally, which +#should be found from the root site manager + +# >>> createPaulaSuite(create_pau=True, create_credplugin=True) + >>> createPaulaSuite(root, create_pau=True, create_credplugin=True) + >>> createPaulaSuite(subsite, create_pau=True, create_credplugin=True) + + +We have now two nested sites, each with a full paula suite. If we add +content, that suffice paula's criteria, it should end up in the +corresponding suite and enable authentication. + +Suitable content is for example MinimalPloneUser from paula.examples, which +we use here (@zope: sorry, no offense meant ;). user1 is added on the upper +level and should end up in root's suite, user2 to the contained level and +should end up in the subsite's suite: + + >>> from zope.component import createObject + + >>> user1 = createObject('paula.examples.MinimalPloneUser', + ... title='user1', + ... password='pass1', + ... email='user1@bar.com', + ... realname='User One', + ... ) + >>> user1_cred = UserDict(login='user1', password='pass1') + >>> root['user1'] = user1 + + + >>> user2 = createObject('paula.examples.MinimalPloneUser', + ... title='user2', + ... password='pass2', + ... email='user2@bar.com', + ... realname='User Two', + ... ) + >>> user2_cred = UserDict(login='user2', password='pass2') + >>> subsite['user2'] = user2 + + +Let's see who is allowed to authenticate where: + + >>> from zope.app.security.interfaces import IAuthentication + + >>> root_pau = getUtility(IAuthentication, context=root) + >>> sub_pau = getUtility(IAuthentication, context=subsite) + + >>> root_pau.authenticate(user1_cred) + Principal('user1') + >>> root_pau.authenticate(user2_cred) is None + True + >>> sub_pau.authenticate(user1_cred) is None + True + >>> sub_pau.authenticate(user2_cred) + Principal('user2') + + +After removing the users, they are not allowed to authenticate anymore: + + >>> del subsite['user2'] + >>> sub_pau.authenticate(user2_cred) is None + True + >>> root_pau.authenticate(user1_cred) + Principal('user1') + >>> del root['user1'] + >>> root_pau.authenticate(user1_cred) is None + True + + +Let's have a closer look at the principals, especially the properties + + >>> root['user1'] = user1 + >>> subsite['user2'] = user2 + +Authenticated principals + + >>> p1 = root_pau.authenticate(user1_cred) + >>> p2 = sub_pau.authenticate(user2_cred) + +There should be an id corresponding to the title, an email and realname, and +password and title may not have made it onto the principal. + + >>> p1.id + 'user1' + >>> p1.email + 'user1@bar.com' + >>> p1.realname + 'User One' + >>> getattr(p1, 'password', 'foo') + 'foo' + >>> getattr(p1, 'name', 'foo') + 'foo' + + >>> p2.id + 'user2' + >>> p2.email + 'user2@bar.com' + >>> p2.realname + 'User Two' + >>> getattr(p2, 'password', 'foo') + 'foo' + >>> getattr(p2, 'name', 'foo') + 'foo' + +The same should be the case for found principals + + >>> p1 = root_pau.getPrincipal('user1') + >>> p2 = sub_pau.getPrincipal('user2') + +With a funny derivation from the .authenticate() behaviour. PAU's +.getPrincipal() hands over to next (higher level) PAU, in case it does not +find the principal. I am not quiet sure what to think of that, currently it +seems like a bug to me... + + >>> sub_pau.getPrincipal('user1') is None + False + +Further, an PrincipalLookupError is raised for principals that could not be +found... + + >>> root_pau.getPrincipal('user2') + Traceback (most recent call last): + foo + PrincipalLookupError: user2 + +At least, the correct principals come back + + >>> p1.id + 'user1' + >>> p1.email + 'user1@bar.com' + >>> p1.realname + 'User One' + >>> getattr(p1, 'password', 'foo') + 'foo' + >>> getattr(p1, 'name', 'foo') + 'foo' + + >>> p2.id + 'user2' + >>> p2.email + 'user2@bar.com' + >>> p2.realname + 'User Two' + >>> getattr(p2, 'password', 'foo') + 'foo' + >>> getattr(p2, 'name', 'foo') + 'foo' + + + +Let's add some groups, for simplicity's sake we currently only support one +level. I have a feeling that my understanding of multiple authentication +levels is currently not congruent with PAU's. + +We only use the subsite, clean the other and ignore what is happening there + +# >>> del root['user1'] +# >>> del root['paula'] +# >>> subsite['user1'] = user1 +# +# >>> user3 = createObject('paula.examples.MinimalPloneUser', +# ... title='user3', +# ... password='pass3', +# ... email='user2@bar.com', +# ... realname='User Two', +# ... ) +# >>> user3_cred = UserDict(login='user3', password='pass3') +# >>> subsite['user3'] = user3 + +There are now three users in the subsite folder: + +# >>> interact( locals() ) +# >>> subsite.keys() + +# >>> group1 = createObject('paula.examples.BasicGroup', +# ... title='group1', +# ... members=('groupuser11', 'groupuser12'), +# ... ) +# >>> group2 = createObject('paula.examples.BasicGroup', +# ... title='group2', +# ... members=('groupuser11', 'groupuser12'), +# ... ) +# >>> user2_cred = UserDict(login='user2', password='pass2') +# >>> subsite['user2'] = user2 + + + +XXX: Should/Need we test whether persistency is working as expected? diff --git a/paula.suite/trunk/src/paula/suite/__init__.py b/paula.suite/trunk/src/paula/suite/__init__.py new file mode 100644 index 0000000..fdd58bf --- /dev/null +++ b/paula.suite/trunk/src/paula/suite/__init__.py @@ -0,0 +1,115 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.app.authentication import principalfolder +from zope.app.authentication.authentication import PluggableAuthentication +from zope.app.authentication.interfaces import IPluggableAuthentication + +from zope.app.security.interfaces import IAuthentication +from zope.app.folder import Folder + +from zope.component import getSiteManager, provideAdapter + +from paula.authentication import LocalAuthenticatorPlugin +from paula.authentication import CredentialsFromMappingPlugin +from paula.authentication.interfaces import ILocalAuthenticatorPlugin +from paula.authentication.interfaces import ICredentialsFromMappingPlugin + +from paula.authutil import RWAuthProviders +from paula.authutil.interfaces import IRWAuthProviders + +from paula.proputil import RWPropertyProviders +from paula.proputil.interfaces import IRWPropertyProviders + +from config import PAULA_AUTHPLUGIN_NAME +from config import PAULA_CREDPLUGIN_NAME + +from persistent import Persistent + +#def createPaulaSuite(container=None, create_pau=False, create_credplug=False): +def createPaulaSuite(container, create_pau=False, create_credplugin=False, + ContainerType=None): + """Creates paula components in the given container and registers them + """ + sm = getSiteManager(container) + + if create_pau and not 'paula_pau' in container: + try: + from OFS.SimpleItem import Item + import Acquisition + import AccessControl.Role + except ImportError: + MyPluggableAuthentication = PluggableAuthentication + else: + class MyPluggableAuthentication( + PluggableAuthentication, + Item, + Acquisition.Implicit, + AccessControl.Role.RoleManager, + ): + def __init__(self): + super(MyPluggableAuthentication, self).__init__() + pau = MyPluggableAuthentication() + container['paula_pau'] = pau + + # register PAU as IAuthentication and IPluggableAuthentication + sm = getSiteManager(container) + sm.registerUtility(pau, IAuthentication) + sm.registerUtility(pau, IPluggableAuthentication) + + # register principal factories needed by PAU + # XXX: bug in zope.app.authentication, we need to register globally + #sm.registerAdapter(principalfolder.AuthenticatedPrincipalFactory) + #sm.registerAdapter(principalfolder.FoundPrincipalFactory) + provideAdapter(principalfolder.AuthenticatedPrincipalFactory) + provideAdapter(principalfolder.FoundPrincipalFactory) + + pau = sm.getUtility(IPluggableAuthentication) + + # Paula's PAU AuthenticatorPlugin + if not 'paula_authplugin' in container: + authplugin = LocalAuthenticatorPlugin() + container['paula_authplugin'] = authplugin + sm.registerUtility( authplugin, + ILocalAuthenticatorPlugin, + name=PAULA_AUTHPLUGIN_NAME, + ) + pau.authenticatorPlugins += (PAULA_AUTHPLUGIN_NAME,) + + if create_credplugin and not 'paula_credplugin' in container: + credplugin = CredentialsFromMappingPlugin() + container['paula_credplugin'] = credplugin + sm.registerUtility( credplugin, + ICredentialsFromMappingPlugin, + name=PAULA_CREDPLUGIN_NAME, + ) + pau.credentialsPlugins += (PAULA_CREDPLUGIN_NAME,) + + if not 'authutil' in container: + authutil = RWAuthProviders() + container['paula_authutil'] = authutil + sm.registerUtility( authutil, IRWAuthProviders) + + if not 'paula_proputil' in container: + proputil = RWPropertyProviders() + container['paula_proputil'] = proputil + sm.registerUtility( proputil, IRWPropertyProviders) diff --git a/paula.suite/trunk/src/paula/suite/config.py b/paula.suite/trunk/src/paula/suite/config.py new file mode 100644 index 0000000..502b9b3 --- /dev/null +++ b/paula.suite/trunk/src/paula/suite/config.py @@ -0,0 +1,26 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.suite" + +PAULA_AUTHPLUGIN_NAME="Paula PAU AuthenticatorPlugin" +PAULA_CREDPLUGIN_NAME="Paula PAU CredentialsFromMappingPlugin" diff --git a/paula.suite/trunk/src/paula/suite/configure.zcml b/paula.suite/trunk/src/paula/suite/configure.zcml new file mode 100644 index 0000000..c2d3f2c --- /dev/null +++ b/paula.suite/trunk/src/paula/suite/configure.zcml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/paula.suite/trunk/src/paula/suite/ftesting.zcml b/paula.suite/trunk/src/paula/suite/ftesting.zcml new file mode 100644 index 0000000..9dda1b3 --- /dev/null +++ b/paula.suite/trunk/src/paula/suite/ftesting.zcml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/paula.suite/trunk/src/paula/suite/tests.py b/paula.suite/trunk/src/paula/suite/tests.py new file mode 100644 index 0000000..f800381 --- /dev/null +++ b/paula.suite/trunk/src/paula/suite/tests.py @@ -0,0 +1,40 @@ +# paula.testing.tests.py +# +# You can simply copy this file to your package and adjust it to your needs +# +# pt.FunctionalDocFileSuite will load your package's ftesting.zcml and +# otherwise setup the same globs as pt.setUp - have a look at __init__.py +""" +""" + +import unittest +#from zope.testing import doctestunit +#from zope.component.testing import setUp + +from paula.testing import get_test_suite, SuiteGenerator + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +sg = SuiteGenerator(PACKAGE_NAME) + +tests = [ + # doctests in all submodules of the package are found by paula.testing + + # doctests in files need to be declared + #doctestunit.DocFileSuite( 'README.txt', + # package=PACKAGE_NAME, setUp=pt.setUp, tearDown=pt.tearDown + # ), + + # functional doctests in files, don't pass setUp/tearDown, except if you + # really know what you are doing... + sg.FunctionalDocFileSuite('README.txt') + + ] + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') diff --git a/paula.testing/trunk/.gitignore b/paula.testing/trunk/.gitignore new file mode 100644 index 0000000..a6609fd --- /dev/null +++ b/paula.testing/trunk/.gitignore @@ -0,0 +1,13 @@ +*.pyc +.*.swp +.*.swo +.swp +.swo +*.egg-info +/.installed.cfg +/bin +/build +/develop-eggs +/dist +/parts +setup.py.old diff --git a/paula.testing/trunk/README.txt b/paula.testing/trunk/README.txt new file mode 100644 index 0000000..b4ecd10 --- /dev/null +++ b/paula.testing/trunk/README.txt @@ -0,0 +1,5 @@ +Introduction +============ + +paula.testing provides get_test_suite, that searches your package recursively, +finds all python files and registers contained unit tests for testing. diff --git a/paula.testing/trunk/bootstrap.py b/paula.testing/trunk/bootstrap.py new file mode 100644 index 0000000..e2facc9 --- /dev/null +++ b/paula.testing/trunk/bootstrap.py @@ -0,0 +1,52 @@ +############################################################################## +# +# Copyright (c) 2006 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 72703 2007-02-20 11:49:26Z jim $ +""" + +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) diff --git a/paula.testing/trunk/buildout.cfg b/paula.testing/trunk/buildout.cfg new file mode 100644 index 0000000..346652c --- /dev/null +++ b/paula.testing/trunk/buildout.cfg @@ -0,0 +1,12 @@ +[buildout] +develop = . +parts = test py + +[test] +recipe = zc.recipe.testrunner +eggs = paula.testing + +[py] +recipe = zc.recipe.egg +interpreter = py +eggs = ${test:eggs} diff --git a/paula.testing/trunk/docs/HISTORY.txt b/paula.testing/trunk/docs/HISTORY.txt new file mode 100644 index 0000000..b5b20d8 --- /dev/null +++ b/paula.testing/trunk/docs/HISTORY.txt @@ -0,0 +1,8 @@ +Changelog +========= + +0.81 +---- + +* Initial release + diff --git a/paula.testing/trunk/docs/LICENSE.GPL b/paula.testing/trunk/docs/LICENSE.GPL new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/paula.testing/trunk/docs/LICENSE.GPL @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/paula.testing/trunk/docs/LICENSE.txt b/paula.testing/trunk/docs/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/paula.testing/trunk/docs/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/paula.testing/trunk/setup.py b/paula.testing/trunk/setup.py new file mode 100644 index 0000000..99cb5c8 --- /dev/null +++ b/paula.testing/trunk/setup.py @@ -0,0 +1,41 @@ +from setuptools import setup, find_packages +import os + +version = '0.81' + +setup(name='paula.testing', + version=version, + description="Paula testing framework", + long_description=open("README.txt").read() + "\n" + + open(os.path.join("docs", "HISTORY.txt")).read(), + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers = [ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + 'Framework :: Zope3'], + keywords='', + author='Florian Friesdorf', + author_email='flo@chaoflow.net', + url='https://chaoflow.net/projects/gsoc2008/z3membrane-ldap', + license='AGPL', + packages = find_packages('src'), + package_dir = {'': 'src'}, + namespace_packages=['paula'], + include_package_data=True, + zip_safe=False, + install_requires=[ + 'setuptools', + # -*- Extra requirements: -*- + 'zope.app.testing', + 'zope.component', + 'zope.testing', + ], + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/paula.testing/trunk/src/paula/__init__.py b/paula.testing/trunk/src/paula/__init__.py new file mode 100644 index 0000000..f48ad10 --- /dev/null +++ b/paula.testing/trunk/src/paula/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/paula.testing/trunk/src/paula/testing/README.txt b/paula.testing/trunk/src/paula/testing/README.txt new file mode 100644 index 0000000..6a64c8e --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/README.txt @@ -0,0 +1,13 @@ +A sample integration test, our zcml should have been loaded + + >>> from paula.testing.module import ISomeObjectUtility + + >>> u = getUtility(ISomeObjectUtility) + >>> u.name + 'some object utility' + + +Thx to jensens you can get an interactive prompt in your tests +(waiting to be packaged as an egg!) + + >>> interact( locals() ) diff --git a/paula.testing/trunk/src/paula/testing/__init__.py b/paula.testing/trunk/src/paula/testing/__init__.py new file mode 100644 index 0000000..03462b8 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/__init__.py @@ -0,0 +1,26 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from paula.testing.testing import get_test_suite +from paula.testing.testing import test_globs +from paula.testing.testing import SuiteGenerator +from paula.testing.testing import setUp, tearDown diff --git a/paula.testing/trunk/src/paula/testing/config.py b/paula.testing/trunk/src/paula/testing/config.py new file mode 100644 index 0000000..ec15c65 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/config.py @@ -0,0 +1,23 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +PACKAGE_NAME="paula.testing" diff --git a/paula.testing/trunk/src/paula/testing/configure.zcml b/paula.testing/trunk/src/paula/testing/configure.zcml new file mode 100644 index 0000000..e06c9e7 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/configure.zcml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/paula.testing/trunk/src/paula/testing/ftesting.zcml b/paula.testing/trunk/src/paula/testing/ftesting.zcml new file mode 100644 index 0000000..042a087 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/ftesting.zcml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/paula.testing/trunk/src/paula/testing/interact.py b/paula.testing/trunk/src/paula/testing/interact.py new file mode 100644 index 0000000..19f0f16 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/interact.py @@ -0,0 +1,37 @@ +# +# Copyright 2008, BlueDynamics Alliance, Austria - http://bluedynamics.com +# +# GNU General Public Licence Version 2 or later - see LICENCE.GPL + +__author__ = """Jens Klein """ +__docformat__ = 'plaintext' + +import code +import sys + +def interact(locals=None): + """Provides an interactive shell aka console inside your testcase. + + It looks exact like in a doctestcase and you can copy and paste + code from the shell into your doctest. The locals in the testcase are + available, because you are _in_ the testcase. + + In your testcase or doctest you can invoke the shell at any point by + calling:: + + >>> interact( locals() ) + + locals -- passed to InteractiveInterpreter.__init__() + """ + savestdout = sys.stdout + sys.stdout = sys.stderr + sys.stderr.write('\n'+'='*75) + console = code.InteractiveConsole(locals) + console.interact(""" +DocTest Interactive Console - (c) BlueDynamics Alliance, Austria, 2006-2008 +Note: You have the same locals available as in your test-case. +Ctrl-D ends session and continues testing. +""") + sys.stdout.write('\nend of DocTest Interactive Console session\n') + sys.stdout.write('='*75+'\n') + sys.stdout = savestdout diff --git a/paula.testing/trunk/src/paula/testing/module.py b/paula.testing/trunk/src/paula/testing/module.py new file mode 100644 index 0000000..8d1ba0e --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/module.py @@ -0,0 +1,36 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +from zope.interface import implements, Interface + +class ISomeObjectUtility(Interface): + pass + +class SomeObject(object): + """ + This is an example test, that just should be found by paula.testing + + >>> 1 + 1 + 2 + """ + implements(ISomeObjectUtility) + name = 'some object utility' diff --git a/paula.testing/trunk/src/paula/testing/package/__init__.py b/paula.testing/trunk/src/paula/testing/package/__init__.py new file mode 100644 index 0000000..d7e97a9 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/package/__init__.py @@ -0,0 +1,22 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + diff --git a/paula.testing/trunk/src/paula/testing/package/module.py b/paula.testing/trunk/src/paula/testing/package/module.py new file mode 100644 index 0000000..eb8a6fc --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/package/module.py @@ -0,0 +1,27 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +def test(): + """ + >>> 3 + 3 + 6 + """ diff --git a/paula.testing/trunk/src/paula/testing/package/subpackage/__init__.py b/paula.testing/trunk/src/paula/testing/package/subpackage/__init__.py new file mode 100644 index 0000000..d7e97a9 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/package/subpackage/__init__.py @@ -0,0 +1,22 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + diff --git a/paula.testing/trunk/src/paula/testing/package/subpackage/module.py b/paula.testing/trunk/src/paula/testing/package/subpackage/module.py new file mode 100644 index 0000000..a3d24d7 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/package/subpackage/module.py @@ -0,0 +1,27 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +def test(): + """ + >>> 2 + 3 + 5 + """ diff --git a/paula.testing/trunk/src/paula/testing/testing.py b/paula.testing/trunk/src/paula/testing/testing.py new file mode 100644 index 0000000..d0ed4b1 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/testing.py @@ -0,0 +1,266 @@ +# Copyright (c) 2008 by Florian Friesdorf +# +# GNU Affero General Public License (AGPL) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# . +""" +""" +__author__ = "Florian Friesdorf " +__docformat__ = "plaintext" + +import os +import os.path +import unittest + +from zope.app.testing.functional import ZCMLLayer, FunctionalDocFileSuite +from zope.component import testing + +from zope.testing import doctest +from zope.testing import doctestunit + +# --- stuff for globs ------------------------------------------------- + +from UserDict import UserDict +from UserList import UserList + +from zope.component import provideAdapter, provideUtility +from zope.component import adapts +from zope.component import getUtility, queryUtility +from zope.component import getSiteManager + +from zope.interface import alsoProvides, implements, providedBy +from zope.interface import Interface, Attribute + +from paula.testing import interact + +class Mock(object): + """a mock object that carries desired interfaces + + >>> class IA(Interface): + ... pass + + >>> class IB(Interface): + ... pass + + >>> m = Mock( a = 1, f = lambda : 2, alsoProvides=(IA,IB)) + >>> m.a + 1 + >>> m.f() + 2 + >>> IA.providedBy(m) + True + """ + implements(Interface) + def __init__(self, **kwargs): + if kwargs.has_key('alsoProvides'): + alsoProvides(self, *kwargs['alsoProvides']) + del kwargs['alsoProvides'] + for k,v in kwargs.items(): + setattr(self, k, v) + +test_globs = dict( + Attribute = Attribute, + Interface = Interface, + Mock = Mock, + UserDict = UserDict, + UserList = UserList, + adapts = adapts, + alsoProvides = alsoProvides, + getUtility = getUtility, + getSiteManager = getSiteManager, + interact = interact.interact, + implements = implements, + provideAdapter = provideAdapter, + provideUtility = provideUtility, + providedBy = providedBy, + queryUtility = queryUtility, + ) + +def setUp(test): + """We can use this to set up anything that needs to be available for + each test. It is run before each test, i.e. for each docstring that + contains doctests. + + Look at the Python unittest and doctest module documentation to learn + more about how to prepare state and pass it into various tests. + + >>> m = Mock() + >>> class IA(Interface): + ... pass + + >>> alsoProvides(m, IA) + >>> providedBy(m) is not None + True + + >>> provideUtility(m, IA) + + >>> class A(object): + ... adapts(Interface) + ... implements(IA) + + >>> provideAdapter(A) + """ + testing.setUp(test) + for k,v in test_globs.items(): + test.globs[k] = v + + +def tearDown(test): + """ + """ + testing.tearDown(test) + + +def my_import(name): + mod = __import__(name) + components = name.split('.') + for x in components[1:]: + mod = getattr(mod, x) + return mod + + +def recurse(*args): + """returns all modules, that contain doctests + + returns all doctests found within the modules passed in *args + + For paula.testing itself, recurse should find 8 modules containing tests: + + >>> to_test = recurse('paula.testing') + >>> len(to_test) + 9 + """ + result = [] + for name in args: + mod = my_import(name) + result += [mod] + modname = mod.__file__.replace('.pyc','').replace('.py','') + if modname.endswith('__init__'): + # a subpackage + dirname = os.path.dirname(mod.__file__) + dirlist = os.listdir(dirname) + # iterate over content of current directory + for x in dirlist: + fullpath = os.path.join(dirname, x) + # if neither directory nor .py file, skip it + if not (os.path.isdir(fullpath) or x.endswith('.py')): + continue + + # skip directories, that are not packages + if os.path.isdir(fullpath) and not \ + os.path.isfile(os.path.join(fullpath, '__init__.py')): + continue + + # get rid of .py ending + x = x.replace('.py','') + + # skip if it starts with a dot + if x.startswith('.'): + continue + + # skip __init__.py, it _is_ the current package, which was + # added above: result += [mod] + if x == "__init__": + continue + + # don't test tests/ and tests.py, XXX: why not? + if x == "tests": + continue + + mod_name = '%s.%s' % (name, x) + result += recurse(mod_name) + return result + + +# XXX: this could be moved inside the SuiteGenerator +def get_test_suite(pkg_name, tests=[]): + """construct a test suite for a package + + recurses through a package and returns a test suite consisting of all + doctest found + the tests passed as argument + """ + def test_suite(): + to_test = recurse(pkg_name,) + optionflags = \ + doctest.REPORT_ONLY_FIRST_FAILURE + \ + doctest.ELLIPSIS + \ + doctest.NORMALIZE_WHITESPACE + unit_tests = [] + for x in to_test: + unit_test = doctestunit.DocTestSuite(x, + setUp=setUp, tearDown=tearDown, + optionflags=optionflags + ) + unit_tests.append(unit_test) + test_suite = unittest.TestSuite(unit_tests + tests) + return test_suite + + return test_suite + + +# TestSuite/Cases loading ftesting.zcml +# taken from a zopeproject generated testing.py - thank you + +#ftesting_zcml = os.path.join(os.path.dirname(__file__), 'ftesting.zcml') +#FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer') + +class SuiteGenerator(object): + """ + """ + def __init__(self, package_name): + self.package_name = package_name + self.package = my_import(package_name) + self.package_dir = os.path.dirname(self.package.__file__) + self.ftesting_zcml = os.path.join(self.package_dir, 'ftesting.zcml') + try: + self.FunctionalLayer = ZCMLLayer( + self.ftesting_zcml, + package_name, + 'FunctionalLayer', + allow_teardown=True, + ) + except TypeError: + self.FunctionalLayer = ZCMLLayer( + self.ftesting_zcml, + package_name, + 'FunctionalLayer', + ) + + @property + def FunctionalDocFileSuite(self): + + def myFunctionalDocFileSuite(path, **kw): + if not 'package' in kw: + kw['package'] = self.package_name + suite = FunctionalDocFileSuite(path, globs=test_globs, **kw) + suite.layer = self.FunctionalLayer + return suite + + return myFunctionalDocFileSuite + + + +# we currently don't care about these + +#class FunctionalTestCase(FunctionalTestCase): +# layer = FunctionalLayer + + +#def FunctionalDocTestSuite(module=None, **kw): +# module = doctest._normalize_module(module) +# suite = FunctionalDocTestSuite(module, globs=test_globs, **kw) +# suite.layer = FunctionalLayer +# return suite + diff --git a/paula.testing/trunk/src/paula/testing/tests.py b/paula.testing/trunk/src/paula/testing/tests.py new file mode 100644 index 0000000..f800381 --- /dev/null +++ b/paula.testing/trunk/src/paula/testing/tests.py @@ -0,0 +1,40 @@ +# paula.testing.tests.py +# +# You can simply copy this file to your package and adjust it to your needs +# +# pt.FunctionalDocFileSuite will load your package's ftesting.zcml and +# otherwise setup the same globs as pt.setUp - have a look at __init__.py +""" +""" + +import unittest +#from zope.testing import doctestunit +#from zope.component.testing import setUp + +from paula.testing import get_test_suite, SuiteGenerator + +# XXX: this could be derived from __name__, but then it would not work, +# if being called as __main__ (see bottom) - is that needed? +# eventually we could then derive it from path?! +from config import PACKAGE_NAME + +sg = SuiteGenerator(PACKAGE_NAME) + +tests = [ + # doctests in all submodules of the package are found by paula.testing + + # doctests in files need to be declared + #doctestunit.DocFileSuite( 'README.txt', + # package=PACKAGE_NAME, setUp=pt.setUp, tearDown=pt.tearDown + # ), + + # functional doctests in files, don't pass setUp/tearDown, except if you + # really know what you are doing... + sg.FunctionalDocFileSuite('README.txt') + + ] + +test_suite = get_test_suite(PACKAGE_NAME, tests) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') -- 2.11.4.GIT