[Checkins] SVN: zope.app.principalannotation/tags/3.6.0/ Tag 3.6.0
Dan Korostelev
nadako at gmail.com
Mon Mar 9 11:10:32 EDT 2009
Log message for revision 97701:
Tag 3.6.0
Changed:
A zope.app.principalannotation/tags/3.6.0/
D zope.app.principalannotation/tags/3.6.0/CHANGES.txt
A zope.app.principalannotation/tags/3.6.0/CHANGES.txt
D zope.app.principalannotation/tags/3.6.0/README.txt
A zope.app.principalannotation/tags/3.6.0/README.txt
D zope.app.principalannotation/tags/3.6.0/buildout.cfg
A zope.app.principalannotation/tags/3.6.0/buildout.cfg
D zope.app.principalannotation/tags/3.6.0/setup.py
A zope.app.principalannotation/tags/3.6.0/setup.py
D zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/__init__.py
A zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/__init__.py
D zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.py
A zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.py
D zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.zcml
A zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.zcml
D zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/configure.zcml
A zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/configure.zcml
D zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/interfaces.py
A zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/interfaces.py
D zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/tests.py
A zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/tests.py
-=-
Deleted: zope.app.principalannotation/tags/3.6.0/CHANGES.txt
===================================================================
--- zope.app.principalannotation/trunk/CHANGES.txt 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/CHANGES.txt 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,30 +0,0 @@
-=======
-CHANGES
-=======
-
-3.5.2 (unreleased)
-------------------
-
-- ...
-
-3.5.1 (2009-03-06)
-------------------
-
-- Make boostrap subscriber called on IDatabaseOpenedWithRootEvent
- instead of IDatabaseOpenedEvent, because this can cause bug if
- subscriber will be called before root object is created.
-
-- Use zope.site instead of zope.app.component.
-
-3.5.0 (2009-02-01)
-------------------
-
-- Move boostrap subscriber to bootstrap.zcml file and browser
- menu item definition to browser.zcml file to ease overriding
- and excluding configuration.
-- Use zope.container instead of zope.app.container.
-
-3.4.0 (2007-10-26)
-------------------
-
-- Initial release independent of the main Zope tree.
Copied: zope.app.principalannotation/tags/3.6.0/CHANGES.txt (from rev 97700, zope.app.principalannotation/trunk/CHANGES.txt)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/CHANGES.txt (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/CHANGES.txt 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,33 @@
+=======
+CHANGES
+=======
+
+3.6.0 (2009-03-09)
+------------------
+
+- Most of functionality is now moved to the ``zope.principalannotation``
+ package. This package now only provides the bootstrap subscriber
+ for the `zope3 application server` as well as browser menu item for
+ adding PrincipalAnnotationUtility using ZMI.
+
+3.5.1 (2009-03-06)
+------------------
+
+- Make boostrap subscriber called on IDatabaseOpenedWithRootEvent
+ instead of IDatabaseOpenedEvent, because this can cause bug if
+ subscriber will be called before root object is created.
+
+- Use zope.site instead of zope.app.component.
+
+3.5.0 (2009-02-01)
+------------------
+
+- Move boostrap subscriber to bootstrap.zcml file and browser
+ menu item definition to browser.zcml file to ease overriding
+ and excluding configuration.
+- Use zope.container instead of zope.app.container.
+
+3.4.0 (2007-10-26)
+------------------
+
+- Initial release independent of the main Zope tree.
Deleted: zope.app.principalannotation/tags/3.6.0/README.txt
===================================================================
--- zope.app.principalannotation/trunk/README.txt 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/README.txt 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,3 +0,0 @@
-This package implements annotations for Zope security principals. Common
-annotation techniques, like AttributeAnnotations cannot be applied to
-principals, since they are created on the fly for every request.
Copied: zope.app.principalannotation/tags/3.6.0/README.txt (from rev 97695, zope.app.principalannotation/trunk/README.txt)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/README.txt (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/README.txt 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,5 @@
+This package used to provide implementation of IAnnotations for zope.security
+principal objects, but it's now moved to the ``zope.principalannotation``
+package. This package only contains a bootstrap subscriber that sets up
+the principal annotation utility for the root site and the browser add
+menu item for adding the annotation utility through ZMI.
Deleted: zope.app.principalannotation/tags/3.6.0/buildout.cfg
===================================================================
--- zope.app.principalannotation/trunk/buildout.cfg 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/buildout.cfg 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,8 +0,0 @@
-[buildout]
-develop = .
-parts = test
-
-[test]
-recipe = zc.recipe.testrunner
-eggs = zope.app.principalannotation [test]
-
Copied: zope.app.principalannotation/tags/3.6.0/buildout.cfg (from rev 97700, zope.app.principalannotation/trunk/buildout.cfg)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/buildout.cfg (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/buildout.cfg 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,8 @@
+[buildout]
+develop = .
+parts = test
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = zope.app.principalannotation [test]
+
Deleted: zope.app.principalannotation/tags/3.6.0/setup.py
===================================================================
--- zope.app.principalannotation/trunk/setup.py 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/setup.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,64 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Setup for zope.app.principalannotation package
-
-$Id$
-"""
-import os
-from setuptools import setup, find_packages
-
-def read(*rnames):
- return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-
-setup(name='zope.app.principalannotation',
- version = '3.5.2dev',
- author='Zope Corporation and Contributors',
- author_email='zope-dev at zope.org',
- description='Annotations for Zope Principals',
- long_description=(
- read('README.txt')
- + '\n\n' +
- read('CHANGES.txt')
- ),
- keywords = "zope3 annotation principal publisher",
- classifiers = [
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Web Environment',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Zope Public License',
- 'Programming Language :: Python',
- 'Natural Language :: English',
- 'Operating System :: OS Independent',
- 'Topic :: Internet :: WWW/HTTP',
- 'Framework :: Zope3'],
- url='http://pypi.python.org/pypi/zope.app.principalannotation',
- license='ZPL 2.1',
- packages=find_packages('src'),
- package_dir = {'': 'src'},
- namespace_packages=['zope', 'zope.app'],
- extras_require = dict(test=['zope.app.testing']),
- install_requires=['setuptools',
- 'zope.annotation',
- 'zope.app.appsetup',
- 'zope.component',
- 'zope.container',
- 'zope.interface',
- 'zope.location',
- 'zope.security',
- 'zope.site',
- 'ZODB3',
- ],
- include_package_data = True,
- zip_safe = False,
- )
Copied: zope.app.principalannotation/tags/3.6.0/setup.py (from rev 97695, zope.app.principalannotation/trunk/setup.py)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/setup.py (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/setup.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Setup for zope.app.principalannotation package
+
+$Id$
+"""
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+setup(name='zope.app.principalannotation',
+ version = '3.6.0',
+ author='Zope Corporation and Contributors',
+ author_email='zope-dev at zope.org',
+ description='Bootstrap subscriber and browser menu item for zope.principalannotation',
+ long_description=(
+ read('README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ keywords = "zope security principal annotation",
+ classifiers = [
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Framework :: Zope3'],
+ url='http://pypi.python.org/pypi/zope.app.principalannotation',
+ license='ZPL 2.1',
+ packages=find_packages('src'),
+ package_dir = {'': 'src'},
+ namespace_packages=['zope', 'zope.app'],
+ extras_require = dict(test=['zope.testing']),
+ install_requires=['setuptools',
+ 'zope.app.appsetup',
+ 'zope.app.publisher',
+ 'zope.principalannotation',
+ ],
+ include_package_data = True,
+ zip_safe = False,
+ )
Deleted: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/__init__.py
===================================================================
--- zope.app.principalannotation/trunk/src/zope/app/principalannotation/__init__.py 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/__init__.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,142 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 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.
-#
-##############################################################################
-"""Implementation of `IPrincipalAnnotationUtility`.
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-# TODO: register utility as adapter for IAnnotations on utility activation.
-
-from persistent import Persistent
-from persistent.dict import PersistentDict
-from BTrees.OOBTree import OOBTree
-import zope.security.interfaces
-from zope import interface, component
-from zope.annotation.interfaces import IAnnotations
-from zope.container.contained import Contained
-from zope.location import Location
-from zope.site.next import queryNextUtility
-
-from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
-
-class PrincipalAnnotationUtility(Persistent, Contained):
- """Stores `IAnnotations` for `IPrinicipals`.
-
- The utility ID is 'PrincipalAnnotation'.
- """
-
- interface.implements(IPrincipalAnnotationUtility)
-
- def __init__(self):
- self.annotations = OOBTree()
-
- def getAnnotations(self, principal):
- """Return object implementing IAnnotations for the given principal.
-
- If there is no `IAnnotations` it will be created and then returned.
- """
- return self.getAnnotationsById(principal.id)
-
- def getAnnotationsById(self, principalId):
- """Return object implementing `IAnnotations` for the given principal.
-
- If there is no `IAnnotations` it will be created and then returned.
- """
-
- annotations = self.annotations.get(principalId)
- if annotations is None:
- annotations = Annotations(principalId, store=self.annotations)
- annotations.__parent__ = self
- annotations.__name__ = principalId
-
- return annotations
-
- def hasAnnotations(self, principal):
- """Return boolean indicating if given principal has `IAnnotations`."""
- return principal.id in self.annotations
-
-
-class Annotations(Persistent, Location):
- """Stores annotations."""
-
- interface.implements(IAnnotations)
-
- def __init__(self, principalId, store=None):
- self.principalId = principalId
- self.data = PersistentDict() # We don't really expect that many
-
- # _v_store is used to remember a mapping object that we should
- # be saved in if we ever change
- self._v_store = store
-
- def __getitem__(self, key):
- try:
- return self.data[key]
- except KeyError:
- # We failed locally: delegate to a higher-level utility.
- utility = queryNextUtility(self, IPrincipalAnnotationUtility)
- if utility is not None:
- annotations = utility.getAnnotationsById(self.principalId)
- return annotations[key]
- raise
-
- def __setitem__(self, key, value):
- if getattr(self, '_v_store', None) is not None:
- # _v_store is used to remember a mapping object that we should
- # be saved in if we ever change
- self._v_store[self.principalId] = self
- del self._v_store
-
- self.data[key] = value
-
- def __delitem__(self, key):
- del self.data[key]
-
- def get(self, key, default=None):
- return self.data.get(key, default)
-
-def annotations(principal, context=None):
- """adapt principal to annotations via principal annotation utility.
-
- To illustrate, we'll register the adapter and a dummy
- principal annotation utility.
-
- >>> component.provideAdapter(annotations)
- >>> class DummyPrincipal(object):
- ... interface.implements(zope.security.interfaces.IPrincipal)
- ... def __init__(self, id, title=None, description=None):
- ... self.id = id
- ... self.title = title
- ... self.description = description
- ...
- >>> dummy_annotation = {}
- >>> class DummyPAU(object):
- ... interface.implements(interfaces.IPrincipalAnnotationUtility)
- ... def getAnnotations(self, principal):
- ... if principal.id == 'sue':
- ... return dummy_annotation
- ... raise NotImplementedError
- ...
- >>> pau = DummyPAU()
- >>> component.provideUtility(pau)
- >>> sue = DummyPrincipal('sue')
- >>> annotation = IAnnotations(sue)
- >>> annotation is dummy_annotation
- True
- """ # TODO move this out to a doctest file when we have one...
- utility = component.getUtility(IPrincipalAnnotationUtility, context=context)
- return utility.getAnnotations(principal)
-component.adapter(zope.security.interfaces.IPrincipal)(annotations)
-interface.implementer(IAnnotations)(annotations)
Copied: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/__init__.py (from rev 97695, zope.app.principalannotation/trunk/src/zope/app/principalannotation/__init__.py)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/__init__.py (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/__init__.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,23 @@
+##############################################################################
+#
+# Copyright (c) 2009 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.
+#
+##############################################################################
+"""Implementation of `IPrincipalAnnotationUtility`.
+
+$Id$
+"""
+
+# BBB: the functionality was moved to zope.principalannotation
+from zope.principalannotation.utility import (
+ PrincipalAnnotationUtility,
+ Annotations,
+ annotations)
Deleted: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.py
===================================================================
--- zope.app.principalannotation/trunk/src/zope/app/principalannotation/bootstrap.py 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,39 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2002, 2004 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 code for principal annotation utility.
-
-$Id$
-"""
-
-import transaction
-
-from zope.app.appsetup.bootstrap import ensureUtility, getInformationFromEvent
-
-from zope.app.principalannotation import PrincipalAnnotationUtility
-from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
-
-def bootStrapSubscriber(event):
- """Subscriber to the IDatabaseOpenedWithRootEvent
-
- Create utility at that time if not yet present
- """
-
- db, connection, root, root_folder = getInformationFromEvent(event)
-
- ensureUtility(root_folder, IPrincipalAnnotationUtility,
- 'PrincipalAnnotation', PrincipalAnnotationUtility,
- asObject=True)
-
- transaction.commit()
- connection.close()
Copied: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.py (from rev 97695, zope.app.principalannotation/trunk/src/zope/app/principalannotation/bootstrap.py)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.py (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,39 @@
+##############################################################################
+#
+# Copyright (c) 2009 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 code for principal annotation utility.
+
+$Id$
+"""
+
+import transaction
+
+from zope.app.appsetup.bootstrap import ensureUtility, getInformationFromEvent
+
+from zope.principalannotation.utility import PrincipalAnnotationUtility
+from zope.principalannotation.interfaces import IPrincipalAnnotationUtility
+
+def bootStrapSubscriber(event):
+ """Subscriber to the IDatabaseOpenedWithRootEvent
+
+ Create utility at that time if not yet present
+ """
+
+ db, connection, root, root_folder = getInformationFromEvent(event)
+
+ ensureUtility(root_folder, IPrincipalAnnotationUtility,
+ 'PrincipalAnnotation', PrincipalAnnotationUtility,
+ asObject=True)
+
+ transaction.commit()
+ connection.close()
Deleted: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.zcml
===================================================================
--- zope.app.principalannotation/trunk/src/zope/app/principalannotation/bootstrap.zcml 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.zcml 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,11 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser"
- >
-
- <subscriber
- for="zope.app.appsetup.interfaces.IDatabaseOpenedWithRootEvent"
- handler=".bootstrap.bootStrapSubscriber"
- />
-
-</configure>
Copied: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.zcml (from rev 97695, zope.app.principalannotation/trunk/src/zope/app/principalannotation/bootstrap.zcml)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.zcml (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/bootstrap.zcml 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,8 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+ <subscriber
+ for="zope.app.appsetup.interfaces.IDatabaseOpenedWithRootEvent"
+ handler=".bootstrap.bootStrapSubscriber"
+ />
+
+</configure>
Deleted: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/configure.zcml
===================================================================
--- zope.app.principalannotation/trunk/src/zope/app/principalannotation/configure.zcml 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/configure.zcml 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,29 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser"
- >
-
- <class class=".PrincipalAnnotationUtility">
- <factory
- id="zope.app.PrincipalAnnotationUtility"
- />
- <implements
- interface="zope.annotation.interfaces.IAttributeAnnotatable"
- />
- <require
- permission="zope.View"
- interface=".interfaces.IPrincipalAnnotationUtility"
- />
- </class>
-
- <adapter factory=".annotations" />
-
- <adapter
- for="zope.security.interfaces.IPrincipal *"
- factory=".annotations"
- />
-
- <include file="bootstrap.zcml" />
- <include file="browser.zcml" />
-
-</configure>
Copied: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/configure.zcml (from rev 97695, zope.app.principalannotation/trunk/src/zope/app/principalannotation/configure.zcml)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/configure.zcml (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/configure.zcml 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,7 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+ <include package="zope.principalannotation" />
+ <include file="bootstrap.zcml" />
+ <include file="browser.zcml" />
+
+</configure>
Deleted: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/interfaces.py
===================================================================
--- zope.app.principalannotation/trunk/src/zope/app/principalannotation/interfaces.py 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/interfaces.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,42 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 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.
-#
-##############################################################################
-"""Utility for storing `IAnnotations` for principals.
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-from zope.interface import Interface
-
-
-class IPrincipalAnnotationUtility(Interface):
- """Stores `IAnnotations` for `IPrinicipals`."""
-
- def getAnnotations(principal):
- """Return object implementing `IAnnotations` for the given
- `IPrinicipal`.
-
- If there is no `IAnnotations` it will be created and then returned.
- """
-
- def getAnnotationsById(principalId):
- """Return object implementing `IAnnotations` for the given
- `prinicipalId`.
-
- If there is no `IAnnotations` it will be created and then returned.
- """
-
- def hasAnnotations(principal):
- """Return boolean indicating if given `IPrincipal` has
- `IAnnotations`."""
Copied: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/interfaces.py (from rev 97695, zope.app.principalannotation/trunk/src/zope/app/principalannotation/interfaces.py)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/interfaces.py (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/interfaces.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,18 @@
+##############################################################################
+#
+# Copyright (c) 2009 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.
+#
+##############################################################################
+"""Utility for storing `IAnnotations` for principals.
+
+$Id$
+"""
+from zope.principalannotation.interfaces import IPrincipalAnnotationUtility # BBB
Deleted: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/tests.py
===================================================================
--- zope.app.principalannotation/trunk/src/zope/app/principalannotation/tests.py 2009-03-09 11:06:06 UTC (rev 97689)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/tests.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -1,93 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 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.
-#
-##############################################################################
-"""Principal Annotation Tests
-
-$Id$
-"""
-from zope.testing import doctest
-from unittest import TestCase, TestLoader, TextTestRunner
-
-import zope.component
-from zope.interface import implements
-from zope.security.interfaces import IPrincipal
-
-from zope.app.principalannotation import PrincipalAnnotationUtility
-from zope.app.component.testing import PlacefulSetup
-from zope.app.testing import setup
-from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
-
-class Principal(object):
- implements(IPrincipal)
-
- def __init__(self, id):
- self.id = id
-
-
-class PrincipalAnnotationTests(PlacefulSetup, TestCase):
-
- def setUp(self):
- PlacefulSetup.setUp(self)
- sm = self.buildFolders(site='/')
- self.util = PrincipalAnnotationUtility()
- zope.component.provideUtility(self.util, IPrincipalAnnotationUtility)
-
- def testGetSimple(self):
- prince = Principal('somebody')
- self.assert_(not self.util.hasAnnotations(prince))
-
- princeAnnotation = self.util.getAnnotations(prince)
- # Just getting doesn't actualy store. We don't want to store unless
- # we make a change.
- self.assert_(not self.util.hasAnnotations(prince))
-
- princeAnnotation['something'] = 'whatever'
-
- # But now we should have the annotation:
- self.assert_(self.util.hasAnnotations(prince))
-
- def testGetFromLayered(self):
- princeSomebody = Principal('somebody')
- sm1 = self.makeSite('folder1')
- subUtil = setup.addUtility(sm1, '', IPrincipalAnnotationUtility,
- PrincipalAnnotationUtility())
-
- parentAnnotation = self.util.getAnnotations(princeSomebody)
-
- # Just getting doesn't actualy store. We don't want to store unless
- # we make a change.
- self.assert_(not subUtil.hasAnnotations(princeSomebody))
-
- parentAnnotation['hair_color'] = 'blue'
-
- # But now we should have the annotation:
- self.assert_(self.util.hasAnnotations(princeSomebody))
-
- subAnnotation = subUtil.getAnnotations(princeSomebody)
- self.assertEquals(subAnnotation['hair_color'], 'blue')
-
- subAnnotation['foo'] = 'bar'
-
- self.assertEquals(parentAnnotation.get("foo"), None)
-
-def test_suite():
- loader=TestLoader()
- tests = loader.loadTestsFromTestCase(PrincipalAnnotationTests)
- import zope.app.principalannotation
- tests.addTest(doctest.DocTestSuite(zope.app.principalannotation,
- setUp=setup.placelessSetUp,
- tearDown=setup.placelessTearDown))
- return tests
-
-if __name__=='__main__':
- TextTestRunner().run(test_suite())
Copied: zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/tests.py (from rev 97695, zope.app.principalannotation/trunk/src/zope/app/principalannotation/tests.py)
===================================================================
--- zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/tests.py (rev 0)
+++ zope.app.principalannotation/tags/3.6.0/src/zope/app/principalannotation/tests.py 2009-03-09 15:10:31 UTC (rev 97701)
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 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.
+#
+##############################################################################
+"""Principal Annotation Tests
+
+$Id$
+"""
+import unittest
+from zope.testing import doctest
+
+def test_bbb_imports():
+ """
+ The most of functionality was moved to zope.principalannotation.
+ Let's test if old imports still work::
+
+ >>> from zope.app.principalannotation.interfaces import IPrincipalAnnotationUtility
+ >>> IPrincipalAnnotationUtility
+ <InterfaceClass zope.principalannotation.interfaces.IPrincipalAnnotationUtility>
+
+ >>> from zope.app.principalannotation import PrincipalAnnotationUtility
+ >>> from zope.app.principalannotation import Annotations
+ >>> from zope.app.principalannotation import annotations
+
+ >>> PrincipalAnnotationUtility
+ <class 'zope.principalannotation.utility.PrincipalAnnotationUtility'>
+
+ >>> Annotations
+ <class 'zope.principalannotation.utility.Annotations'>
+
+ >>> print annotations.__module__ + '.' + annotations.__name__
+ zope.principalannotation.utility.annotations
+
+ """
+
+def test_suite():
+ return unittest.TestSuite((
+ doctest.DocTestSuite()
+ ))
More information about the Checkins
mailing list