Log message for revision 80851: merged r78106:80849 from the zope 2.10 branch
Changed: U Zope/branches/2.10-with-ZODB3.8/doc/CHANGES.txt U Zope/branches/2.10-with-ZODB3.8/lib/python/App/dtml/manage_page_style.css.dtml U Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/Application.py U Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/Traversable.py U Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/tests/testApplication.py U Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/tests/testTraverse.py _U Zope/branches/2.10-with-ZODB3.8/lib/python/Products/ U Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/Expressions.py U Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/ZopePageTemplate.py U Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py U Zope/branches/2.10-with-ZODB3.8/lib/python/Products/Sessions/SessionDataManager.py U Zope/branches/2.10-with-ZODB3.8/lib/python/Products/__init__.py U Zope/branches/2.10-with-ZODB3.8/lib/python/Testing/ZopeTestCase/ZopeLite.py U Zope/branches/2.10-with-ZODB3.8/lib/python/Testing/ZopeTestCase/testBaseTestCase.py U Zope/branches/2.10-with-ZODB3.8/lib/python/ZPublisher/HTTPRequest.py U Zope/branches/2.10-with-ZODB3.8/lib/python/ZPublisher/tests/testHTTPRequest.py U Zope/branches/2.10-with-ZODB3.8/lib/python/ZServer/FCGIServer.py U Zope/branches/2.10-with-ZODB3.8/lib/python/Zope2/Startup/zopeschema.xml -=- Modified: Zope/branches/2.10-with-ZODB3.8/doc/CHANGES.txt =================================================================== --- Zope/branches/2.10-with-ZODB3.8/doc/CHANGES.txt 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/doc/CHANGES.txt 2007-10-11 15:33:54 UTC (rev 80851) @@ -8,14 +8,41 @@ - Backported feature from Zope 2.11 to support named temporary files. - Zope 2.10.4 (23.06.2007) + Zope 2.10.5 (unreleased) + Bugs fixed + + - Launchpad #147201: treat container-class in zope.conf as a string, + making it possible to use types from extra products directories. + + - Collector #2358: backported fix making 'Products' package a real + "namespace package" from the trunk. + + - Collector #2287: form ':record' objects did not implement enough of + the mapping interface. + + - Collector #2352: fix in OFS.Traversable + + - Collector #2346: username logging in FCGI crashed the server + + - ZopePageTemplate's pt_edit did not recognize content type arguments + which had a charset information included. + + - Collector #2332: SessionDataManger: don't swallow ConflictErrors + + - Collector #2339: ZPT: fixed unicode issue when using the 'structure' + directive + + Zope 2.10.4 (2007/06/23) + Other changes - updated to ZODB 3.7.1 - updated to Zope 3.3.2 + - updated to Five 1.5.5 + Bugs fixed - Collector #1306: Missing acquisition context on local roles screen. Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/App/dtml/manage_page_style.css.dtml =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/App/dtml/manage_page_style.css.dtml 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/App/dtml/manage_page_style.css.dtml 2007-10-11 15:33:54 UTC (rev 80851) @@ -44,6 +44,10 @@ color: #000099; } +a img { + border: 0; +} + p { font-family: Verdana, Helvetica, sans-serif; font-size: 10pt; Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/Application.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/Application.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/Application.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -634,9 +634,10 @@ folder_permissions, raise_exc=debug_mode) # Delayed install of packages-as-products - for module, init_func in Products._packages_to_initialize: + for module, init_func in getattr(Products, '_packages_to_initialize', []): install_package(app, module, init_func, raise_exc=debug_mode) - Products._packages_to_initialize = [] + if hasattr(Products, '_packages_to_initialize'): + del Products._packages_to_initialize Products.meta_types=Products.meta_types+tuple(meta_types) InitializeClass(Folder.Folder) Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/Traversable.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/Traversable.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/Traversable.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -186,18 +186,18 @@ bobo_traverse = getattr(obj, '__bobo_traverse__', None) try: - if name and name[:1] in '@+' and name != '+': + if name and name[:1] in '@+' and name != '+' and nsParse(name)[1]: # Process URI segment parameters. ns, nm = nsParse(name) - if ns: - try: - next = namespaceLookup( - ns, nm, obj, self.REQUEST).__of__(obj) - if restricted and not validate( - obj, obj, name, next): - raise Unauthorized(name) - except TraversalError: - raise AttributeError(name) + try: + next = namespaceLookup( + ns, nm, obj, self.REQUEST).__of__(obj) + if restricted and not validate( + obj, obj, name, next): + raise Unauthorized(name) + except TraversalError: + raise AttributeError(name) + elif bobo_traverse is not None: next = bobo_traverse(REQUEST, name) if restricted: Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/tests/testApplication.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/tests/testApplication.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/tests/testApplication.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -1,19 +1,113 @@ import unittest -class TestApplication(unittest.TestCase): +class ApplicationTests(unittest.TestCase): - def test_z3interfaces(self): + def _getTargetClass(self): + from OFS.Application import Application + return Application + + def _makeOne(self): + return self._getTargetClass()() + + def test_class_provides_IApplication(self): from OFS.interfaces import IApplication - from OFS.Application import Application from zope.interface.verify import verifyClass - verifyClass(IApplication, Application) + verifyClass(IApplication, self._getTargetClass()) + def test_instance_conforms_to_IApplication(self): + from OFS.interfaces import IApplication + from zope.interface.verify import verifyObject + verifyObject(IApplication, self._makeOne()) + + def test_instance_attributes(self): + app = self._makeOne() + self.failUnless(app.isTopLevelPrincipiaApplicationObject) + self.assertEqual(app.title, 'Zope') + + def test_id_no_request(self): + app = self._makeOne() + self.assertEqual(app.id(), 'Zope') + + def test_id_w_request_no_SCRIPT_NAME(self): + app = self._makeOne() + app.REQUEST = {} + self.assertEqual(app.id(), 'Zope') + + def test_id_w_request_w_SCRIPT_NAME(self): + app = self._makeOne() + app.REQUEST = {'SCRIPT_NAME': '/Dummy'} + self.assertEqual(app.id(), 'Dummy') + + def test_title_and_id_plus_title_or_id(self): + app = self._makeOne() + app.title = 'Other' + self.assertEqual(app.title_and_id(), 'Other') + self.assertEqual(app.title_or_id(), 'Other') + + def test___bobo_traverse__attribute_hit(self): + app = self._makeOne() + app.NAME = 'attribute' + app._getOb = lambda x, y: x + request = {} + self.assertEqual(app.__bobo_traverse__(request, 'NAME'), 'attribute') + + def test___bobo_traverse__attribute_miss_key_hit(self): + app = self._makeOne() + app._getOb = lambda x, y: x + request = {} + self.assertEqual(app.__bobo_traverse__(request, 'OTHER'), 'OTHER') + + def test___bobo_traverse__attribute_key_miss_R_M_default_real_request(self): + from UserDict import UserDict + request = UserDict() + + class _Response: + def notFoundError(self, msg): + 1/0 + + request.RESPONSE = _Response() + app = self._makeOne() + app._getOb = _noWay + + self.assertRaises(ZeroDivisionError, + app.__bobo_traverse__, request, 'NONESUCH') + + def test___bobo_traverse__attribute_key_miss_R_M_default_fake_request(self): + app = self._makeOne() + + app._getOb = _noWay + request = {} + self.assertRaises(KeyError, app.__bobo_traverse__, request, 'NONESUCH') + + def test___bobo_traverse__attribute_key_miss_R_M_is_GET(self): + app = self._makeOne() + + app._getOb = _noWay + request = {'REQUEST_METHOD': 'GET'} + self.assertRaises(KeyError, app.__bobo_traverse__, request, 'NONESUCH') + + def test___bobo_traverse__attribute_key_miss_R_M_not_GET_POST(self): + from Acquisition import aq_inner, aq_parent + from webdav.NullResource import NullResource + + app = self._makeOne() + app._getOb = _noWay + request = {'REQUEST_METHOD': 'GOOFY'} + + result = app.__bobo_traverse__(request, 'OTHER') + + self.failUnless(isinstance(result, NullResource)) + self.failUnless(aq_parent(aq_inner(result)) is app) + +def _noWay(self, key, default=None): + raise KeyError(key) + def test_suite(): return unittest.TestSuite(( - unittest.makeSuite(TestApplication), + unittest.makeSuite(ApplicationTests), )) if __name__ == '__main__': Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/tests/testTraverse.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/tests/testTraverse.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/OFS/tests/testTraverse.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -169,6 +169,7 @@ self.app = makerequest( self.root, stdout=responseOut ) manage_addFolder( self.app, 'folder1' ) folder1 = getattr( self.app, 'folder1' ) + setattr(folder1, '+something', 'plus') folder1.all_meta_types = \ ( { 'name' : 'File' @@ -378,8 +379,12 @@ self.failUnless( aq_base(self.root.folder1.file.restrictedTraverse('../..')) is aq_base(self.root)) + + def testTraverseToNameStartingWithPlus(self): + # Verify it's possible to traverse to a name such as +something + self.failUnless( + self.folder1.unrestrictedTraverse('+something') is 'plus') - import os, sys if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) Property changes on: Zope/branches/2.10-with-ZODB3.8/lib/python/Products ___________________________________________________________________ Name: svn:externals - Five svn://svn.zope.org/repos/main/Products.Five/tags/1.5.5 + Five svn://svn.zope.org/repos/main/Products.Five/tags/1.5.6 Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/Expressions.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/Expressions.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/Expressions.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -217,12 +217,20 @@ return value return bool(value) + def evaluateStructure(self, expr): + text = super(ZopeContext, self).evaluateStructure(expr) + return self._handleText(text, expr) + def evaluateText(self, expr): """ customized version in order to get rid of unicode errors for all and ever """ text = self.evaluate(expr) + return self._handleText(text, expr) + + def _handleText(self, text, expr): + if text is self.getDefault() or text is None: # XXX: should be unicode??? return text Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/ZopePageTemplate.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/ZopePageTemplate.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/ZopePageTemplate.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -126,7 +126,7 @@ encoding = None output_encoding = None - if content_type in ('text/xml',): + if content_type.startswith('text/xml'): if is_unicode: encoding = None @@ -134,9 +134,8 @@ else: encoding = encodingFromXMLPreamble(text) output_encoding = 'utf-8' - - elif content_type in ('text/html',) : + elif content_type.startswith('text/html'): charset = charsetFromMetaEquiv(text) Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -121,7 +121,17 @@ result = zpt.pt_render() self.assertEqual(result.startswith(unicode('<div>üöä</div>', 'iso-8859-15')), False) + def testStructureWithAccentedChars(self): + manage_addPageTemplate(self.app, 'test', + text='<div tal:content="structure python: %s" />' % "'üöä'", + encoding='iso-8859-15') + zpt = self.app['test'] + self.app.REQUEST.set('HTTP_ACCEPT_CHARSET', 'iso-8859-15,utf-8') + self.app.REQUEST.set('data', unicode('üöä', 'iso-8859-15').encode('utf-8')) + result = zpt.pt_render() + self.assertEqual(result.startswith(unicode('<div>üöä</div>', 'iso-8859-15')), True) + class ZopePageTemplateFileTests(ZopeTestCase): def testPT_RenderWithAscii(self): @@ -165,6 +175,14 @@ self.assertEqual(zpt.read(), s) self.assertEqual(isinstance(zpt.read(), unicode), True) + def testEditWithContentTypeCharset(self): + manage_addPageTemplate(self.app, 'test', xml_utf8, encoding='utf-8') + zpt = self.app['test'] + xml_unicode = unicode(xml_utf8, 'utf-8').strip() + zpt.pt_edit(xml_unicode, 'text/xml') + zpt.pt_edit(xml_unicode, 'text/xml; charset=utf-8') + self.assertEqual(zpt.read(), xml_unicode) + def _createZPT(self): manage_addPageTemplate(self.app, 'test', text=utf8_str, encoding='utf-8') zpt = self.app['test'] Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/Products/Sessions/SessionDataManager.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/Products/Sessions/SessionDataManager.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/Products/Sessions/SessionDataManager.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -15,6 +15,7 @@ from logging import getLogger import Globals from OFS.SimpleItem import Item +from ZODB.POSException import ConflictError from Acquisition import Implicit, Explicit, aq_base from Persistence import Persistent from AccessControl.Owned import Owned @@ -219,6 +220,8 @@ LOG.debug('External data container at %s in use' % args) self._v_wrote_dc_type = 1 return self.unrestrictedTraverse(self.obpath) + except ConflictError: + raise except: raise SessionDataManagerErr, ( "External session data container '%s' not found." % Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/Products/__init__.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/Products/__init__.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/Products/__init__.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -12,7 +12,9 @@ ############################################################################## __ac_permissions__=() -# This is used to keep track of packages which need to be initialized as -# products. These will be processed during the usual product installation -# in OFS.Application -_packages_to_initialize = [] \ No newline at end of file +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/Testing/ZopeTestCase/ZopeLite.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/Testing/ZopeTestCase/ZopeLite.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/Testing/ZopeTestCase/ZopeLite.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -174,7 +174,7 @@ '''Installs a registered Python package like a Zope product.''' start = time.time() if _patched and not _installedPackages.has_key(name): - for module, init_func in Products._packages_to_initialize: + for module, init_func in getattr(Products, '_packages_to_initialize', []): if module.__name__ == name: if not quiet: _print('Installing %s ... ' % module.__name__) # We want to fail immediately if a package throws an exception Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/Testing/ZopeTestCase/testBaseTestCase.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/Testing/ZopeTestCase/testBaseTestCase.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/Testing/ZopeTestCase/testBaseTestCase.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -405,6 +405,7 @@ _sentinel1.append('__del__') def afterSetUp(self): + _sentinel1[:] = [] self.anApp = base.app() self.anApp.REQUEST._hold(self.Held()) @@ -422,6 +423,7 @@ _sentinel2.append('__del__') def afterSetUp(self): + _sentinel2[:] = [] self.app.REQUEST._hold(self.Held()) def testClearClosesRequest(self): @@ -438,6 +440,7 @@ _sentinel3.append('__del__') def afterSetUp(self): + _sentinel3[:] = [] self.app.REQUEST._hold(self.Held()) def testClearClosesRequest(self): Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/ZPublisher/HTTPRequest.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/ZPublisher/HTTPRequest.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/ZPublisher/HTTPRequest.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -1533,7 +1533,7 @@ _guarded_writes = 1 def __getattr__(self, key, default=None): - if key in ('get', 'keys', 'items', 'values', 'copy', 'has_key'): + if key in ('get', 'keys', 'items', 'values', 'copy', 'has_key', '__contains__', '__iter__', '__len__'): return getattr(self.__dict__, key) raise AttributeError, key Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/ZPublisher/tests/testHTTPRequest.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/ZPublisher/tests/testHTTPRequest.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/ZPublisher/tests/testHTTPRequest.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -86,7 +86,29 @@ d = eval( r ) self.assertEqual( d, record.__dict__ ) + def test_contains(self): + from ZPublisher.HTTPRequest import record + record = record() + record.a = 1 + self.assertTrue('a' in record) + def test_iter(self): + from ZPublisher.HTTPRequest import record + record = record() + record.a = 1 + record.b = 2 + record.c = 3 + for k in record: + self.assertTrue(k in ('a','b','c')) + + def test_len(self): + from ZPublisher.HTTPRequest import record + record = record() + record.a = 1 + record.b = 2 + record.c = 3 + self.assertEqual(len(record), 3) + class ProcessInputsTests(unittest.TestCase): def _getHTTPRequest(self, env): from ZPublisher.HTTPRequest import HTTPRequest Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/ZServer/FCGIServer.py =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/ZServer/FCGIServer.py 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/ZServer/FCGIServer.py 2007-10-11 15:33:54 UTC (rev 80851) @@ -456,18 +456,15 @@ method=self.env['REQUEST_METHOD'] else: method="GET" + user_name = '-' if self.env.has_key('HTTP_AUTHORIZATION'): http_authorization=self.env['HTTP_AUTHORIZATION'] if string.lower(http_authorization[:6]) == 'basic ': try: decoded=base64.decodestring(http_authorization[6:]) except base64.binascii.Error: decoded='' t = string.split(decoded, ':', 1) - if len(t) < 2: - user_name = '-' - else: + if len(t) >= 2: user_name = t[0] - else: - user_name='-' if self.addr: self.server.logger.log ( self.addr[0], Modified: Zope/branches/2.10-with-ZODB3.8/lib/python/Zope2/Startup/zopeschema.xml =================================================================== --- Zope/branches/2.10-with-ZODB3.8/lib/python/Zope2/Startup/zopeschema.xml 2007-10-11 15:12:04 UTC (rev 80850) +++ Zope/branches/2.10-with-ZODB3.8/lib/python/Zope2/Startup/zopeschema.xml 2007-10-11 15:33:54 UTC (rev 80851) @@ -242,7 +242,7 @@ </description> </key> - <key name="container-class" datatype=".python_dotted_path"> + <key name="container-class" datatype="string"> <description> Change the contiainer class a (mounted) database uses on a per-database basis to support a different container than a plain _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins