[Zope-Checkins] SVN: Products.Five/branches/philikon-fix-lookup-priorities/traversable.py 1. Let's not be too ambitious and try to solve WebDAV issues that we don't know
Log message for revision 66177: 1. Let's not be too ambitious and try to solve WebDAV issues that we don't know are actually there. 2. ZPublisher now makes sure that the request has the default skin Changed: U Products.Five/branches/philikon-fix-lookup-priorities/traversable.py -=- Modified: Products.Five/branches/philikon-fix-lookup-priorities/traversable.py === --- Products.Five/branches/philikon-fix-lookup-priorities/traversable.py 2006-03-26 16:35:54 UTC (rev 66176) +++ Products.Five/branches/philikon-fix-lookup-priorities/traversable.py 2006-03-26 16:37:30 UTC (rev 66177) @@ -30,8 +30,6 @@ from zExceptions import NotFound from ZPublisher import xmlrpc -_marker = object - class FakeRequest(dict): implements(IBrowserRequest) @@ -57,8 +55,8 @@ # behaviour as much as possible. Therefore the first part of # this method is based on BaseRequest.traverse's behaviour: # 1. If an object has __bobo_traverse__, use it -# 2. Otherwise do attribute look-up (w/o acquisition if necessary) -# 3. If that doesn't work, try key item lookup. +# 2. Otherwise do attribute look-up or, if that doesn't work, +#key item lookup. if hasattr(self, '__fallback_traverse__'): try: @@ -66,39 +64,18 @@ except (AttributeError, KeyError): pass else: -# Note - no_acquire_flag is necessary to support things -# like DAV. We have to make sure that the target object -# is not acquired if the request_method is other than GET -# or POST. Otherwise, you could never use PUT to add a new -# object named 'test' if an object 'test' existed above it -# in the heirarchy -- you'd always get the existing object -# :( -no_acquire_flag = False -method = REQUEST.get('REQUEST_METHOD', 'GET').upper() -if ((method not in ('GET', 'POST') or - isinstance(getattr(REQUEST, 'response', {}), xmlrpc.Response)) -and getattr(REQUEST, 'maybe_webdav_client', False)): -# Probably a WebDAV client. -no_acquire_flag = True - try: -if (no_acquire_flag and -len(REQUEST['TraversalRequestNameStack']) == 0 and -hasattr(self, 'aq_base')): -if hasattr(self.aq_base, name): -return getattr(self, name) -else: -pass # attribute not found -else: -return getattr(self, name) +return getattr(self, name) except AttributeError: -try: -return self[name] -except (KeyError, IndexError, TypeError, AttributeError): -pass # key not found +pass +try: +return self[name] +except (KeyError, IndexError, TypeError, AttributeError): +pass + # This is the part Five adds: -# 4. If neither __bobo_traverse__ nor attribute/key look-up +# 3. If neither __bobo_traverse__ nor attribute/key look-up # work, we try to find a Zope 3-style view # For that we need to make sure we have a good request @@ -108,15 +85,11 @@ REQUEST = getattr(self, 'REQUEST', None) if not IBrowserRequest.providedBy(REQUEST): REQUEST = FakeRequest() +setDefaultSkin(REQUEST) # Con Zope 3 into using Zope 2's checkPermission Products.Five.security.newInteraction() -# Set the default skin on the request if it doesn't have any -# layers set on it yet -if queryType(REQUEST, ILayer) is None: -setDefaultSkin(REQUEST) - # Use the ITraverser adapter (which in turn uses ITraversable # adapters) to traverse to a view. Note that we're mixing # object-graph and object-publishing traversal here, but Zope ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/test_XMLExportImport.py Add tests for collector #2051.
Log message for revision 66178: Add tests for collector #2051. Changed: A Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/test_XMLExportImport.py -=- Added: Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/test_XMLExportImport.py === --- Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/test_XMLExportImport.py 2006-03-26 16:37:30 UTC (rev 66177) +++ Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/test_XMLExportImport.py 2006-03-26 18:54:44 UTC (rev 66178) @@ -0,0 +1,112 @@ +## +# +# 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 +# +## +import unittest +import tempfile +import transaction +from StringIO import StringIO + +_LONG_DTML = '\n'.join([('dtml-var foo%d' % x) for x in xrange(1000)]) + +class XMLExportImportTests(unittest.TestCase): + +def _makeJarAndRoot(self): +import ZODB +from OFS.Folder import Folder +from ZODB.DemoStorage import DemoStorage + +CACHESIZE = 5 # something tiny +LOOPCOUNT = CACHESIZE * 10 +storage = DemoStorage(Test) +db = ZODB.DB(storage, cache_size=CACHESIZE) +connection = db.open() +root = connection.root() +app = Folder('app') +root['app'] = app + +return connection, app + +def test_export_import_as_string_idempotent(self): +from OFS.DTMLMethod import DTMLMethod +from OFS.XMLExportImport import exportXML +from OFS.XMLExportImport import importXML + +connection, app = self._makeJarAndRoot() +dm = DTMLMethod('test') +dm.munge(_LONG_DTML) +app._setObject('test', dm) +transaction.savepoint(optimistic=True) # need an OID! +oid = dm._p_oid + +stream = StringIO() + +data = exportXML(connection, oid, stream) +stream.seek(0) + +newobj = importXML(connection, stream) +self.failUnless(isinstance(newobj, DTMLMethod)) +self.assertEqual(newobj.read(), dm.read()) + +def test_export_import_as_file_idempotent(self): +from OFS.DTMLMethod import DTMLMethod +from OFS.XMLExportImport import exportXML +from OFS.XMLExportImport import importXML + +connection, app = self._makeJarAndRoot() +dm = DTMLMethod('test') +dm.munge(_LONG_DTML) +app._setObject('test', dm) +transaction.savepoint(optimistic=True) # need an OID! +oid = dm._p_oid + +ostream = tempfile.NamedTemporaryFile(suffix='.xml') +try: +data = exportXML(connection, oid, ostream) +ostream.flush() +newobj = importXML(connection, ostream.name) +finally: +ostream.close() + +self.failUnless(isinstance(newobj, DTMLMethod)) +self.assertEqual(newobj.read(), dm.read()) + +def test_OFS_ObjectManager__importObjectFromFile_xml(self): +from OFS.DTMLMethod import DTMLMethod +from OFS.Folder import Folder +from OFS.XMLExportImport import exportXML + +connection, app = self._makeJarAndRoot() +dm = DTMLMethod('test') +dm._setId('test') +dm.munge(_LONG_DTML) +app._setObject('test', dm) +sub = Folder('sub') +app._setObject('sub', sub) +transaction.savepoint(optimistic=True) # need an OID! +oid = dm._p_oid +sub = app._getOb('sub') + +ostream = tempfile.NamedTemporaryFile(suffix='.xml') +try: +data = exportXML(connection, oid, ostream) +ostream.flush() +sub._importObjectFromFile(ostream.name, 0, 0) +finally: +ostream.close() + +def test_suite(): +return unittest.TestSuite(( +unittest.makeSuite(XMLExportImportTests), +)) + +if __name__ == '__main__': +unittest.main(defaultTest='test_suite') Property changes on: Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/test_XMLExportImport.py ___ Name: svn:keywords + Id Name: svn:eol-style + native ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/ Added tests for collector #2051.
Log message for revision 66179: Added tests for collector #2051. Changed: U Zope/branches/2.9/doc/CHANGES.txt U Zope/branches/2.9/lib/python/OFS/XMLExportImport.py A Zope/branches/2.9/lib/python/OFS/tests/test_XMLExportImport.py -=- Modified: Zope/branches/2.9/doc/CHANGES.txt === --- Zope/branches/2.9/doc/CHANGES.txt 2006-03-26 18:54:44 UTC (rev 66178) +++ Zope/branches/2.9/doc/CHANGES.txt 2006-03-26 18:57:20 UTC (rev 66179) @@ -18,8 +18,8 @@ Bugs fixed - - Applied patch by Yoshinori Okuji to fix some XML export/import -problems + - Collector #2051: Applied patch by Yoshinori Okuji to fix some +XML export/import problems, and added tests for that feature. - Missing import of NotFound in webdav.Resource. Modified: Zope/branches/2.9/lib/python/OFS/XMLExportImport.py === --- Zope/branches/2.9/lib/python/OFS/XMLExportImport.py 2006-03-26 18:54:44 UTC (rev 66178) +++ Zope/branches/2.9/lib/python/OFS/XMLExportImport.py 2006-03-26 18:57:20 UTC (rev 66179) @@ -98,7 +98,7 @@ def importXML(jar, file, clue=''): import xml.parsers.expat if type(file) is str: -file=open(file) +file=open(file, 'rb') outfile=TemporaryFile() data=file.read() F=ppml.xmlPickler() Added: Zope/branches/2.9/lib/python/OFS/tests/test_XMLExportImport.py === --- Zope/branches/2.9/lib/python/OFS/tests/test_XMLExportImport.py 2006-03-26 18:54:44 UTC (rev 66178) +++ Zope/branches/2.9/lib/python/OFS/tests/test_XMLExportImport.py 2006-03-26 18:57:20 UTC (rev 66179) @@ -0,0 +1,112 @@ +## +# +# 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 +# +## +import unittest +import tempfile +import transaction +from StringIO import StringIO + +_LONG_DTML = '\n'.join([('dtml-var foo%d' % x) for x in xrange(1000)]) + +class XMLExportImportTests(unittest.TestCase): + +def _makeJarAndRoot(self): +import ZODB +from OFS.Folder import Folder +from ZODB.DemoStorage import DemoStorage + +CACHESIZE = 5 # something tiny +LOOPCOUNT = CACHESIZE * 10 +storage = DemoStorage(Test) +db = ZODB.DB(storage, cache_size=CACHESIZE) +connection = db.open() +root = connection.root() +app = Folder('app') +root['app'] = app + +return connection, app + +def test_export_import_as_string_idempotent(self): +from OFS.DTMLMethod import DTMLMethod +from OFS.XMLExportImport import exportXML +from OFS.XMLExportImport import importXML + +connection, app = self._makeJarAndRoot() +dm = DTMLMethod('test') +dm.munge(_LONG_DTML) +app._setObject('test', dm) +transaction.savepoint(optimistic=True) # need an OID! +oid = dm._p_oid + +stream = StringIO() + +data = exportXML(connection, oid, stream) +stream.seek(0) + +newobj = importXML(connection, stream) +self.failUnless(isinstance(newobj, DTMLMethod)) +self.assertEqual(newobj.read(), dm.read()) + +def test_export_import_as_file_idempotent(self): +from OFS.DTMLMethod import DTMLMethod +from OFS.XMLExportImport import exportXML +from OFS.XMLExportImport import importXML + +connection, app = self._makeJarAndRoot() +dm = DTMLMethod('test') +dm.munge(_LONG_DTML) +app._setObject('test', dm) +transaction.savepoint(optimistic=True) # need an OID! +oid = dm._p_oid + +ostream = tempfile.NamedTemporaryFile(suffix='.xml') +try: +data = exportXML(connection, oid, ostream) +ostream.flush() +newobj = importXML(connection, ostream.name) +finally: +ostream.close() + +self.failUnless(isinstance(newobj, DTMLMethod)) +self.assertEqual(newobj.read(), dm.read()) + +def test_OFS_ObjectManager__importObjectFromFile_xml(self): +from OFS.DTMLMethod import DTMLMethod +from OFS.Folder import Folder +from OFS.XMLExportImport import exportXML + +connection, app = self._makeJarAndRoot() +dm = DTMLMethod('test') +dm._setId('test') +dm.munge(_LONG_DTML) +
[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/ update to latest revision of ZODB 3.6 for upcoming release
Log message for revision 66185: update to latest revision of ZODB 3.6 for upcoming release Changed: _U Zope/branches/2.9/lib/python/ -=- Property changes on: Zope/branches/2.9/lib/python ___ Name: svn:externals - ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/BTrees persistent -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/persistent ThreadedAsync -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ThreadedAsync transaction-r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/transaction ZEO-r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZEO ZODB -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZODB ZopeUndo -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/pytz zodbcode -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/zodbcode ClientCookie -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/ClientCookie mechanize -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/mechanize + ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/BTrees persistent -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/persistent ThreadedAsync -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ThreadedAsync transaction-r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/transaction ZEO-r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZEO ZODB -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZODB ZopeUndo -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/pytz zodbcode -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/zodbcode ClientCookie -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/ClientCookie mechanize -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/mechanize ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/philikon-fix-lookup-priorities/CHANGES.txt report changes for this branch
Log message for revision 66187: report changes for this branch Changed: U Products.Five/branches/philikon-fix-lookup-priorities/CHANGES.txt -=- Modified: Products.Five/branches/philikon-fix-lookup-priorities/CHANGES.txt === --- Products.Five/branches/philikon-fix-lookup-priorities/CHANGES.txt 2006-03-26 20:09:06 UTC (rev 66186) +++ Products.Five/branches/philikon-fix-lookup-priorities/CHANGES.txt 2006-03-26 20:09:42 UTC (rev 66187) @@ -4,7 +4,20 @@ Five 1.3.3 (unreleased) === - + +Bugfixes + + +* Fixed look-up order during Five traversal. It is now as follows: + + 1. If an object has __bobo_traverse__, use it. + + 2. Otherwise do attribute look-up or, if that doesn't work, key item + lookup. + + 3. If neither __bobo_traverse__ nor attribute/key look-up work, it + tries to find a Zope 3-style view. + * A local utility registered with an derived interface will now be available by the inherited interface as well, in the same way as Zope3. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/ Move to Zope 3.2.1, which also means we have to include copies of pullparser
Log message for revision 66188: Move to Zope 3.2.1, which also means we have to include copies of pullparser and ClientForm (zope.testbrowser dependencies) now. Changed: _U Zope/branches/2.9/lib/python/ A Zope/branches/2.9/lib/python/ClientForm.py A Zope/branches/2.9/lib/python/pullparser.py _U Zope/branches/2.9/lib/python/zope/ -=- Property changes on: Zope/branches/2.9/lib/python ___ Name: svn:externals - ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/BTrees persistent -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/persistent ThreadedAsync -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ThreadedAsync transaction-r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/transaction ZEO-r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZEO ZODB -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZODB ZopeUndo -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/pytz zodbcode -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/zodbcode ClientCookie -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/ClientCookie mechanize -r 40992 svn://svn.zope.org/repos/main/Zope3/branches/3.2/src/mechanize + ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/BTrees persistent -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/persistent ThreadedAsync -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ThreadedAsync transaction-r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/transaction ZEO-r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZEO ZODB -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZODB ZopeUndo -r 66124 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.1/src/pytz zodbcode svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.1/src/zodbcode ClientCookie svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.1/src/ClientCookie mechanize svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.1/src/mechanize Copied: Zope/branches/2.9/lib/python/ClientForm.py (from rev 66185, Zope3/branches/3.2/src/ClientForm.py) Copied: Zope/branches/2.9/lib/python/pullparser.py (from rev 66185, Zope3/branches/3.2/src/pullparser.py) Property changes on: Zope/branches/2.9/lib/python/zope ___ Name: svn:externals - app svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/app cachedescriptors svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/cachedescriptors component svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/component configuration svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/configuration documenttemplate svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/documenttemplate event svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/event exceptions svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/exceptions hookable svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/hookable i18n svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/i18n i18nmessageid svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/i18nmessageid interface svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/interface modulealias svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/modulealias pagetemplate svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/pagetemplate proxy svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/proxy publisher svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/publisher schema svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/schema security svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/security server svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/server structuredtext svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/structuredtext tal svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/tal tales svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0/src/zope/tales thread
[Zope-Checkins] SVN: Products.Five/branches/1.4/pythonproducts.py Fixed up the placement of global statements for _zope_app.
Log message for revision 66189: Fixed up the placement of global statements for _zope_app. Changed: U Products.Five/branches/1.4/pythonproducts.py -=- Modified: Products.Five/branches/1.4/pythonproducts.py === --- Products.Five/branches/1.4/pythonproducts.py2006-03-26 20:25:40 UTC (rev 66188) +++ Products.Five/branches/1.4/pythonproducts.py2006-03-26 20:30:29 UTC (rev 66189) @@ -33,12 +33,12 @@ from OFS.Application import Application +global _zope_app if isinstance(appOrContext, Application): _zope_app = appOrContext else: _zope_app = appOrContext._ProductContext__app -global _zope_app applyPatches(_zope_app) @@ -87,8 +87,8 @@ from App.FactoryDispatcher import FactoryDispatcher, ProductDispatcher +global _original__bobo_traverse__ _original__bobo_traverse__ = ProductDispatcher.__bobo_traverse__ -global _original__bobo_traverse__ def __bobo_traverse__(self, REQUEST, name): product=self.aq_acquire('_getProducts')()._product(name) @@ -115,8 +115,8 @@ from App import Extensions, FactoryDispatcher from Products.ExternalMethod import ExternalMethod +global _originalGetPath _originalGetPath = Extensions.getPath -global _originalGetPath def getPath(prefix, name, checkProduct=1, suffixes=('',)): Make sure to check paths of all registered product packages. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.3/ Merge philikon-fix-lookup-priorities and fix up doc files for upcoming
Log message for revision 66191: Merge philikon-fix-lookup-priorities and fix up doc files for upcoming release. Changed: U Products.Five/branches/1.3/CHANGES.txt U Products.Five/branches/1.3/INSTALL.txt U Products.Five/branches/1.3/browser/tests/test_traversable.py U Products.Five/branches/1.3/fiveconfigure.py U Products.Five/branches/1.3/tests/testing/fancycontent.py U Products.Five/branches/1.3/traversable.py U Products.Five/branches/1.3/version.txt -=- Modified: Products.Five/branches/1.3/CHANGES.txt === --- Products.Five/branches/1.3/CHANGES.txt 2006-03-26 20:40:18 UTC (rev 66190) +++ Products.Five/branches/1.3/CHANGES.txt 2006-03-26 20:42:53 UTC (rev 66191) @@ -2,9 +2,24 @@ Five Changes -Five 1.3.3 (unreleased) +Five 1.3.3 (2006-03-26) === - + +Bugfixes + + +* Fixed look-up order during Five traversal. It is now as follows: + + 1. If an object has __bobo_traverse__, use it. + + 2. Otherwise do attribute look-up or, if that doesn't work, key item + lookup. + + 3. If neither __bobo_traverse__ nor attribute/key look-up work, it + tries to find a Zope 3-style view. + + This change requires Zope 2.9.2 or higher. + * A local utility registered with an derived interface will now be available by the inherited interface as well, in the same way as Zope3. Modified: Products.Five/branches/1.3/INSTALL.txt === --- Products.Five/branches/1.3/INSTALL.txt 2006-03-26 20:40:18 UTC (rev 66190) +++ Products.Five/branches/1.3/INSTALL.txt 2006-03-26 20:42:53 UTC (rev 66191) @@ -4,7 +4,7 @@ Requirements for Five 1.3 - -* Zope 2.9+ with Python 2.4.1+ +* Zope 2.9.2+ with Python 2.4.1+ Note that Five 1.3 is already part of Zope 2.9. You can still install a newer Five version in your instance, if you like. It will override Modified: Products.Five/branches/1.3/browser/tests/test_traversable.py === --- Products.Five/branches/1.3/browser/tests/test_traversable.py 2006-03-26 20:40:18 UTC (rev 66190) +++ Products.Five/branches/1.3/browser/tests/test_traversable.py 2006-03-26 20:42:53 UTC (rev 66191) @@ -67,7 +67,8 @@ ... five:traversable ... class=Products.Five.tests.testing.FiveTraversableFolder ... / - ... + ... + ... !-- this view will never be found -- ... browser:page ... for=Products.Five.tests.testing.fancycontent.IFancyContent ... class=Products.Five.browser.tests.pages.FancyView @@ -75,7 +76,21 @@ ... name=fancyview ... permission=zope2.Public ... / - ... + ... !-- these two will -- + ... browser:page + ... for=Products.Five.tests.testing.fancycontent.IFancyContent + ... class=Products.Five.browser.tests.pages.FancyView + ... attribute=view + ... name=raise-attributeerror + ... permission=zope2.Public + ... / + ... browser:page + ... for=Products.Five.tests.testing.fancycontent.IFancyContent + ... class=Products.Five.browser.tests.pages.FancyView + ... attribute=view + ... name=raise-keyerror + ... permission=zope2.Public + ... / ... /configure''' zcml.load_string(configure_zcml) @@ -92,23 +107,50 @@ ... something-else -Of course we also need to make sure that Zope 3 style view lookup -actually works: +Once we have a custom __bobo_traverse__ method, though, it always +takes over. Therefore, unless it raises AttributeError or +KeyError, it will be the only way traversal is done. print http(r''' ... GET /test_folder_1_/fancy/fancyview HTTP/1.1 ... ''') HTTP/1.1 200 OK ... + fancyview + +As said, if the original __bobo_traverse__ method *does* raise +AttributeError or KeyError, we can get normal view look-up. Other +exceptions are passed through just fine: + + print http(r''' + ... GET /test_folder_1_/fancy/raise-attributeerror HTTP/1.1 + ... ''') + HTTP/1.1 200 OK + ... Fancy, fancy - + + print http(r''' + ... GET /test_folder_1_/fancy/raise-keyerror HTTP/1.1 + ... ''') + HTTP/1.1 200 OK + ... + Fancy, fancy + + print http(r''' + ... GET /test_folder_1_/fancy/raise-valueerror HTTP/1.1 + ... ''') + HTTP/1.1 500 Internal Server Error + ... + ...ValueError: raise-valueerror + ... + Five's traversable monkeypatches the __bobo_traverse__ method to do view lookup and then delegates back to the original __bobo_traverse__ or direct attribute/item lookup to do normal lookup. In the Zope 2 ZPublisher, an
[Zope-Checkins] SVN: Products.Five/branches/1.4/browser/tests/test_traversable.py better Zope trunk compatibility
Log message for revision 66195: better Zope trunk compatibility Changed: U Products.Five/branches/1.4/browser/tests/test_traversable.py -=- Modified: Products.Five/branches/1.4/browser/tests/test_traversable.py === --- Products.Five/branches/1.4/browser/tests/test_traversable.py 2006-03-26 20:55:46 UTC (rev 66194) +++ Products.Five/branches/1.4/browser/tests/test_traversable.py 2006-03-26 21:13:37 UTC (rev 66195) @@ -138,11 +138,10 @@ print http(r''' ... GET /test_folder_1_/fancy/raise-valueerror HTTP/1.1 - ... ''') - HTTP/1.1 500 Internal Server Error - ... - ...ValueError: raise-valueerror - ... + ... ''', handle_errors=False) + Traceback (most recent call last): +... + ValueError: raise-valueerror Five's traversable monkeypatches the __bobo_traverse__ method to do view lookup and then delegates back to the original __bobo_traverse__ or direct ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.3/browser/tests/test_traversable.py better Zope trunk compatibility
Log message for revision 66196: better Zope trunk compatibility Changed: U Products.Five/branches/1.3/browser/tests/test_traversable.py -=- Modified: Products.Five/branches/1.3/browser/tests/test_traversable.py === --- Products.Five/branches/1.3/browser/tests/test_traversable.py 2006-03-26 21:13:37 UTC (rev 66195) +++ Products.Five/branches/1.3/browser/tests/test_traversable.py 2006-03-26 21:14:38 UTC (rev 66196) @@ -138,11 +138,10 @@ print http(r''' ... GET /test_folder_1_/fancy/raise-valueerror HTTP/1.1 - ... ''') - HTTP/1.1 500 Internal Server Error - ... - ...ValueError: raise-valueerror - ... + ... ''', handle_errors=False) + Traceback (most recent call last): +... + ValueError: raise-valueerror Five's traversable monkeypatches the __bobo_traverse__ method to do view lookup and then delegates back to the original __bobo_traverse__ or direct ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.3/browser/tests/test_traversable.py Grrr... was still not right with the trunk
Log message for revision 66199: Grrr... was still not right with the trunk Changed: U Products.Five/branches/1.3/browser/tests/test_traversable.py -=- Modified: Products.Five/branches/1.3/browser/tests/test_traversable.py === --- Products.Five/branches/1.3/browser/tests/test_traversable.py 2006-03-26 21:16:10 UTC (rev 66198) +++ Products.Five/branches/1.3/browser/tests/test_traversable.py 2006-03-26 21:49:43 UTC (rev 66199) @@ -141,7 +141,7 @@ ... ''', handle_errors=False) Traceback (most recent call last): ... - ValueError: raise-valueerror + ValueError: ... Five's traversable monkeypatches the __bobo_traverse__ method to do view lookup and then delegates back to the original __bobo_traverse__ or direct ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/tags/1.3.3/ Tag Five 1.3.3 yet again
Log message for revision 66201: Tag Five 1.3.3 yet again Changed: A Products.Five/tags/1.3.3/ -=- Copied: Products.Five/tags/1.3.3 (from rev 66200, Products.Five/branches/1.3) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.0/ Merge philikon-fix-lookup-priorities branch and prepare for release.
Log message for revision 66212: Merge philikon-fix-lookup-priorities branch and prepare for release. Changed: U Products.Five/branches/1.0/CHANGES.txt U Products.Five/branches/1.0/fiveconfigure.py U Products.Five/branches/1.0/tests/test_five.py U Products.Five/branches/1.0/traversable.py U Products.Five/branches/1.0/version.txt -=- Modified: Products.Five/branches/1.0/CHANGES.txt === --- Products.Five/branches/1.0/CHANGES.txt 2006-03-26 22:31:56 UTC (rev 66211) +++ Products.Five/branches/1.0/CHANGES.txt 2006-03-26 22:37:14 UTC (rev 66212) @@ -2,14 +2,24 @@ Five Changes -Five 1.0.3 (...) - +Five 1.0.3 (2006-03-26) +=== -* Added missing fix from newer versions of Five where the _context wasn't - getting cleaned up properly in zcml.py. Without this fix, adapter lookups - wouldn't work in any test after the first test that used load_zcml in the - same test fixture (essentially adapter lookups were dead). +Bugfixes + +* Fixed look-up order during Five traversal. It is now as follows: + + 1. If an object has __bobo_traverse__, use it. + + 2. Otherwise do attribute look-up or, if that doesn't work, key item + lookup. + + 3. If neither __bobo_traverse__ nor attribute/key look-up work, it + tries to find a Zope 3-style view. + +* Properly clean up ZCML context in Five.zcml. + * Fixed bug that broke WebDAV access for five:defaultViewable objects. The __browser_default__ now modifies only GET and POST requests. @@ -20,7 +30,8 @@ instead of the ZopeTwoPageTemplateFile. This seem to cause access problems in some very obscure situations, and is now fixed. -* FivePageTemplate is now deprecated and will be removed in Five 1.1. +* FivePageTemplate is now deprecated and removed in more recent + versions of Five. * Some parts of add.pt and edit.pt were not being translated. Modified: Products.Five/branches/1.0/fiveconfigure.py === --- Products.Five/branches/1.0/fiveconfigure.py 2006-03-26 22:31:56 UTC (rev 66211) +++ Products.Five/branches/1.0/fiveconfigure.py 2006-03-26 22:37:14 UTC (rev 66212) @@ -28,10 +28,10 @@ from zope.interface import classImplements from zope.configuration import xmlconfig from zope.app.component.interface import provideInterface -from viewable import Viewable -from traversable import Traversable -from bridge import fromZ2Interface -from browserconfigure import page +from Products.Five.viewable import Viewable +from Products.Five.traversable import Traversable +from Products.Five.bridge import fromZ2Interface +from Products.Five.browserconfigure import page debug_mode = App.config.getConfiguration().debug_mode @@ -54,7 +54,7 @@ # in the control panel. However, all attempts to do so has failed from my # side. //regebro exc = sys.exc_info() -LOG('Five', ERROR, 'Could not import Product %s' % name, error=exc) +LOG('Five', ERROR, 'Could not import Product %s' % product.__name__, error=exc) def loadProducts(_context): products = findProducts() @@ -118,14 +118,11 @@ isFiveMethod(class_.__bobo_traverse__)): return -if hasattr(class_, '__bobo_traverse__'): -if not isFiveMethod(class_.__bobo_traverse__): -# if there's an existing bobo_traverse hook already, use that -# as the traversal fallback method -setattr(class_, '__fallback_traverse__', class_.__bobo_traverse__) -if not hasattr(class_, '__fallback_traverse__'): -setattr(class_, '__fallback_traverse__', -Traversable.__fallback_traverse__.im_func) +if (hasattr(class_, '__bobo_traverse__') and +not isFiveMethod(class_.__bobo_traverse__)): +# if there's an existing bobo_traverse hook already, use that +# as the traversal fallback method +setattr(class_, '__fallback_traverse__', class_.__bobo_traverse__) setattr(class_, '__bobo_traverse__', Traversable.__bobo_traverse__.im_func) Modified: Products.Five/branches/1.0/tests/test_five.py === --- Products.Five/branches/1.0/tests/test_five.py 2006-03-26 22:31:56 UTC (rev 66211) +++ Products.Five/branches/1.0/tests/test_five.py 2006-03-26 22:37:14 UTC (rev 66212) @@ -333,9 +333,11 @@ response = self.publish('/test_folder_1_/fancy/something-else') self.assertEquals('something-else', response.getBody()) -# check if z3-based view lookup works +# even though we have a zope 3 view registered as 'fancy', it +# doesn't kick in, the existing bobo_traverse takes over +# everything response = self.publish('/test_folder_1_/fancy/fancy') -self.assertEquals(Fancy, fancy, response.getBody()) +
[Zope-Checkins] SVN: Products.Five/tags/1.2.2/ Tag release
Log message for revision 66213: Tag release Changed: A Products.Five/tags/1.2.2/ -=- Copied: Products.Five/tags/1.2.2 (from rev 66212, Products.Five/branches/1.2) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.0/tests/test_five.py fix indentation to bring this version closer to the one in Zope 2.8 branch
Log message for revision 66214: fix indentation to bring this version closer to the one in Zope 2.8 branch Changed: U Products.Five/branches/1.0/tests/test_five.py -=- Modified: Products.Five/branches/1.0/tests/test_five.py === --- Products.Five/branches/1.0/tests/test_five.py 2006-03-26 22:40:27 UTC (rev 66213) +++ Products.Five/branches/1.0/tests/test_five.py 2006-03-26 22:59:39 UTC (rev 66214) @@ -49,7 +49,7 @@ from Products.Five.tests.products import FiveTest _prefix = os.path.dirname(FiveTest.__file__) dir_resource_names = [os.path.basename(r) -for r in (glob.glob('%s/*.png' % _prefix) + + for r in (glob.glob('%s/*.png' % _prefix) + glob.glob('%s/*.pt' % _prefix) + glob.glob('%s/[a-z]*.py' % _prefix) + glob.glob('%s/*.css' % _prefix))] @@ -276,7 +276,7 @@ # Test traversal base = 'testoid/@@fivetest_macros/%s' for macro in ('birdmacro', 'dogmacro', -'flying', 'walking'): + 'flying', 'walking'): view = self.folder.unrestrictedTraverse(base % macro) self.failUnless(view) @@ -413,7 +413,7 @@ from zope.app.publisher.browser.globalbrowsermenuservice import \ -globalBrowserMenuService + globalBrowserMenuService class MenuTest(FiveTestCase): ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/tags/1.0.3/ Last and final release of Five 1.0.x.
Log message for revision 66215: Last and final release of Five 1.0.x. Changed: A Products.Five/tags/1.0.3/ -=- Copied: Products.Five/tags/1.0.3 (from rev 66214, Products.Five/branches/1.0) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ Set svn:keywords Id on new files.
Log message for revision 66217: Set svn:keywords Id on new files. Changed: _U Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/placeless.py _U Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/testPlaceless.py -=- Property changes on: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/placeless.py ___ Name: svn:keywords + Id Property changes on: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/testPlaceless.py ___ Name: svn:keywords + Id ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/ - Made base.TestCase a new-style class.
Log message for revision 66218: - Made base.TestCase a new-style class. - Added placeless.py for Z3-style setup. Thanks to Whit Morriss. Changed: U Zope/branches/2.9/lib/python/Testing/ZopeTestCase/__init__.py U Zope/branches/2.9/lib/python/Testing/ZopeTestCase/base.py U Zope/branches/2.9/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt A Zope/branches/2.9/lib/python/Testing/ZopeTestCase/placeless.py A Zope/branches/2.9/lib/python/Testing/ZopeTestCase/testPlaceless.py U Zope/branches/2.9/lib/python/Testing/ZopeTestCase/zopedoctest/__init__.py -=- Modified: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/__init__.py === --- Zope/branches/2.9/lib/python/Testing/ZopeTestCase/__init__.py 2006-03-27 01:26:56 UTC (rev 66217) +++ Zope/branches/2.9/lib/python/Testing/ZopeTestCase/__init__.py 2006-03-27 01:29:02 UTC (rev 66218) @@ -51,6 +51,7 @@ import zopedoctest as doctest import transaction +import placeless Zope = Zope2 Modified: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/base.py === --- Zope/branches/2.9/lib/python/Testing/ZopeTestCase/base.py 2006-03-27 01:26:56 UTC (rev 66217) +++ Zope/branches/2.9/lib/python/Testing/ZopeTestCase/base.py 2006-03-27 01:29:02 UTC (rev 66218) @@ -40,7 +40,7 @@ -class TestCase(profiler.Profiled, unittest.TestCase): +class TestCase(profiler.Profiled, unittest.TestCase, object): '''Base test case for Zope testing ''' Modified: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt === --- Zope/branches/2.9/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2006-03-27 01:26:56 UTC (rev 66217) +++ Zope/branches/2.9/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2006-03-27 01:29:02 UTC (rev 66218) @@ -1,4 +1,4 @@ -Unreleased +2.9 edition - transaction.commit(1) is deprecated in favor of transaction.savepoint(). - Don't break if Python distros ship without profile support (Debian, Ubuntu). - Functional.publish() would hang if it got a request_method argument other @@ -8,6 +8,8 @@ - Made functional doctests set cookie related headers. - Made functional doctests set the Www-Authenticate header. - Made sure logging is configured. Read $INSTANCE_HOME/log.ini if it exists. +- Made base.TestCase a new-style class. +- Added placeless.py for Z3-style setup. Thanks to Whit Morriss. 0.9.8 (Zope 2.8 edition) - Renamed 'doctest' package to 'zopedoctest' because of name-shadowing Added: Zope/branches/2.9/lib/python/Testing/ZopeTestCase/placeless.py === --- Zope/branches/2.9/lib/python/Testing/ZopeTestCase/placeless.py 2006-03-27 01:26:56 UTC (rev 66217) +++ Zope/branches/2.9/lib/python/Testing/ZopeTestCase/placeless.py 2006-03-27 01:29:02 UTC (rev 66218) @@ -0,0 +1,63 @@ +## +# +# Copyright (c) 2005 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. +# +## +Placeless setup + +$Id$ + + +from zope.app.testing.placelesssetup import setUp, tearDown + +# For convenience +from Products.Five import zcml + + +def callZCML(zcml_callback): +if callable(zcml_callback): +zcml_callback() +else: +for func in zcml_callback: +func() + + +def temporaryPlacelessSetUp(orig_func, placeless_available=True, required_zcml=[]): +'''A wrapper for test functions that require CA to be available and/or + some ZCML to be run during test fixture creation. +''' +if not placeless_available: +return orig_func + +def wrapper(*args, **kw): +__doc__ = '''%s :: + +@param required_zcml callback or iterable of callbacks +required for setup of configuration needed by fixture +creation. +''' % orig_func.__doc__ + +# Setup the placeless stuff that's needed to create a fixture +setUp() + +# Call any necessary callbacks for setting up ZCML +callZCML(required_zcml) +if kw.has_key('required_zcml'): +zcml = kw.pop('required_zcml') +callZCML(zcml) + +value = orig_func(*args, **kw) + +# And tear it down +tearDown() +return value + +return wrapper + Property changes on:
[Zope-Checkins] SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/ - Made base.TestCase a new-style class.
Log message for revision 66219: - Made base.TestCase a new-style class. - Added placeless.py for Z3-style setup. Thanks to Whit Morriss. Changed: U Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py U Zope/trunk/lib/python/Testing/ZopeTestCase/base.py U Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt A Zope/trunk/lib/python/Testing/ZopeTestCase/placeless.py A Zope/trunk/lib/python/Testing/ZopeTestCase/testPlaceless.py U Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/__init__.py -=- Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py === --- Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py 2006-03-27 01:29:02 UTC (rev 66218) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py 2006-03-27 01:29:34 UTC (rev 66219) @@ -51,6 +51,7 @@ import zopedoctest as doctest import transaction +import placeless Zope = Zope2 Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/base.py === --- Zope/trunk/lib/python/Testing/ZopeTestCase/base.py 2006-03-27 01:29:02 UTC (rev 66218) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/base.py 2006-03-27 01:29:34 UTC (rev 66219) @@ -40,7 +40,7 @@ -class TestCase(profiler.Profiled, unittest.TestCase): +class TestCase(profiler.Profiled, unittest.TestCase, object): '''Base test case for Zope testing ''' Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt === --- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2006-03-27 01:29:02 UTC (rev 66218) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2006-03-27 01:29:34 UTC (rev 66219) @@ -1,4 +1,4 @@ -Unreleased +Zope 2.10 edition - transaction.commit(1) is deprecated in favor of transaction.savepoint(). - Don't break if Python distros ship without profile support (Debian, Ubuntu). - Functional.publish() would hang if it got a request_method argument other @@ -8,6 +8,8 @@ - Made functional doctests set cookie related headers. - Made functional doctests set the Www-Authenticate header. - Made sure logging is configured. Read $INSTANCE_HOME/log.ini if it exists. +- Made base.TestCase a new-style class. +- Added placeless.py for Z3-style setup. Thanks to Whit Morriss. 0.9.8 (Zope 2.8 edition) - Renamed 'doctest' package to 'zopedoctest' because of name-shadowing Added: Zope/trunk/lib/python/Testing/ZopeTestCase/placeless.py === --- Zope/trunk/lib/python/Testing/ZopeTestCase/placeless.py 2006-03-27 01:29:02 UTC (rev 66218) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/placeless.py 2006-03-27 01:29:34 UTC (rev 66219) @@ -0,0 +1,63 @@ +## +# +# Copyright (c) 2005 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. +# +## +Placeless setup + +$Id$ + + +from zope.app.testing.placelesssetup import setUp, tearDown + +# For convenience +from Products.Five import zcml + + +def callZCML(zcml_callback): +if callable(zcml_callback): +zcml_callback() +else: +for func in zcml_callback: +func() + + +def temporaryPlacelessSetUp(orig_func, placeless_available=True, required_zcml=[]): +'''A wrapper for test functions that require CA to be available and/or + some ZCML to be run during test fixture creation. +''' +if not placeless_available: +return orig_func + +def wrapper(*args, **kw): +__doc__ = '''%s :: + +@param required_zcml callback or iterable of callbacks +required for setup of configuration needed by fixture +creation. +''' % orig_func.__doc__ + +# Setup the placeless stuff that's needed to create a fixture +setUp() + +# Call any necessary callbacks for setting up ZCML +callZCML(required_zcml) +if kw.has_key('required_zcml'): +zcml = kw.pop('required_zcml') +callZCML(zcml) + +value = orig_func(*args, **kw) + +# And tear it down +tearDown() +return value + +return wrapper + Property changes on: Zope/trunk/lib/python/Testing/ZopeTestCase/placeless.py ___ Name: svn:keywords + Id Name: svn:eol-style +
[Zope-Checkins] SVN: Zope/trunk/lib/python/Testing/makerequest.py Apply Philipp's fix to Testing.makerequest as well.
Log message for revision 66221: Apply Philipp's fix to Testing.makerequest as well. Changed: U Zope/trunk/lib/python/Testing/makerequest.py -=- Modified: Zope/trunk/lib/python/Testing/makerequest.py === --- Zope/trunk/lib/python/Testing/makerequest.py2006-03-27 01:37:01 UTC (rev 66220) +++ Zope/trunk/lib/python/Testing/makerequest.py2006-03-27 01:37:22 UTC (rev 66221) @@ -36,4 +36,10 @@ environ['SERVER_PORT']='80' environ['REQUEST_METHOD'] = 'GET' req = HTTPRequest(stdin, environ, resp) + +# set Zope3-style default skin so that the request is usable for +# Zope3-style view look-ups +from zope.app.publication.browser import setDefaultSkin +setDefaultSkin(req) + return app.__of__(RequestContainer(REQUEST = req)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/ Zope 2.9.2
Log message for revision 66222: Zope 2.9.2 Changed: U Zope/branches/2.9/doc/CHANGES.txt U Zope/branches/2.9/inst/WinBuilders/mk/zope.mk U Zope/branches/2.9/inst/versions.py -=- Modified: Zope/branches/2.9/doc/CHANGES.txt === --- Zope/branches/2.9/doc/CHANGES.txt 2006-03-27 01:37:22 UTC (rev 66221) +++ Zope/branches/2.9/doc/CHANGES.txt 2006-03-27 05:05:42 UTC (rev 66222) @@ -14,7 +14,7 @@ to the rules for such a type laid out in the Python docs: http://docs.python.org/api/supporting-cycle-detection.html - After Zope 2.9.1 + Zope 2.9.2 (2006/03/27) Bugs fixed Modified: Zope/branches/2.9/inst/WinBuilders/mk/zope.mk === --- Zope/branches/2.9/inst/WinBuilders/mk/zope.mk 2006-03-27 01:37:22 UTC (rev 66221) +++ Zope/branches/2.9/inst/WinBuilders/mk/zope.mk 2006-03-27 05:05:42 UTC (rev 66222) @@ -1,4 +1,4 @@ -ZOPEVERSION := 2.9.1 +ZOPEVERSION := 2.9.2 ZOPEDIRNAME := Zope-$(ZOPEVERSION) ZOPE_REQUIRED_FILES=tmp/$(ZOPEDIRNAME).tgz Modified: Zope/branches/2.9/inst/versions.py === --- Zope/branches/2.9/inst/versions.py 2006-03-27 01:37:22 UTC (rev 66221) +++ Zope/branches/2.9/inst/versions.py 2006-03-27 05:05:42 UTC (rev 66222) @@ -1,5 +1,5 @@ ZOPE_MAJOR_VERSION = '2.9' -ZOPE_MINOR_VERSION = '1' +ZOPE_MINOR_VERSION = '2' ZOPE_BRANCH_NAME= '$Name$'[6:] or 'no-branch' # always start prerelease branches with '0' to avoid upgrade ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/tags/2.9.2/ Zope 2.9.2
Log message for revision 66223: Zope 2.9.2 Changed: A Zope/tags/2.9.2/ -=- Copied: Zope/tags/2.9.2 (from rev 66222, Zope/branches/2.9) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/tags/2.9.2/ removed
Log message for revision 66225: removed Changed: D Zope/tags/2.9.2/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins