[Checkins] SVN: zope.app.intid/tags/3.7.0/ Tag 3.7.0
Dan Korostelev
nadako at gmail.com
Sat Jan 31 16:15:12 EST 2009
Log message for revision 95798:
Tag 3.7.0
Changed:
A zope.app.intid/tags/3.7.0/
D zope.app.intid/tags/3.7.0/CHANGES.txt
A zope.app.intid/tags/3.7.0/CHANGES.txt
D zope.app.intid/tags/3.7.0/README.txt
A zope.app.intid/tags/3.7.0/README.txt
D zope.app.intid/tags/3.7.0/buildout.cfg
A zope.app.intid/tags/3.7.0/buildout.cfg
D zope.app.intid/tags/3.7.0/setup.py
A zope.app.intid/tags/3.7.0/setup.py
D zope.app.intid/tags/3.7.0/src/zope/app/intid/DEPENDENCIES.cfg
D zope.app.intid/tags/3.7.0/src/zope/app/intid/SETUP.cfg
D zope.app.intid/tags/3.7.0/src/zope/app/intid/__init__.py
A zope.app.intid/tags/3.7.0/src/zope/app/intid/__init__.py
D zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/configure.zcml
A zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/configure.zcml
D zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/ftests.py
A zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tests.py
D zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tracking.txt
A zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tracking.txt
D zope.app.intid/tags/3.7.0/src/zope/app/intid/configure.zcml
A zope.app.intid/tags/3.7.0/src/zope/app/intid/configure.zcml
D zope.app.intid/tags/3.7.0/src/zope/app/intid/ftesting.zcml
A zope.app.intid/tags/3.7.0/src/zope/app/intid/ftesting.zcml
D zope.app.intid/tags/3.7.0/src/zope/app/intid/interfaces.py
A zope.app.intid/tags/3.7.0/src/zope/app/intid/interfaces.py
D zope.app.intid/tags/3.7.0/src/zope/app/intid/subscribers.zcml
A zope.app.intid/tags/3.7.0/src/zope/app/intid/subscribers.zcml
D zope.app.intid/tags/3.7.0/src/zope/app/intid/tests.py
A zope.app.intid/tags/3.7.0/src/zope/app/intid/tests.py
D zope.app.intid/tags/3.7.0/src/zope/app/intid/zope.app.intid-configure.zcml
-=-
Deleted: zope.app.intid/tags/3.7.0/CHANGES.txt
===================================================================
--- zope.app.intid/trunk/CHANGES.txt 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/CHANGES.txt 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,46 +0,0 @@
-=======
-CHANGES
-=======
-
-3.6.1 (unreleased)
-------------------
-
-- ...
-
-3.6.0 (2009-01-31)
-------------------
-
-- Changed dependency from ``zope.app.container`` to
- ``zope.container``.
-
-- Move test dependencies ``zope.app.folder`` and
- ``zope.app.component`` as ``zope.site``.
-
-3.5.1 (2008-12-11)
-------------------
-
-- Make it possible to subscribe object-specific handlers
- for IntIdAddedEvent/IntIdRemovedEvent. Use them like
- the zope.app.container.interfaces.IObjectAddedEvent.
-
-- Include utility->id mapping of added ids to the
- IntIdAddedEvent.
-
-- Removed testing dependencies from install_requires.
-
-3.5.0 (2008-06-19)
-------------------
-
-- Separate subscriber configuration into a separate ZCML file.
-
-
-3.4.1 (2007-10-31)
-------------------
-
-- Resolve ``ZopeSecurityPolicy`` deprecation warning.
-
-
-3.4.0 (2007-10-24)
-------------------
-
-- Initial release independent of the main Zope tree.
Copied: zope.app.intid/tags/3.7.0/CHANGES.txt (from rev 95789, zope.app.intid/trunk/CHANGES.txt)
===================================================================
--- zope.app.intid/tags/3.7.0/CHANGES.txt (rev 0)
+++ zope.app.intid/tags/3.7.0/CHANGES.txt 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,51 @@
+=======
+CHANGES
+=======
+
+3.7.0 (2009-02-01)
+------------------
+
+- Move core functionality to new ``zope.intid`` package, leaving only
+ ZMI-related browser views here.
+
+ Note, that if you used the ``exclude`` directive from ``zc.configuration``
+ package to exclude the ``subscribers.zcml`` file from ``zope.app.intid``,
+ you need to change the directive to exclude it from ``zope.intid`` now.
+
+3.6.0 (2009-01-31)
+------------------
+
+- Changed dependency from ``zope.app.container`` to
+ ``zope.container``.
+
+- Move test dependencies ``zope.app.folder`` and
+ ``zope.app.component`` as ``zope.site``.
+
+3.5.1 (2008-12-11)
+------------------
+
+- Make it possible to subscribe object-specific handlers
+ for IntIdAddedEvent/IntIdRemovedEvent. Use them like
+ the zope.app.container.interfaces.IObjectAddedEvent.
+
+- Include utility->id mapping of added ids to the
+ IntIdAddedEvent.
+
+- Removed testing dependencies from install_requires.
+
+3.5.0 (2008-06-19)
+------------------
+
+- Separate subscriber configuration into a separate ZCML file.
+
+
+3.4.1 (2007-10-31)
+------------------
+
+- Resolve ``ZopeSecurityPolicy`` deprecation warning.
+
+
+3.4.0 (2007-10-24)
+------------------
+
+- Initial release independent of the main Zope tree.
Deleted: zope.app.intid/tags/3.7.0/README.txt
===================================================================
--- zope.app.intid/trunk/README.txt 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/README.txt 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,4 +0,0 @@
-This package provides an API to create integer ids for any object. Later
-objects can be looked up by their id as well. This functionality is commonly
-used in situations where dealing with objects is undesirably, such as in
-search indices or any code that needs an easy hash of an object.
Copied: zope.app.intid/tags/3.7.0/README.txt (from rev 95792, zope.app.intid/trunk/README.txt)
===================================================================
--- zope.app.intid/tags/3.7.0/README.txt (rev 0)
+++ zope.app.intid/tags/3.7.0/README.txt 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,2 @@
+This package provides browser views for adding and managing integer id
+utility, provided by the ``zope.intid`` package.
Deleted: zope.app.intid/tags/3.7.0/buildout.cfg
===================================================================
--- zope.app.intid/trunk/buildout.cfg 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/buildout.cfg 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,7 +0,0 @@
-[buildout]
-develop = .
-parts = test
-
-[test]
-recipe = zc.recipe.testrunner
-eggs = zope.app.intid [test]
Copied: zope.app.intid/tags/3.7.0/buildout.cfg (from rev 95797, zope.app.intid/trunk/buildout.cfg)
===================================================================
--- zope.app.intid/tags/3.7.0/buildout.cfg (rev 0)
+++ zope.app.intid/tags/3.7.0/buildout.cfg 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,7 @@
+[buildout]
+develop = .
+parts = test
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = zope.app.intid [test]
Deleted: zope.app.intid/tags/3.7.0/setup.py
===================================================================
--- zope.app.intid/trunk/setup.py 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/setup.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,66 +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.intid 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.intid',
- version = '3.6.1dev',
- author='Zope Corporation and Contributors',
- author_email='zope3-dev at zope.org',
- description='Integer Id Utility',
- long_description=(
- read('README.txt')
- + '\n\n' +
- read('CHANGES.txt')
- ),
- keywords = "zope3 integer id utility",
- 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://cheeseshop.python.org/pypi/zope.app.intid',
- license='ZPL 2.1',
- packages=find_packages('src'),
- package_dir = {'': 'src'},
- namespace_packages=['zope', 'zope.app'],
- extras_require = dict(test=['zope.app.testing',
- 'zope.app.securitypolicy',
- 'zope.site',
- 'zope.app.zcmlfiles']),
- install_requires = ['setuptools',
- 'ZODB3',
- 'zope.container',
- 'zope.app.keyreference',
- 'zope.component',
- 'zope.event',
- 'zope.interface',
- 'zope.location',
- 'zope.security',
- ],
- include_package_data = True,
- zip_safe = False,
- )
Copied: zope.app.intid/tags/3.7.0/setup.py (from rev 95792, zope.app.intid/trunk/setup.py)
===================================================================
--- zope.app.intid/tags/3.7.0/setup.py (rev 0)
+++ zope.app.intid/tags/3.7.0/setup.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,63 @@
+##############################################################################
+#
+# 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.intid 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.intid',
+ version = '3.7.0',
+ author='Zope Corporation and Contributors',
+ author_email='zope-dev at zope.org',
+ description='ZMI views for Integer Id Utility',
+ long_description=(
+ read('README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ keywords = "zope3 integer id utility",
+ 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.intid',
+ license='ZPL 2.1',
+ packages=find_packages('src'),
+ package_dir = {'': 'src'},
+ namespace_packages=['zope', 'zope.app'],
+ extras_require = dict(test=['zope.app.authentication',
+ 'zope.app.securitypolicy',
+ 'zope.app.testing',
+ 'zope.app.zcmlfiles',
+ 'zope.site',
+ ]),
+ install_requires = ['setuptools',
+ 'zope.intid',
+ 'zope.traversing',
+ 'zope.app.publisher',
+ ],
+ include_package_data = True,
+ zip_safe = False,
+ )
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/DEPENDENCIES.cfg
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/DEPENDENCIES.cfg 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/DEPENDENCIES.cfg 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1 +0,0 @@
-zope.app.keyreference
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/SETUP.cfg
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/SETUP.cfg 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/SETUP.cfg 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,3 +0,0 @@
-<data-files zopeskel/etc/package-includes>
- *-configure.zcml
-</data-files>
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/__init__.py
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/__init__.py 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/__init__.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,184 +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.
-#
-##############################################################################
-"""Unique id utility.
-
-This utility assigns unique integer ids to objects and allows lookups
-by object and by id.
-
-This functionality can be used in cataloging.
-
-$Id$
-"""
-import random
-import BTrees
-
-from ZODB.interfaces import IConnection
-from persistent import Persistent
-
-from zope.event import notify
-from zope.interface import implements
-from zope.security.proxy import removeSecurityProxy
-from zope.location.interfaces import ILocation
-from zope.component import adapter, getAllUtilitiesRegisteredFor, queryUtility, subscribers
-from zope.component.interfaces import IFactory
-
-from zope.container.interfaces import IObjectRemovedEvent
-from zope.container.interfaces import IObjectAddedEvent
-from zope.container.contained import Contained
-from zope.app.keyreference.interfaces import IKeyReference, NotYet
-
-from zope.app.intid.interfaces import IIntIds, IIntIdEvent
-from zope.app.intid.interfaces import IntIdRemovedEvent
-from zope.app.intid.interfaces import IntIdAddedEvent
-
-
-class IntIds(Persistent, Contained):
- """This utility provides a two way mapping between objects and
- integer ids.
-
- IKeyReferences to objects are stored in the indexes.
- """
- implements(IIntIds)
-
- _v_nextid = None
-
- _randrange = random.randrange
-
- family = BTrees.family32
-
- def __init__(self, family=None):
- if family is not None:
- self.family = family
- self.ids = self.family.OI.BTree()
- self.refs = self.family.IO.BTree()
-
- def __len__(self):
- return len(self.ids)
-
- def items(self):
- return list(self.refs.items())
-
- def __iter__(self):
- return self.refs.iterkeys()
-
- def getObject(self, id):
- return self.refs[id]()
-
- def queryObject(self, id, default=None):
- r = self.refs.get(id)
- if r is not None:
- return r()
- return default
-
- def getId(self, ob):
- try:
- key = IKeyReference(ob)
- except (NotYet, TypeError):
- raise KeyError(ob)
-
- try:
- return self.ids[key]
- except KeyError:
- raise KeyError(ob)
-
- def queryId(self, ob, default=None):
- try:
- return self.getId(ob)
- except KeyError:
- return default
-
- def _generateId(self):
- """Generate an id which is not yet taken.
-
- This tries to allocate sequential ids so they fall into the
- same BTree bucket, and randomizes if it stumbles upon a
- used one.
- """
- while True:
- if self._v_nextid is None:
- self._v_nextid = self._randrange(0, self.family.maxint)
- uid = self._v_nextid
- self._v_nextid += 1
- if uid not in self.refs:
- return uid
- self._v_nextid = None
-
- def register(self, ob):
- # Note that we'll still need to keep this proxy removal.
- ob = removeSecurityProxy(ob)
- key = IKeyReference(ob)
-
- if key in self.ids:
- return self.ids[key]
- uid = self._generateId()
- self.refs[uid] = key
- self.ids[key] = uid
- return uid
-
- def unregister(self, ob):
- # Note that we'll still need to keep this proxy removal.
- ob = removeSecurityProxy(ob)
- key = IKeyReference(ob, None)
- if key is None:
- return
-
- uid = self.ids[key]
- del self.refs[uid]
- del self.ids[key]
-
-
- at adapter(ILocation, IObjectRemovedEvent)
-def removeIntIdSubscriber(ob, event):
- """A subscriber to ObjectRemovedEvent
-
- Removes the unique ids registered for the object in all the unique
- id utilities.
- """
- utilities = tuple(getAllUtilitiesRegisteredFor(IIntIds))
- if utilities:
- key = IKeyReference(ob, None)
- # Register only objects that adapt to key reference
- if key is not None:
- # Notify the catalogs that this object is about to be removed.
- notify(IntIdRemovedEvent(ob, event))
- for utility in utilities:
- try:
- utility.unregister(key)
- except KeyError:
- pass
-
- at adapter(ILocation, IObjectAddedEvent)
-def addIntIdSubscriber(ob, event):
- """A subscriber to ObjectAddedEvent
-
- Registers the object added in all unique id utilities and fires
- an event for the catalogs.
- """
- utilities = tuple(getAllUtilitiesRegisteredFor(IIntIds))
- if utilities: # assert that there are any utilites
- key = IKeyReference(ob, None)
- # Register only objects that adapt to key reference
- if key is not None:
- idmap = {}
- for utility in utilities:
- idmap[utility] = utility.register(key)
- # Notify the catalogs that this object was added.
- notify(IntIdAddedEvent(ob, event, idmap))
-
- at adapter(IIntIdEvent)
-def intIdEventNotify(event):
- """Event subscriber to dispatch IntIdEvent to interested adapters."""
- adapters = subscribers((event.object, event), None)
- for adapter in adapters:
- pass # getting them does the work
Copied: zope.app.intid/tags/3.7.0/src/zope/app/intid/__init__.py (from rev 95789, zope.app.intid/trunk/src/zope/app/intid/__init__.py)
===================================================================
--- zope.app.intid/tags/3.7.0/src/zope/app/intid/__init__.py (rev 0)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/__init__.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,30 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Unique id utility.
+
+This utility assigns unique integer ids to objects and allows lookups
+by object and by id.
+
+This functionality can be used in cataloging.
+
+$Id$
+"""
+
+# BBB
+from zope.intid import (
+ IntIds,
+ intIdEventNotify,
+ removeIntIdSubscriber,
+ addIntIdSubscriber
+)
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/configure.zcml
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/browser/configure.zcml 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/configure.zcml 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,37 +0,0 @@
-<zope:configure
- xmlns:zope="http://namespaces.zope.org/zope"
- xmlns="http://namespaces.zope.org/browser"
- i18n_domain="zope"
- >
-
- <addMenuItem
- title="Unique Id Utility"
- description="A utility that provides unique ids to objects"
- class="zope.app.intid.IntIds"
- permission="zope.ManageSite"
- />
-
- <page
- name="index.html"
- menu="zmi_views" title="Registered Objects"
- for="zope.app.intid.interfaces.IIntIds"
- permission="zope.ManageServices"
- class=".IntIdsView"
- template="registrations.pt"
- />
-
- <page
- name="populate"
- for="zope.app.intid.interfaces.IIntIds"
- permission="zope.ManageServices"
- class=".IntIdsView"
- attribute="populate"
- />
-
- <icon
- name="zmi_icon"
- file="intids.png"
- for="zope.app.intid.interfaces.IIntIds"
- />
-
-</zope:configure>
Copied: zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/configure.zcml (from rev 95789, zope.app.intid/trunk/src/zope/app/intid/browser/configure.zcml)
===================================================================
--- zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/configure.zcml (rev 0)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/configure.zcml 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,37 @@
+<zope:configure
+ xmlns:zope="http://namespaces.zope.org/zope"
+ xmlns="http://namespaces.zope.org/browser"
+ i18n_domain="zope"
+ >
+
+ <addMenuItem
+ title="Unique Id Utility"
+ description="A utility that provides unique ids to objects"
+ class="zope.intid.IntIds"
+ permission="zope.ManageSite"
+ />
+
+ <page
+ name="index.html"
+ menu="zmi_views" title="Registered Objects"
+ for="zope.intid.interfaces.IIntIds"
+ permission="zope.ManageServices"
+ class=".IntIdsView"
+ template="registrations.pt"
+ />
+
+ <page
+ name="populate"
+ for="zope.intid.interfaces.IIntIds"
+ permission="zope.ManageServices"
+ class=".IntIdsView"
+ attribute="populate"
+ />
+
+ <icon
+ name="zmi_icon"
+ file="intids.png"
+ for="zope.intid.interfaces.IIntIds"
+ />
+
+</zope:configure>
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/ftests.py
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/browser/ftests.py 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/ftests.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,29 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (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.
-#
-##############################################################################
-"""Int Id Utility Functional Tests
-
-$Id$
-"""
-import unittest
-from zope.app.testing import functional
-from zope.app.intid.testing import IntIdLayer
-
-def test_suite():
- tracking = functional.FunctionalDocFileSuite('tracking.txt')
- tracking.layer = IntIdLayer
- return unittest.TestSuite((tracking,))
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
-
Copied: zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tests.py (from rev 95789, zope.app.intid/trunk/src/zope/app/intid/browser/tests.py)
===================================================================
--- zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tests.py (rev 0)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tests.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,81 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""Int Id Utility Functional Tests
+
+$Id$
+"""
+import unittest
+from zope.app.testing import functional
+from zope.app.intid.testing import IntIdLayer
+
+from transaction import commit
+
+from zope.app.testing import setup, ztapi
+from zope.app.testing.functional import BrowserTestCase
+
+from zope.intid import IntIds, intIdEventNotify
+from zope.intid.interfaces import IIntIds
+from zope.traversing.api import traverse
+
+class TestFunctionalIntIds(BrowserTestCase):
+
+ def setUp(self):
+ BrowserTestCase.setUp(self)
+
+ self.basepath = '/++etc++site/default'
+ root = self.getRootFolder()
+
+ sm = traverse(root, '/++etc++site')
+ setup.addUtility(sm, 'intid', IIntIds, IntIds())
+ commit()
+
+ type_name = 'BrowserAdd__zope.intid.IntIds'
+
+ response = self.publish(
+ self.basepath + '/contents.html',
+ basic='mgr:mgrpw',
+ form={'type_name': type_name,
+ 'new_value': 'mgr' })
+
+ def test(self):
+ response = self.publish(self.basepath + '/intid/@@index.html',
+ basic='mgr:mgrpw')
+ self.assertEquals(response.getStatus(), 200)
+ # The utility registers in itself when it is being added
+ self.assert_(response.getBody().find('1 objects') > 0)
+ self.assert_('<a href="/++etc++site">/++etc++site</a>'
+ not in response.getBody())
+
+ response = self.publish(self.basepath + '/intid/@@populate',
+ basic='mgr:mgrpw')
+ self.assertEquals(response.getStatus(), 302)
+
+ response = self.publish(self.basepath
+ + '/intid/@@index.html?testing=1',
+ basic='mgr:mgrpw')
+ self.assertEquals(response.getStatus(), 200)
+ body = response.getBody()
+ self.assert_('3 objects' in body)
+ self.assert_('<a href="/++etc++site">/++etc++site</a>' in body)
+ self.checkForBrokenLinks(body, response.getPath(), basic='mgr:mgrpw')
+
+def test_suite():
+ TestFunctionalIntIds.layer = IntIdLayer
+ browser = unittest.makeSuite(TestFunctionalIntIds)
+ tracking = functional.FunctionalDocFileSuite('tracking.txt')
+ tracking.layer = IntIdLayer
+ return unittest.TestSuite((browser, tracking))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tracking.txt
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/browser/tracking.txt 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tracking.txt 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,154 +0,0 @@
-Tracking Object Additions, Deletions, and Moves
-===============================================
-
-Unique ID utilities track object add moves. Let's look at an
-example. First, we'll create a unique Id utility:
-
- >>> print http(r"""
- ... POST /++etc++site/default/@@contents.html HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
- ...
- ... type_name=BrowserAdd__zope.app.intid.IntIds&new_value=""")
- HTTP/1.1 303 ...
- ...
- Location: http://localhost/++etc++site/default/IntIds/@@registration.html
- ...
-
- >>> print http(r"""
- ... POST /++etc++site/default/IntIds/addRegistration.html HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Referer: http://localhost:8081/++etc++site/default/IntIds/
- ... Content-Type: multipart/form-data; boundary=----------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
- ...
- ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
- ... Content-Disposition: form-data; name="field.name"
- ...
- ... IntIds
- ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
- ... Content-Disposition: form-data; name="field.provided"
- ...
- ... zope.app.intid.interfaces.IIntIds
- ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
- ... Content-Disposition: form-data; name="field.provided-empty-marker"
- ...
- ... 1
- ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
- ... Content-Disposition: form-data; name="field.comment"
- ...
- ...
- ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
- ... Content-Disposition: form-data; name="field.actions.register"
- ...
- ... Register
- ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ--
- ... """)
- HTTP/1.1 303 ...
- ...
-
-Now, we'll add a few folders:
-
- >>> print http(r"""
- ... POST /@@contents.html HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Content-Length: 64
- ... Content-Type: application/x-www-form-urlencoded
- ...
- ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f1""")
- HTTP/1.1 303 ...
- ...
-
- >>> print http(r"""
- ... POST /f1/@@contents.html HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Content-Length: 64
- ... Content-Type: application/x-www-form-urlencoded
- ...
- ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f1""")
- HTTP/1.1 303 ...
- ...
-
- >>> print http(r"""
- ... POST /f1/@@contents.html HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Content-Length: 64
- ... Content-Type: application/x-www-form-urlencoded
- ...
- ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f2""")
- HTTP/1.1 303 ...
- ...
-
- >>> print http(r"""
- ... POST /f1/f1/@@contents.html HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Content-Length: 64
- ... Content-Type: application/x-www-form-urlencoded
- ...
- ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f1""")
- HTTP/1.1 303 ...
- ...
-
-Now, if we look at the index page for the unique id utility, we'll see
-the objects we added:
-
- >>> print http(r"""
- ... GET /++etc++site/default/IntIds/@@index.html?testing=1 HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
- ... """)
- HTTP/1.1 200 ...
- ...4 objects...
- .../f1...
- .../f1/f1...
- .../f1/f2...
- .../f1/f1/f1...
-
-If we move the top object:
-
- >>> print http(r"""
- ... POST /@@contents.html HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Content-Length: 40
- ... Content-Type: application/x-www-form-urlencoded
- ... Referer: http://localhost:8081/@@contents.html
- ...
- ... new_value%3Alist=f2&rename_ids%3Alist=f1""")
- HTTP/1.1 303 ...
- ...
-
-We'll see that reflected in the utility:
-
- >>> print http(r"""
- ... GET /++etc++site/default/IntIds/@@index.html?testing=1 HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
- ... """)
- HTTP/1.1 200 ...
- ...4 objects...
- .../f2...
- .../f2/f1...
- .../f2/f2...
- .../f2/f1/f1...
-
-And if we delete the top object:
-
- >>> print http(r"""
- ... POST /@@contents.html HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Content-Length: 44
- ... Content-Type: application/x-www-form-urlencoded
- ... Referer: http://localhost:8081/@@contents.html
- ...
- ... ids%3Alist=f2&container_delete_button=Delete""")
- HTTP/1.1 303 ...
- ...
-
-all of the objects will go away:
-
- >>> print http(r"""
- ... GET /++etc++site/default/IntIds/@@index.html?testing=1 HTTP/1.1
- ... Authorization: Basic mgr:mgrpw
- ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
- ... """)
- HTTP/1.1 200 ...
- ...0 objects...
Copied: zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tracking.txt (from rev 95789, zope.app.intid/trunk/src/zope/app/intid/browser/tracking.txt)
===================================================================
--- zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tracking.txt (rev 0)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/browser/tracking.txt 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,154 @@
+Tracking Object Additions, Deletions, and Moves
+===============================================
+
+Unique ID utilities track object add moves. Let's look at an
+example. First, we'll create a unique Id utility:
+
+ >>> print http(r"""
+ ... POST /++etc++site/default/@@contents.html HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
+ ...
+ ... type_name=BrowserAdd__zope.intid.IntIds&new_value=""")
+ HTTP/1.1 303 ...
+ ...
+ Location: http://localhost/++etc++site/default/IntIds/@@registration.html
+ ...
+
+ >>> print http(r"""
+ ... POST /++etc++site/default/IntIds/addRegistration.html HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Referer: http://localhost:8081/++etc++site/default/IntIds/
+ ... Content-Type: multipart/form-data; boundary=----------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+ ...
+ ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+ ... Content-Disposition: form-data; name="field.name"
+ ...
+ ... IntIds
+ ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+ ... Content-Disposition: form-data; name="field.provided"
+ ...
+ ... zope.intid.interfaces.IIntIds
+ ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+ ... Content-Disposition: form-data; name="field.provided-empty-marker"
+ ...
+ ... 1
+ ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+ ... Content-Disposition: form-data; name="field.comment"
+ ...
+ ...
+ ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ
+ ... Content-Disposition: form-data; name="field.actions.register"
+ ...
+ ... Register
+ ... ------------CedQTrEQIEPbgfYhvcITAhQi2aJdgu3tYfJ0WYQmkpLQTt6OTOpd5GJ--
+ ... """)
+ HTTP/1.1 303 ...
+ ...
+
+Now, we'll add a few folders:
+
+ >>> print http(r"""
+ ... POST /@@contents.html HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Content-Length: 64
+ ... Content-Type: application/x-www-form-urlencoded
+ ...
+ ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f1""")
+ HTTP/1.1 303 ...
+ ...
+
+ >>> print http(r"""
+ ... POST /f1/@@contents.html HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Content-Length: 64
+ ... Content-Type: application/x-www-form-urlencoded
+ ...
+ ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f1""")
+ HTTP/1.1 303 ...
+ ...
+
+ >>> print http(r"""
+ ... POST /f1/@@contents.html HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Content-Length: 64
+ ... Content-Type: application/x-www-form-urlencoded
+ ...
+ ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f2""")
+ HTTP/1.1 303 ...
+ ...
+
+ >>> print http(r"""
+ ... POST /f1/f1/@@contents.html HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Content-Length: 64
+ ... Content-Type: application/x-www-form-urlencoded
+ ...
+ ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f1""")
+ HTTP/1.1 303 ...
+ ...
+
+Now, if we look at the index page for the unique id utility, we'll see
+the objects we added:
+
+ >>> print http(r"""
+ ... GET /++etc++site/default/IntIds/@@index.html?testing=1 HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
+ ... """)
+ HTTP/1.1 200 ...
+ ...4 objects...
+ .../f1...
+ .../f1/f1...
+ .../f1/f2...
+ .../f1/f1/f1...
+
+If we move the top object:
+
+ >>> print http(r"""
+ ... POST /@@contents.html HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Content-Length: 40
+ ... Content-Type: application/x-www-form-urlencoded
+ ... Referer: http://localhost:8081/@@contents.html
+ ...
+ ... new_value%3Alist=f2&rename_ids%3Alist=f1""")
+ HTTP/1.1 303 ...
+ ...
+
+We'll see that reflected in the utility:
+
+ >>> print http(r"""
+ ... GET /++etc++site/default/IntIds/@@index.html?testing=1 HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
+ ... """)
+ HTTP/1.1 200 ...
+ ...4 objects...
+ .../f2...
+ .../f2/f1...
+ .../f2/f2...
+ .../f2/f1/f1...
+
+And if we delete the top object:
+
+ >>> print http(r"""
+ ... POST /@@contents.html HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Content-Length: 44
+ ... Content-Type: application/x-www-form-urlencoded
+ ... Referer: http://localhost:8081/@@contents.html
+ ...
+ ... ids%3Alist=f2&container_delete_button=Delete""")
+ HTTP/1.1 303 ...
+ ...
+
+all of the objects will go away:
+
+ >>> print http(r"""
+ ... GET /++etc++site/default/IntIds/@@index.html?testing=1 HTTP/1.1
+ ... Authorization: Basic mgr:mgrpw
+ ... Referer: http://localhost:8081/++etc++site/default/@@contents.html
+ ... """)
+ HTTP/1.1 200 ...
+ ...0 objects...
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/configure.zcml
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/configure.zcml 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/configure.zcml 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,37 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- i18n_domain="zope"
- >
-
- <class class=".IntIds">
- <factory
- id="zope.app.intid.IntIds"
- />
-
- <implements
- interface="zope.annotation.interfaces.IAttributeAnnotatable"
- />
-
- <require
- permission="zope.Public"
- interface=".interfaces.IIntIdsQuery"
- />
-
- <require
- permission="zope.ManageContent"
- interface=".interfaces.IIntIdsSet"
- />
-
- <require
- permission="zope.Public"
- interface=".interfaces.IIntIdsManage"
- />
-
- </class>
-
- <include file="subscribers.zcml" />
-
- <!-- Views -->
- <include package=".browser" />
-
-</configure>
Copied: zope.app.intid/tags/3.7.0/src/zope/app/intid/configure.zcml (from rev 95789, zope.app.intid/trunk/src/zope/app/intid/configure.zcml)
===================================================================
--- zope.app.intid/tags/3.7.0/src/zope/app/intid/configure.zcml (rev 0)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/configure.zcml 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,6 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+ <include package="zope.intid" />
+ <include package=".browser" />
+
+</configure>
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/ftesting.zcml
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/ftesting.zcml 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/ftesting.zcml 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,52 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- i18n_domain="zope"
- package="zope.app.intid"
- >
-
- <!-- This file is the equivalent of site.zcml and it is -->
- <!-- used for functional testing setup -->
-
- <include package="zope.app.zcmlfiles" />
-
- <include package="zope.app.securitypolicy" />
- <include package="zope.app.securitypolicy" file="meta.zcml" />
- <include package="zope.formlib" />
- <include package="zope.app.authentication" />
- <include package="zope.app.keyreference" />
- <include package="zope.app.intid" />
-
- <securityPolicy
- component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
-
- <role id="zope.Anonymous" title="Everybody"
- description="All users have this role implicitly" />
- <role id="zope.Manager" title="Site Manager" />
-
- <grantAll role="zope.Manager" />
- <include package="zope.app.securitypolicy.tests" file="functional.zcml" />
-
- <!-- Principals -->
-
- <unauthenticatedGroup
- id="zope.Anybody"
- title="Unauthenticated Users"
- />
-
- <!-- Principal that tests generally run as -->
- <principal
- id="zope.mgr"
- title="Manager"
- login="mgr"
- password="mgrpw" />
-
- <!-- Bootstrap principal used to make local grant to the principal above -->
- <principal
- id="zope.globalmgr"
- title="Manager"
- login="globalmgr"
- password="globalmgrpw" />
-
- <grant role="zope.Manager" principal="zope.globalmgr" />
-
-</configure>
Copied: zope.app.intid/tags/3.7.0/src/zope/app/intid/ftesting.zcml (from rev 95789, zope.app.intid/trunk/src/zope/app/intid/ftesting.zcml)
===================================================================
--- zope.app.intid/tags/3.7.0/src/zope/app/intid/ftesting.zcml (rev 0)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/ftesting.zcml 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,51 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="zope"
+ package="zope.app.intid"
+ >
+
+ <!-- This file is the equivalent of site.zcml and it is -->
+ <!-- used for functional testing setup -->
+
+ <include package="zope.app.zcmlfiles" />
+
+ <include package="zope.app.securitypolicy" />
+ <include package="zope.app.securitypolicy" file="meta.zcml" />
+ <include package="zope.app.authentication" />
+ <include package="zope.keyreference" />
+ <include package="zope.app.intid" />
+
+ <securityPolicy
+ component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+ <role id="zope.Anonymous" title="Everybody"
+ description="All users have this role implicitly" />
+ <role id="zope.Manager" title="Site Manager" />
+
+ <grantAll role="zope.Manager" />
+ <include package="zope.app.securitypolicy.tests" file="functional.zcml" />
+
+ <!-- Principals -->
+
+ <unauthenticatedGroup
+ id="zope.Anybody"
+ title="Unauthenticated Users"
+ />
+
+ <!-- Principal that tests generally run as -->
+ <principal
+ id="zope.mgr"
+ title="Manager"
+ login="mgr"
+ password="mgrpw" />
+
+ <!-- Bootstrap principal used to make local grant to the principal above -->
+ <principal
+ id="zope.globalmgr"
+ title="Manager"
+ login="globalmgr"
+ password="globalmgrpw" />
+
+ <grant role="zope.Manager" principal="zope.globalmgr" />
+
+</configure>
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/interfaces.py
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/interfaces.py 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/interfaces.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,115 +0,0 @@
-"""
-Interfaces for the unique id utility.
-
-$Id$
-"""
-from zope.interface import Interface, Attribute, implements
-
-
-class IIntIdsQuery(Interface):
-
- def getObject(uid):
- """Return an object by its unique id"""
-
- def getId(ob):
- """Get a unique id of an object.
- """
-
- def queryObject(uid, default=None):
- """Return an object by its unique id
-
- Return the default if the uid isn't registered
- """
-
- def queryId(ob, default=None):
- """Get a unique id of an object.
-
- Return the default if the object isn't registered
- """
-
- def __iter__():
- """Return an iteration on the ids"""
-
-
-class IIntIdsSet(Interface):
-
- def register(ob):
- """Register an object and returns a unique id generated for it.
-
- The object *must* be adaptable to IKeyReference.
-
- If the object is already registered, its id is returned anyway.
- """
-
- def unregister(ob):
- """Remove the object from the indexes.
-
- KeyError is raised if ob is not registered previously.
- """
-
-class IIntIdsManage(Interface):
- """Some methods used by the view."""
-
- def __len__():
- """Return the number of objects indexed."""
-
- def items():
- """Return a list of (id, object) pairs."""
-
-
-class IIntIds(IIntIdsSet, IIntIdsQuery, IIntIdsManage):
- """A utility that assigns unique ids to objects.
-
- Allows to query object by id and id by object.
- """
-
-
-class IIntIdEvent(Interface):
- """Generic base interface for IntId-related events"""
-
- object = Attribute("The object related to this event")
-
- original_event = Attribute("The ObjectEvent related to this event")
-
-
-class IIntIdRemovedEvent(IIntIdEvent):
- """A unique id will be removed
-
- The event is published before the unique id is removed
- from the utility so that the indexing objects can unindex the object.
- """
-
-
-class IntIdRemovedEvent:
- """The event which is published before the unique id is removed
- from the utility so that the catalogs can unindex the object.
- """
-
- implements(IIntIdRemovedEvent)
-
- def __init__(self, object, event):
- self.object = object
- self.original_event = event
-
-
-class IIntIdAddedEvent(IIntIdEvent):
- """A unique id has been added
-
- The event gets sent when an object is registered in a
- unique id utility.
- """
-
- idmap = Attribute("The dictionary that holds an (utility -> id) mapping of created ids")
-
-
-class IntIdAddedEvent:
- """The event which gets sent when an object is registered in a
- unique id utility.
- """
-
- implements(IIntIdAddedEvent)
-
- def __init__(self, object, event, idmap=None):
- self.object = object
- self.original_event = event
- self.idmap = idmap
Copied: zope.app.intid/tags/3.7.0/src/zope/app/intid/interfaces.py (from rev 95789, zope.app.intid/trunk/src/zope/app/intid/interfaces.py)
===================================================================
--- zope.app.intid/tags/3.7.0/src/zope/app/intid/interfaces.py (rev 0)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/interfaces.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,18 @@
+"""
+Interfaces for the unique id utility.
+
+$Id$
+"""
+
+# BBB
+from zope.intid.interfaces import (
+ IIntIdsQuery,
+ IIntIdsSet,
+ IIntIdsManage,
+ IIntIds,
+ IIntIdEvent,
+ IIntIdRemovedEvent,
+ IntIdRemovedEvent,
+ IIntIdAddedEvent,
+ IntIdAddedEvent
+)
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/subscribers.zcml
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/subscribers.zcml 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/subscribers.zcml 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,10 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- i18n_domain="zope"
- >
-
- <subscriber handler=".removeIntIdSubscriber" />
- <subscriber handler=".addIntIdSubscriber" />
- <subscriber handler=".intIdEventNotify" />
-
-</configure>
Copied: zope.app.intid/tags/3.7.0/src/zope/app/intid/subscribers.zcml (from rev 95789, zope.app.intid/trunk/src/zope/app/intid/subscribers.zcml)
===================================================================
--- zope.app.intid/tags/3.7.0/src/zope/app/intid/subscribers.zcml (rev 0)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/subscribers.zcml 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,5 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+ <include package="zope.intid" file="subscribers.zcml" />
+
+</configure>
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/tests.py
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/tests.py 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/tests.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1,351 +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.
-#
-##############################################################################
-"""Tests for the unique id utility.
-
-$Id$
-"""
-import re
-import unittest
-import BTrees
-
-from persistent import Persistent
-from persistent.interfaces import IPersistent
-from transaction import commit
-from ZODB.interfaces import IConnection
-
-from zope.interface import implements
-from zope.interface.verify import verifyObject
-from zope.location.interfaces import ILocation
-
-from zope.component import getSiteManager
-from zope.component.interfaces import IFactory
-
-from zope.traversing.api import traverse
-
-from zope.app.testing import setup, ztapi
-from zope.site.hooks import setSite
-
-from zope.app.intid import IntIds, intIdEventNotify
-from zope.app.intid.interfaces import IIntIds
-from zope.app.intid.testing import IntIdLayer
-from zope.app.keyreference.persistent import KeyReferenceToPersistent
-from zope.app.keyreference.persistent import connectionOfPersistent
-from zope.app.keyreference.interfaces import IKeyReference
-from zope.app.testing.functional import BrowserTestCase
-
-
-class P(Persistent):
- implements(ILocation)
-
-
-class ConnectionStub(object):
- next = 1
-
- def db(self):
- return self
-
- database_name = 'ConnectionStub'
-
- def add(self, ob):
- ob._p_jar = self
- ob._p_oid = self.next
- self.next += 1
-
-
-class ReferenceSetupMixin(object):
- """Registers adapters ILocation->IConnection and IPersistent->IReference"""
- def setUp(self):
- self.root = setup.placefulSetUp(site=True)
- ztapi.provideAdapter(IPersistent, IConnection, connectionOfPersistent)
- ztapi.provideAdapter(IPersistent, IKeyReference,
- KeyReferenceToPersistent)
-
- def tearDown(self):
- setup.placefulTearDown()
-
-
-class TestIntIds(ReferenceSetupMixin, unittest.TestCase):
-
- createIntIds = IntIds
-
- def test_interface(self):
- verifyObject(IIntIds, self.createIntIds())
-
- def test_non_keyreferences(self):
- u = self.createIntIds()
- obj = object()
-
- self.assert_(u.queryId(obj) is None)
- self.assert_(u.unregister(obj) is None)
- self.assertRaises(KeyError, u.getId, obj)
-
- def test(self):
- u = self.createIntIds()
- obj = P()
-
- obj._p_jar = ConnectionStub()
-
- self.assertRaises(KeyError, u.getId, obj)
- self.assertRaises(KeyError, u.getId, P())
-
- self.assert_(u.queryId(obj) is None)
- self.assert_(u.queryId(obj, 42) is 42)
- self.assert_(u.queryId(P(), 42) is 42)
- self.assert_(u.queryObject(42) is None)
- self.assert_(u.queryObject(42, obj) is obj)
-
- uid = u.register(obj)
- self.assert_(u.getObject(uid) is obj)
- self.assert_(u.queryObject(uid) is obj)
- self.assertEquals(u.getId(obj), uid)
- self.assertEquals(u.queryId(obj), uid)
-
- uid2 = u.register(obj)
- self.assertEquals(uid, uid2)
-
- u.unregister(obj)
- self.assertRaises(KeyError, u.getObject, uid)
- self.assertRaises(KeyError, u.getId, obj)
-
- def test_btree_long(self):
- # This is a somewhat arkward test, that *simulates* the border case
- # behaviour of the _generateId method
- u = self.createIntIds()
- u._randrange = lambda x,y:int(2**31-1)
-
- # The chosen int is exactly the largest number possible that is
- # delivered by the randint call in the code
- obj = P()
- obj._p_jar = ConnectionStub()
- uid = u.register(obj)
- self.assertEquals(2**31-1, uid)
- # Make an explicit tuple here to avoid implicit type casts on 2**31-1
- # by the btree code
- self.failUnless(2**31-1 in tuple(u.refs.keys()))
-
- def test_len_items(self):
- u = self.createIntIds()
- obj = P()
- obj._p_jar = ConnectionStub()
-
-
- self.assertEquals(len(u), 0)
- self.assertEquals(u.items(), [])
- self.assertEquals(list(u), [])
-
- uid = u.register(obj)
- ref = KeyReferenceToPersistent(obj)
- self.assertEquals(len(u), 1)
- self.assertEquals(u.items(), [(uid, ref)])
- self.assertEquals(list(u), [uid])
-
- obj2 = P()
- obj2.__parent__ = obj
-
- uid2 = u.register(obj2)
- ref2 = KeyReferenceToPersistent(obj2)
- self.assertEquals(len(u), 2)
- result = u.items()
- expected = [(uid, ref), (uid2, ref2)]
- result.sort()
- expected.sort()
- self.assertEquals(result, expected)
- result = list(u)
- expected = [uid, uid2]
- result.sort()
- expected.sort()
- self.assertEquals(result, expected)
-
- u.unregister(obj)
- u.unregister(obj2)
- self.assertEquals(len(u), 0)
- self.assertEquals(u.items(), [])
-
- def test_getenrateId(self):
- u = self.createIntIds()
- self.assertEquals(u._v_nextid, None)
- id1 = u._generateId()
- self.assert_(u._v_nextid is not None)
- id2 = u._generateId()
- self.assert_(id1 + 1, id2)
- u.refs[id2 + 1] = "Taken"
- id3 = u._generateId()
- self.assertNotEqual(id3, id2 + 1)
- self.assertNotEqual(id3, id2)
- self.assertNotEqual(id3, id1)
-
-
-class TestSubscribers(ReferenceSetupMixin, unittest.TestCase):
-
- def setUp(self):
- from zope.site.folder import Folder, rootFolder
- from zope.component import provideHandler
-
- ReferenceSetupMixin.setUp(self)
-
- sm = getSiteManager(self.root)
- self.utility = setup.addUtility(sm, '1', IIntIds, IntIds())
-
- self.root['folder1'] = Folder()
- self.root._p_jar = ConnectionStub()
- self.root['folder1']['folder1_1'] = self.folder1_1 = Folder()
- self.root['folder1']['folder1_1']['folder1_1_1'] = Folder()
-
- sm1_1 = setup.createSiteManager(self.folder1_1)
- self.utility1 = setup.addUtility(sm1_1, '2', IIntIds, IntIds())
- provideHandler(intIdEventNotify)
-
- def test_removeIntIdSubscriber(self):
- from zope.app.intid import removeIntIdSubscriber
- from zope.container.contained import ObjectRemovedEvent
- from zope.app.intid.interfaces import IIntIdRemovedEvent
- from zope.site.interfaces import IFolder
- parent_folder = self.root['folder1']['folder1_1']
- folder = self.root['folder1']['folder1_1']['folder1_1_1']
- id = self.utility.register(folder)
- id1 = self.utility1.register(folder)
- self.assertEquals(self.utility.getObject(id), folder)
- self.assertEquals(self.utility1.getObject(id1), folder)
- setSite(self.folder1_1)
-
- events = []
- objevents = []
-
- def appendObjectEvent(obj, event):
- objevents.append((obj, event))
-
- ztapi.subscribe([IIntIdRemovedEvent], None, events.append)
- ztapi.subscribe([IFolder, IIntIdRemovedEvent], None, appendObjectEvent)
-
- # This should unregister the object in all utilities, not just the
- # nearest one.
- removeIntIdSubscriber(folder, ObjectRemovedEvent(parent_folder))
-
- self.assertRaises(KeyError, self.utility.getObject, id)
- self.assertRaises(KeyError, self.utility1.getObject, id1)
-
- self.assertEquals(len(events), 1)
- self.assertEquals(events[0].object, folder)
- self.assertEquals(events[0].original_event.object, parent_folder)
-
- self.assertEquals(len(objevents), 1)
- self.assertEquals(objevents[0][0], folder)
- self.assertEquals(objevents[0][1].object, folder)
- self.assertEquals(objevents[0][1].original_event.object, parent_folder)
-
- def test_addIntIdSubscriber(self):
- from zope.app.intid import addIntIdSubscriber
- from zope.container.contained import ObjectAddedEvent
- from zope.app.intid.interfaces import IIntIdAddedEvent
- from zope.site.interfaces import IFolder
- parent_folder = self.root['folder1']['folder1_1']
- folder = self.root['folder1']['folder1_1']['folder1_1_1']
- setSite(self.folder1_1)
-
- events = []
- objevents = []
-
- def appendObjectEvent(obj, event):
- objevents.append((obj, event))
-
- ztapi.subscribe([IIntIdAddedEvent], None, events.append)
- ztapi.subscribe([IFolder, IIntIdAddedEvent], None, appendObjectEvent)
-
- # This should register the object in all utilities, not just the
- # nearest one.
- addIntIdSubscriber(folder, ObjectAddedEvent(parent_folder))
-
- # Check that the folder got registered
- id = self.utility.getId(folder)
- id1 = self.utility1.getId(folder)
-
- self.assertEquals(len(events), 1)
- self.assertEquals(events[0].original_event.object, parent_folder)
- self.assertEquals(events[0].object, folder)
-
- self.assertEquals(len(objevents), 1)
- self.assertEquals(objevents[0][1].original_event.object, parent_folder)
- self.assertEquals(objevents[0][1].object, folder)
- self.assertEquals(objevents[0][0], folder)
-
- idmap = events[0].idmap
- self.assert_(idmap is objevents[0][1].idmap)
- self.assertEquals(len(idmap), 2)
- self.assertEquals(idmap[self.utility], id)
- self.assertEquals(idmap[self.utility1], id1)
-
-class TestIntIds64(TestIntIds):
-
- def createIntIds(self):
- return IntIds(family=BTrees.family64)
-
-
-class TestFunctionalIntIds(BrowserTestCase):
-
- def setUp(self):
- from zope.app.intid import IntIds
- from zope.app.intid.interfaces import IIntIds
-
- BrowserTestCase.setUp(self)
-
- self.basepath = '/++etc++site/default'
- root = self.getRootFolder()
-
- sm = traverse(root, '/++etc++site')
- setup.addUtility(sm, 'intid', IIntIds, IntIds())
- commit()
-
- type_name = 'BrowserAdd__zope.app.intid.IntIds'
-
- response = self.publish(
- self.basepath + '/contents.html',
- basic='mgr:mgrpw',
- form={'type_name': type_name,
- 'new_value': 'mgr' })
-
- def test(self):
- response = self.publish(self.basepath + '/intid/@@index.html',
- basic='mgr:mgrpw')
- self.assertEquals(response.getStatus(), 200)
- # The utility registers in itself when it is being added
- self.assert_(response.getBody().find('1 objects') > 0)
- self.assert_('<a href="/++etc++site">/++etc++site</a>'
- not in response.getBody())
-
- response = self.publish(self.basepath + '/intid/@@populate',
- basic='mgr:mgrpw')
- self.assertEquals(response.getStatus(), 302)
-
- response = self.publish(self.basepath
- + '/intid/@@index.html?testing=1',
- basic='mgr:mgrpw')
- self.assertEquals(response.getStatus(), 200)
- body = response.getBody()
- self.assert_('3 objects' in body)
- self.assert_('<a href="/++etc++site">/++etc++site</a>' in body)
- self.checkForBrokenLinks(body, response.getPath(), basic='mgr:mgrpw')
-
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestIntIds))
- suite.addTest(unittest.makeSuite(TestIntIds64))
- suite.addTest(unittest.makeSuite(TestSubscribers))
- # Functional Tests
- TestFunctionalIntIds.layer = IntIdLayer
- suite.addTest(unittest.makeSuite(TestFunctionalIntIds))
- return suite
-
-if __name__ == '__main__':
- unittest.main()
Copied: zope.app.intid/tags/3.7.0/src/zope/app/intid/tests.py (from rev 95791, zope.app.intid/trunk/src/zope/app/intid/tests.py)
===================================================================
--- zope.app.intid/tags/3.7.0/src/zope/app/intid/tests.py (rev 0)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/tests.py 2009-01-31 21:15:12 UTC (rev 95798)
@@ -0,0 +1,58 @@
+import unittest
+from zope.testing import doctest
+
+def test_imports():
+ """
+ All core functionality was moved to zope.intid, so the tests are
+ moved as well. Here, we only test that backward-compatibility imports
+ are still working.
+
+ >>> from zope.app.intid import IntIds, intIdEventNotify
+ >>> from zope.app.intid import addIntIdSubscriber, removeIntIdSubscriber
+ >>> IntIds
+ <class 'zope.intid.IntIds'>
+ >>> intIdEventNotify
+ <function intIdEventNotify at 0x...>
+ >>> addIntIdSubscriber
+ <function addIntIdSubscriber at 0x...>
+ >>> removeIntIdSubscriber
+ <function removeIntIdSubscriber at 0x...>
+
+ >>> from zope.app.intid.interfaces import (
+ ... IIntIdsQuery,
+ ... IIntIdsSet,
+ ... IIntIdsManage,
+ ... IIntIds,
+ ... IIntIdEvent,
+ ... IIntIdAddedEvent,
+ ... IIntIdRemovedEvent,
+ ... IntIdAddedEvent,
+ ... IntIdRemovedEvent
+ ... )
+ >>> IIntIdsQuery
+ <InterfaceClass zope.intid.interfaces.IIntIdsQuery>
+ >>> IIntIdsSet
+ <InterfaceClass zope.intid.interfaces.IIntIdsSet>
+ >>> IIntIdsManage
+ <InterfaceClass zope.intid.interfaces.IIntIdsManage>
+ >>> IIntIds
+ <InterfaceClass zope.intid.interfaces.IIntIds>
+ >>> IIntIdEvent
+ <InterfaceClass zope.intid.interfaces.IIntIdEvent>
+ >>> IIntIdAddedEvent
+ <InterfaceClass zope.intid.interfaces.IIntIdAddedEvent>
+ >>> IIntIdRemovedEvent
+ <InterfaceClass zope.intid.interfaces.IIntIdRemovedEvent>
+ >>> IntIdAddedEvent
+ <class 'zope.intid.interfaces.IntIdAddedEvent'>
+ >>> IntIdRemovedEvent
+ <class 'zope.intid.interfaces.IntIdRemovedEvent'>
+ """
+
+def test_suite():
+ return unittest.TestSuite((
+ doctest.DocTestSuite(optionflags=doctest.ELLIPSIS),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Deleted: zope.app.intid/tags/3.7.0/src/zope/app/intid/zope.app.intid-configure.zcml
===================================================================
--- zope.app.intid/trunk/src/zope/app/intid/zope.app.intid-configure.zcml 2009-01-31 18:42:22 UTC (rev 95783)
+++ zope.app.intid/tags/3.7.0/src/zope/app/intid/zope.app.intid-configure.zcml 2009-01-31 21:15:12 UTC (rev 95798)
@@ -1 +0,0 @@
-<include package="zope.app.intid" />
More information about the Checkins
mailing list