zope.intid-3.7.2/bootstrap.py0000644000000000000000000000337210602211016016125 0ustar rootroot00000000000000############################################################################## # # Copyright (c) 2006 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Bootstrap a buildout-based project Simply run this script in a directory containing a buildout.cfg. The script accepts buildout command-line options, so you can use the -c option to specify an alternate configuration file. $Id: bootstrap.py 73739 2007-03-27 13:46:06Z baijum $ """ import os, shutil, sys, tempfile, urllib2 tmpeggs = tempfile.mkdtemp() ez = {} exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py' ).read() in ez ez['use_setuptools'](to_dir=tmpeggs, download_delay=0) import pkg_resources cmd = 'from setuptools.command.easy_install import main; main()' if sys.platform == 'win32': cmd = '"%s"' % cmd # work around spawn lamosity on windows ws = pkg_resources.working_set assert os.spawnle( os.P_WAIT, sys.executable, sys.executable, '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout', dict(os.environ, PYTHONPATH= ws.find(pkg_resources.Requirement.parse('setuptools')).location ), ) == 0 ws.add_entry(tmpeggs) ws.require('zc.buildout') import zc.buildout.buildout zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap']) shutil.rmtree(tmpeggs) zope.intid-3.7.2/buildout.cfg0000644000000000000000000000014311141113350016040 0ustar rootroot00000000000000[buildout] develop = . parts = test [test] recipe = zc.recipe.testrunner eggs = zope.intid [test] zope.intid-3.7.2/CHANGES.txt0000644000000000000000000000156111315651352015362 0ustar rootroot00000000000000======= CHANGES ======= 3.7.2 (2009-12-27) ------------------ - Use the zope.component API in favor of ztapi. - Removed ``zope.app.testing`` dependency. 3.7.1 (2009-05-18) ------------------ - Remove dependencies on ``zope.container``. Instead import ``Object*Event`` classes from ``zope.lifecycleevent`` and import ``IContained`` from ``zope.location``. In order to be able to do this, depend on ``zope.lifecycleevent``>=3.5.2 and ``zope.location``>=3.5.4. - Remove a dependency on ``zope.container.contained.Contained`` (this is a dumb base class that defines __parent__ and __name__ as None and declares that the class implements IContained). 3.7.0 (2009-02-01) ------------------ - Split out this package from ``zope.app.intid``. The latter one now only contains browser views and compatibility imports while whole IntId functionality is moved here. zope.intid-3.7.2/PKG-INFO0000644000000000000000000000413111315651434014643 0ustar rootroot00000000000000Metadata-Version: 1.0 Name: zope.intid Version: 3.7.2 Summary: Integer Id Utility Home-page: http://pypi.python.org/pypi/zope.intid Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: 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. ======= CHANGES ======= 3.7.2 (2009-12-27) ------------------ - Use the zope.component API in favor of ztapi. - Removed ``zope.app.testing`` dependency. 3.7.1 (2009-05-18) ------------------ - Remove dependencies on ``zope.container``. Instead import ``Object*Event`` classes from ``zope.lifecycleevent`` and import ``IContained`` from ``zope.location``. In order to be able to do this, depend on ``zope.lifecycleevent``>=3.5.2 and ``zope.location``>=3.5.4. - Remove a dependency on ``zope.container.contained.Contained`` (this is a dumb base class that defines __parent__ and __name__ as None and declares that the class implements IContained). 3.7.0 (2009-02-01) ------------------ - Split out this package from ``zope.app.intid``. The latter one now only contains browser views and compatibility imports while whole IntId functionality is moved here. Keywords: zope3 integer id utility Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.intid-3.7.2/README.txt0000644000000000000000000000044010707747462015256 0ustar rootroot00000000000000This 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. zope.intid-3.7.2/setup.cfg0000644000000000000000000000007311315651434015370 0ustar rootroot00000000000000[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 zope.intid-3.7.2/setup.py0000644000000000000000000000545611315651364015275 0ustar rootroot00000000000000############################################################################## # # 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. # ############################################################################## # This package is developed by the Zope Toolkit project, documented here: # http://docs.zope.org/zopetoolkit # When developing and releasing this package, please follow the documented # Zope Toolkit policies as described by this documentation. ############################################################################## """Setup for zope.intid package $Id: setup.py 107162 2009-12-27 13:28:36Z hannosch $ """ 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.intid', version = '3.7.2', author='Zope Corporation and Contributors', author_email='zope-dev@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://pypi.python.org/pypi/zope.intid', license='ZPL 2.1', packages=find_packages('src'), package_dir = {'': 'src'}, namespace_packages=['zope'], extras_require = dict(test=['zope.testing', 'zope.site', 'zope.traversing', 'zope.container',]), install_requires = ['setuptools', 'ZODB3', 'zope.lifecycleevent>=3.5.2', 'zope.component', 'zope.event', 'zope.interface', 'zope.keyreference', 'zope.location>=3.5.4', 'zope.security', ], include_package_data = True, zip_safe = False, ) zope.intid-3.7.2/src/zope/__init__.py0000644000000000000000000000007011155754322017423 0ustar rootroot00000000000000__import__('pkg_resources').declare_namespace(__name__) zope.intid-3.7.2/src/zope/intid/__init__.py0000644000000000000000000001302011204040444020515 0ustar rootroot00000000000000############################################################################## # # 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: __init__.py 100049 2009-05-17 17:53:56Z chrism $ """ import random import BTrees from persistent import Persistent from zope.component import adapter, getAllUtilitiesRegisteredFor, subscribers from zope.event import notify from zope.interface import implements from zope.keyreference.interfaces import IKeyReference, NotYet from zope.lifecycleevent.interfaces import IObjectAddedEvent from zope.lifecycleevent.interfaces import IObjectRemovedEvent from zope.location.interfaces import ILocation from zope.location.interfaces import IContained from zope.security.proxy import removeSecurityProxy from zope.intid.interfaces import IIntIds, IIntIdEvent from zope.intid.interfaces import IntIdAddedEvent, IntIdRemovedEvent class IntIds(Persistent): """This utility provides a two way mapping between objects and integer ids. IKeyReferences to objects are stored in the indexes. """ implements(IIntIds, IContained) __parent__ = __name__ = None _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] @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 @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)) @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 zope.intid-3.7.2/src/zope/intid/configure.zcml0000644000000000000000000000120711141113350021255 0ustar rootroot00000000000000 zope.intid-3.7.2/src/zope/intid/interfaces.py0000644000000000000000000000542611315565206021127 0ustar rootroot00000000000000""" Interfaces for the unique id utility. $Id: interfaces.py 107139 2009-12-27 06:03:02Z fafhrd $ """ 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(object): """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(object): """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 zope.intid-3.7.2/src/zope/intid/subscribers.zcml0000644000000000000000000000036111120210102021610 0ustar rootroot00000000000000 zope.intid-3.7.2/src/zope/intid/tests.py0000644000000000000000000002614411315565206020146 0ustar rootroot00000000000000############################################################################## # # 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: tests.py 107139 2009-12-27 06:03:02Z fafhrd $ """ import unittest import BTrees from persistent import Persistent from persistent.interfaces import IPersistent from ZODB.interfaces import IConnection from zope.component import getSiteManager from zope.component import provideAdapter from zope.component import provideHandler from zope.component import testing, eventtesting from zope.component.interfaces import ISite, IComponentLookup from zope.interface import implements, Interface from zope.interface.verify import verifyObject from zope.keyreference.persistent import KeyReferenceToPersistent from zope.keyreference.persistent import connectionOfPersistent from zope.keyreference.interfaces import IKeyReference from zope.location.interfaces import ILocation from zope.site.hooks import setSite, setHooks, resetHooks from zope.site.folder import rootFolder from zope.site.site import SiteManagerAdapter, LocalSiteManager from zope.traversing import api from zope.traversing.testing import setUp as traversingSetUp from zope.traversing.interfaces import ITraversable from zope.container.traversal import ContainerTraversable from zope.container.interfaces import ISimpleReadContainer from zope.intid import IntIds, intIdEventNotify from zope.intid.interfaces import IIntIds # Local Utility Addition def addUtility(sitemanager, name, iface, utility, suffix=''): """Add a utility to a site manager This helper function is useful for tests that need to set up utilities. """ folder_name = (name or (iface.__name__ + 'Utility')) + suffix default = sitemanager['default'] default[folder_name] = utility utility = default[folder_name] sitemanager.registerUtility(utility, iface, name) return utility # setup siteManager def createSiteManager(folder, setsite=False): if not ISite.providedBy(folder): folder.setSiteManager(LocalSiteManager(folder)) if setsite: setSite(folder) return api.traverse(folder, "++etc++site") 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): testing.setUp() eventtesting.setUp() traversingSetUp() setHooks() provideAdapter(ContainerTraversable, (ISimpleReadContainer,), ITraversable) provideAdapter(SiteManagerAdapter, (Interface,), IComponentLookup) self.root = rootFolder() createSiteManager(self.root, setsite=True) provideAdapter(connectionOfPersistent, (IPersistent, ), IConnection) provideAdapter( KeyReferenceToPersistent, (IPersistent, ), IKeyReference) def tearDown(self): resetHooks() setSite() testing.tearDown() 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 ReferenceSetupMixin.setUp(self) sm = getSiteManager(self.root) self.utility = 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 = createSiteManager(self.folder1_1) self.utility1 = addUtility(sm1_1, '2', IIntIds, IntIds()) provideHandler(intIdEventNotify) def test_removeIntIdSubscriber(self): from zope.lifecycleevent import ObjectRemovedEvent from zope.intid import removeIntIdSubscriber from zope.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)) provideHandler(events.append, [IIntIdRemovedEvent]) provideHandler(appendObjectEvent, [IFolder, IIntIdRemovedEvent]) # 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.lifecycleevent import ObjectAddedEvent from zope.intid import addIntIdSubscriber from zope.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)) provideHandler(events.append, [IIntIdAddedEvent]) provideHandler(appendObjectEvent, [IFolder, IIntIdAddedEvent]) # 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) def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestIntIds)) suite.addTest(unittest.makeSuite(TestIntIds64)) suite.addTest(unittest.makeSuite(TestSubscribers)) return suite if __name__ == '__main__': unittest.main() zope.intid-3.7.2/src/zope.intid.egg-info/dependency_links.txt0000644000000000000000000000000111315651434024161 0ustar rootroot00000000000000 zope.intid-3.7.2/src/zope.intid.egg-info/namespace_packages.txt0000644000000000000000000000000511315651434024441 0ustar rootroot00000000000000zope zope.intid-3.7.2/src/zope.intid.egg-info/not-zip-safe0000644000000000000000000000000111315435416022341 0ustar rootroot00000000000000 zope.intid-3.7.2/src/zope.intid.egg-info/PKG-INFO0000644000000000000000000000413111315651434021207 0ustar rootroot00000000000000Metadata-Version: 1.0 Name: zope.intid Version: 3.7.2 Summary: Integer Id Utility Home-page: http://pypi.python.org/pypi/zope.intid Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: 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. ======= CHANGES ======= 3.7.2 (2009-12-27) ------------------ - Use the zope.component API in favor of ztapi. - Removed ``zope.app.testing`` dependency. 3.7.1 (2009-05-18) ------------------ - Remove dependencies on ``zope.container``. Instead import ``Object*Event`` classes from ``zope.lifecycleevent`` and import ``IContained`` from ``zope.location``. In order to be able to do this, depend on ``zope.lifecycleevent``>=3.5.2 and ``zope.location``>=3.5.4. - Remove a dependency on ``zope.container.contained.Contained`` (this is a dumb base class that defines __parent__ and __name__ as None and declares that the class implements IContained). 3.7.0 (2009-02-01) ------------------ - Split out this package from ``zope.app.intid``. The latter one now only contains browser views and compatibility imports while whole IntId functionality is moved here. Keywords: zope3 integer id utility Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.intid-3.7.2/src/zope.intid.egg-info/requires.txt0000644000000000000000000000030711315651434022513 0ustar rootroot00000000000000setuptools ZODB3 zope.lifecycleevent>=3.5.2 zope.component zope.event zope.interface zope.keyreference zope.location>=3.5.4 zope.security [test] zope.testing zope.site zope.traversing zope.containerzope.intid-3.7.2/src/zope.intid.egg-info/SOURCES.txt0000644000000000000000000000075511315651434022006 0ustar rootroot00000000000000CHANGES.txt README.txt bootstrap.py buildout.cfg setup.py src/zope/__init__.py src/zope.intid.egg-info/PKG-INFO src/zope.intid.egg-info/SOURCES.txt src/zope.intid.egg-info/dependency_links.txt src/zope.intid.egg-info/namespace_packages.txt src/zope.intid.egg-info/not-zip-safe src/zope.intid.egg-info/requires.txt src/zope.intid.egg-info/top_level.txt src/zope/intid/__init__.py src/zope/intid/configure.zcml src/zope/intid/interfaces.py src/zope/intid/subscribers.zcml src/zope/intid/tests.pyzope.intid-3.7.2/src/zope.intid.egg-info/top_level.txt0000644000000000000000000000000511315651434022640 0ustar rootroot00000000000000zope