zope.app.broken-3.6.0/000755 000766 000024 00000000000 11447374774 014461 5ustar00macstaff000000 000000 zope.app.broken-3.6.0/CHANGES.txt000644 000766 000024 00000001053 11447374764 016270 0ustar00macstaff000000 000000 ======= CHANGES ======= 3.6.0 (2010-09-25) ------------------ - Depend on new ``zope.processlifetime`` interfaces and implementations instead of using BBB imports from ``zope.app.appsetup``. - Added test extra to declare test dependency on ``zope.testing``. - Using Python's ``doctest`` module instead of depreacted ``zope.testing.doctest``. 3.5.0 (2009-02-05) ------------------ - Depend on new ``zope.broken`` package for the ``IBroken`` interface. 3.4.0 (2007-10-11) ------------------ - Initial release independent of the main Zope tree. zope.app.broken-3.6.0/PKG-INFO000644 000766 000024 00000003300 11447374774 015552 0ustar00macstaff000000 000000 Metadata-Version: 1.0 Name: zope.app.broken Version: 3.6.0 Summary: Zope Broken (ZODB) Object Support Home-page: http://cheeseshop.python.org/pypi/zope.app.broken Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: When an object cannot be correctly loaded from the ZODB, this package allows this object still to be instantiated, but as a "Broken" object. This allows for gracefully updating the database without interuption. ======= CHANGES ======= 3.6.0 (2010-09-25) ------------------ - Depend on new ``zope.processlifetime`` interfaces and implementations instead of using BBB imports from ``zope.app.appsetup``. - Added test extra to declare test dependency on ``zope.testing``. - Using Python's ``doctest`` module instead of depreacted ``zope.testing.doctest``. 3.5.0 (2009-02-05) ------------------ - Depend on new ``zope.broken`` package for the ``IBroken`` interface. 3.4.0 (2007-10-11) ------------------ - Initial release independent of the main Zope tree. Keywords: zope3 content provider 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.app.broken-3.6.0/README.txt000644 000766 000024 00000000323 11447374764 016154 0ustar00macstaff000000 000000 When an object cannot be correctly loaded from the ZODB, this package allows this object still to be instantiated, but as a "Broken" object. This allows for gracefully updating the database without interuption. zope.app.broken-3.6.0/bootstrap.py000644 000766 000024 00000003370 11447374764 017052 0ustar00macstaff000000 000000 ############################################################################## # # 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 73528 2007-03-25 07:03:34Z dobe $ """ 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.app.broken-3.6.0/buildout.cfg000644 000766 000024 00000000151 11447374764 016765 0ustar00macstaff000000 000000 [buildout] develop = . parts = test [test] recipe = zc.recipe.testrunner eggs = zope.app.broken [test] zope.app.broken-3.6.0/setup.cfg000644 000766 000024 00000000073 11447374774 016302 0ustar00macstaff000000 000000 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 zope.app.broken-3.6.0/setup.py000644 000766 000024 00000005177 11447374764 016204 0ustar00macstaff000000 000000 ############################################################################## # # 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.app.broken package $Id: setup.py 116914 2010-09-25 13:32:03Z icemac $ """ 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.broken', version='3.6.0', author='Zope Corporation and Contributors', author_email='zope-dev@zope.org', description='Zope Broken (ZODB) Object Support', long_description=( read('README.txt') + '\n\n' + read('CHANGES.txt') ), keywords = "zope3 content provider", 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.broken', license='ZPL 2.1', packages=find_packages('src'), package_dir = {'': 'src'}, namespace_packages=['zope', 'zope.app'], install_requires=['setuptools', 'zope.interface', 'zope.location', 'zope.security', 'zope.annotation', 'zope.broken', 'zope.processlifetime', 'ZODB3'], extras_require=dict( test=[ 'zope.testing', ]), include_package_data = True, zip_safe = False, ) zope.app.broken-3.6.0/src/000755 000766 000024 00000000000 11447374774 015250 5ustar00macstaff000000 000000 zope.app.broken-3.6.0/src/zope/000755 000766 000024 00000000000 11447374774 016225 5ustar00macstaff000000 000000 zope.app.broken-3.6.0/src/zope.app.broken.egg-info/000755 000766 000024 00000000000 11447374774 021755 5ustar00macstaff000000 000000 zope.app.broken-3.6.0/src/zope.app.broken.egg-info/PKG-INFO000644 000766 000024 00000003300 11447374774 023046 0ustar00macstaff000000 000000 Metadata-Version: 1.0 Name: zope.app.broken Version: 3.6.0 Summary: Zope Broken (ZODB) Object Support Home-page: http://cheeseshop.python.org/pypi/zope.app.broken Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: When an object cannot be correctly loaded from the ZODB, this package allows this object still to be instantiated, but as a "Broken" object. This allows for gracefully updating the database without interuption. ======= CHANGES ======= 3.6.0 (2010-09-25) ------------------ - Depend on new ``zope.processlifetime`` interfaces and implementations instead of using BBB imports from ``zope.app.appsetup``. - Added test extra to declare test dependency on ``zope.testing``. - Using Python's ``doctest`` module instead of depreacted ``zope.testing.doctest``. 3.5.0 (2009-02-05) ------------------ - Depend on new ``zope.broken`` package for the ``IBroken`` interface. 3.4.0 (2007-10-11) ------------------ - Initial release independent of the main Zope tree. Keywords: zope3 content provider 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.app.broken-3.6.0/src/zope.app.broken.egg-info/SOURCES.txt000644 000766 000024 00000001231 11447374774 023636 0ustar00macstaff000000 000000 CHANGES.txt README.txt bootstrap.py buildout.cfg setup.py src/zope/__init__.py src/zope.app.broken.egg-info/PKG-INFO src/zope.app.broken.egg-info/SOURCES.txt src/zope.app.broken.egg-info/dependency_links.txt src/zope.app.broken.egg-info/namespace_packages.txt src/zope.app.broken.egg-info/not-zip-safe src/zope.app.broken.egg-info/requires.txt src/zope.app.broken.egg-info/top_level.txt src/zope/app/__init__.py src/zope/app/broken/__init__.py src/zope/app/broken/broken.gif src/zope/app/broken/broken.pt src/zope/app/broken/broken.py src/zope/app/broken/browser.zcml src/zope/app/broken/configure.zcml src/zope/app/broken/interfaces.py src/zope/app/broken/tests.pyzope.app.broken-3.6.0/src/zope.app.broken.egg-info/dependency_links.txt000644 000766 000024 00000000001 11447374774 026023 0ustar00macstaff000000 000000 zope.app.broken-3.6.0/src/zope.app.broken.egg-info/namespace_packages.txt000644 000766 000024 00000000016 11447374774 026305 0ustar00macstaff000000 000000 zope zope.app zope.app.broken-3.6.0/src/zope.app.broken.egg-info/not-zip-safe000644 000766 000024 00000000001 11447374765 024203 0ustar00macstaff000000 000000 zope.app.broken-3.6.0/src/zope.app.broken.egg-info/requires.txt000644 000766 000024 00000000201 11447374774 024346 0ustar00macstaff000000 000000 setuptools zope.interface zope.location zope.security zope.annotation zope.broken zope.processlifetime ZODB3 [test] zope.testingzope.app.broken-3.6.0/src/zope.app.broken.egg-info/top_level.txt000644 000766 000024 00000000005 11447374774 024502 0ustar00macstaff000000 000000 zope zope.app.broken-3.6.0/src/zope/__init__.py000644 000766 000024 00000000311 11447374764 020330 0ustar00macstaff000000 000000 # this is a namespace package try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) zope.app.broken-3.6.0/src/zope/app/000755 000766 000024 00000000000 11447374774 017005 5ustar00macstaff000000 000000 zope.app.broken-3.6.0/src/zope/app/__init__.py000644 000766 000024 00000000311 11447374764 021110 0ustar00macstaff000000 000000 # this is a namespace package try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) zope.app.broken-3.6.0/src/zope/app/broken/000755 000766 000024 00000000000 11447374774 020265 5ustar00macstaff000000 000000 zope.app.broken-3.6.0/src/zope/app/broken/__init__.py000644 000766 000024 00000000041 11447374764 022370 0ustar00macstaff000000 000000 # Make this directory a package. zope.app.broken-3.6.0/src/zope/app/broken/broken.gif000644 000766 000024 00000001576 11447374764 022244 0ustar00macstaff000000 000000 GIF89a÷ÿÿPPP€€€ÀÀÀÿ€@ @€€€@@ÿÿÿÿ€€€@€€ÿÿÿ!ù,[Hp €ƒ*\ˆPaB…".|€bÄ‹3ˆXà ÄŽAÉ‘!Ń6"`ÈÒãJ“ UŠDy²cÉ‘)+f\˜s§NYR|fÖ>O¶Z°i€€;zope.app.broken-3.6.0/src/zope/app/broken/broken.pt000644 000766 000024 00000001036 11447374764 022111 0ustar00macstaff000000 000000

This object is broken because its class can not be found.

This is probably because the module of the class, somemodule, can't be found or because the name, someclass, is no longer defined by the module.

zope.app.broken-3.6.0/src/zope/app/broken/broken.py000644 000766 000024 00000007465 11447374764 022132 0ustar00macstaff000000 000000 ############################################################################## # # Copyright (c) 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. # ############################################################################## """Broken-object support $Id: broken.py 100901 2009-06-12 19:09:34Z icemac $ """ __docformat__ = 'restructuredtext' import ZODB.broken import zope.interface import zope.location.interfaces import zope.security.checker from zope.broken.interfaces import IBroken from zope.annotation.interfaces import IAnnotations class Broken(ZODB.broken.Broken): zope.interface.implements( IBroken, zope.location.interfaces.ILocation, IAnnotations, ) def __parent__(self): return self.__Broken_state__.get('__parent__') __parent__ = property(__parent__) def __name__(self): return self.__Broken_state__.get('__name__') __name__ = property(__name__) def __getAnnotations(self): get = getattr(self.__Broken_state__, 'get', None) if get is not None: return get('__annotations__') def __getitem__(self, key): annotations = self.__getAnnotations() if annotations: return annotations[key] raise KeyError(key) def __setitem__(self, key, value): raise ZODB.broken.BrokenModified("Can't modify broken objects") def __delitem__(self, key): raise ZODB.broken.BrokenModified("Can't modify broken objects") def get(self, key, default=None): annotations = self.__getAnnotations() if annotations is None: return default return annotations.get(key, default) def installBroken(event): """Install a class factory that handled broken objects This method installs a custom class factory when it gets a database-opened event:: >>> import ZODB.tests.util >>> from zope.processlifetime import DatabaseOpened >>> db = ZODB.tests.util.DB() >>> installBroken(DatabaseOpened(db)) If someone tries to load an object for which there is no class, then they will get a `Broken` object. We can simulate that by calling the database's class factory directly with a connection (None will do for our purposes, since the class factory function we register ignores the connection argument), a non-existent module and class name:: >>> cls = db.classFactory(None, 'ZODB.not.there', 'atall') The class that comes back is a subclass of `Broken`:: >>> issubclass(cls, Broken) True It implements ILocation and IAnnotations:: >>> zope.location.interfaces.ILocation.implementedBy(cls) True >>> IAnnotations.implementedBy(cls) True and it has a security checker that is the same as the checker that `Broken` has:: >>> (cls.__Security_checker__ is ... zope.security.checker.getCheckerForInstancesOf(Broken)) True Cleanup: >>> ZODB.broken.broken_cache.clear() """ Broken_ = Broken # make it local for speed find_global = ZODB.broken.find_global def type_(name, bases, dict): cls = type(name, bases, dict) checker = zope.security.checker.getCheckerForInstancesOf(Broken_) cls.__Security_checker__ = checker return cls def classFactory(connection, modulename, globalname): return find_global(modulename, globalname, Broken_, type_) event.database.classFactory = classFactory zope.app.broken-3.6.0/src/zope/app/broken/browser.zcml000644 000766 000024 00000000554 11447374764 022642 0ustar00macstaff000000 000000 zope.app.broken-3.6.0/src/zope/app/broken/configure.zcml000644 000766 000024 00000000551 11447374764 023135 0ustar00macstaff000000 000000 zope.app.broken-3.6.0/src/zope/app/broken/interfaces.py000644 000766 000024 00000001457 11447374764 022770 0ustar00macstaff000000 000000 ############################################################################## # # Copyright (c) 2007 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. # ############################################################################## """zope.app.broken interfaces. $Id: interfaces.py 96094 2009-02-04 22:10:08Z tseaver $ """ __docformat__ = "reStructuredText" from zope.broken.interfaces import IBroken # BBB zope.app.broken-3.6.0/src/zope/app/broken/tests.py000644 000766 000024 00000004435 11447374764 022006 0ustar00macstaff000000 000000 ############################################################################## # # Copyright (c) 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. # ############################################################################## """Broken-object tests $Id: tests.py 116913 2010-09-25 13:31:51Z icemac $ """ import unittest from doctest import DocTestSuite def test_annotations(): """Broken objects may have attribute annotations If they do, we can access them:: >>> from zope.app.broken.broken import Broken >>> b = Broken() >>> b.__setstate__({'__annotations__': {'foo.bar': 42}}) >>> b['foo.bar'] 42 >>> b.get('foo.bar') 42 Missing keys are handled as expected: >>> b['foo.baz'] Traceback (most recent call last): ... KeyError: 'foo.baz' >>> b.get('foo.baz') It is an error to modify annotations: >>> b['foo.baz'] = [] Traceback (most recent call last): ... BrokenModified: Can't modify broken objects >>> del b['foo.bar'] Traceback (most recent call last): ... BrokenModified: Can't modify broken objects If there are no annotation data, then, obviously, there are no annotations: >>> b = Broken() >>> b['foo.bar'] Traceback (most recent call last): ... KeyError: 'foo.bar' >>> b.get('foo.bar') >>> b['foo.bar'] = [] Traceback (most recent call last): ... BrokenModified: Can't modify broken objects >>> del b['foo.bar'] Traceback (most recent call last): ... BrokenModified: Can't modify broken objects Cleanup: >>> import ZODB.broken >>> ZODB.broken.broken_cache.clear() """ def test_suite(): return unittest.TestSuite(( DocTestSuite(), DocTestSuite('zope.app.broken.broken'), )) if __name__ == '__main__': unittest.main()