[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/Products/Five/ for alecm:
Log message for revision 41744: for alecm: Changed Traversable to call the original __bobo_traverse__ method before attempting to use attribute access to find the desired object. This ensures that the monkeypatched object retains the same behavior as the original object during traversal. Also, added checks to see if the request is a WebDAV request in which case attribute lookup is performed without acquisition (see BaseRequest.traverse for why this is important). Changed: U Zope/branches/2.9/lib/python/Products/Five/browser/tests/test_traversable.py U Zope/branches/2.9/lib/python/Products/Five/traversable.py -=- Modified: Zope/branches/2.9/lib/python/Products/Five/browser/tests/test_traversable.py === --- Zope/branches/2.9/lib/python/Products/Five/browser/tests/test_traversable.py 2006-02-21 21:37:05 UTC (rev 41743) +++ Zope/branches/2.9/lib/python/Products/Five/browser/tests/test_traversable.py 2006-02-22 01:20:07 UTC (rev 41744) @@ -64,6 +64,9 @@ ... five:traversable ... class=Products.Five.browser.tests.test_traversable.SimpleClass ... / + ... five:traversable + ... class=Products.Five.tests.testing.FiveTraversableFolder + ... / ... ... browser:page ... for=Products.Five.tests.testing.fancycontent.IFancyContent @@ -99,7 +102,64 @@ ... Fancy, fancy +Without five traversable, if there had been an attrubute something-else, +the __bobo_traverse__ method would have still been used instead of the +atribute, let's make sure we preserve that behavior. + self.folder.fancy.an_attribute = 'This is an attribute' + print http(r''' + ... GET /test_folder_1_/fancy/an_attribute HTTP/1.1 + ... ''') + HTTP/1.1 200 OK + ... + an_attribute + +If we use WebDAV to get an object no acquisition should be performed, +otherwise content creation will break: + + from Products.Five.tests.testing import manage_addFiveTraversableFolder + manage_addFiveTraversableFolder(self.folder, 'traversable_folder', 'Traversable') + +Let's verify that we can get our object properties via WebDAV: + print http(r''' + ... PROPFIND /test_folder_1_/fancy HTTP/1.1 + ... Content-Type: text/xml; charset=utf-8 + ... Depth: 0 + ... + ... ?xml version=1.0 encoding=utf-8? + ... DAV:propfind xmlns:DAV=DAV: + ... xmlns:zope=http://www.zope.org/propsets/default; + ... DAV:propzope:title//DAV:prop + ... /DAV:propfind + ... ''') + HTTP/1.1 200 OK + ... + PROPFIND + +And that a normal http request will acquire the object: + print http(r''' + ... GET /test_folder_1_/traversable_folder/fancy HTTP/1.1 + ... ''') + HTTP/1.1 200 OK + ... + FancyContent at + +But that a WebDAV request will not: + print http(r''' + ... PROPFIND /test_folder_1_/traversable_folder/fancy HTTP/1.1 + ... Content-Type: text/xml; charset=utf-8 + ... Depth: 0 + ... + ... ?xml version=1.0 encoding=utf-8? + ... DAV:propfind xmlns:DAV=DAV: + ... xmlns:zope=http://www.zope.org/propsets/default; + ... DAV:propzope:title//DAV:prop + ... /DAV:propfind + ... ''') + HTTP/1.1 404 Not Found + ... + + Clean up: from zope.app.testing.placelesssetup import tearDown Modified: Zope/branches/2.9/lib/python/Products/Five/traversable.py === --- Zope/branches/2.9/lib/python/Products/Five/traversable.py 2006-02-21 21:37:05 UTC (rev 41743) +++ Zope/branches/2.9/lib/python/Products/Five/traversable.py 2006-02-22 01:20:07 UTC (rev 41744) @@ -16,6 +16,7 @@ $Id: traversable.py 19283 2005-10-31 17:43:51Z philikon $ from zExceptions import NotFound +from ZPublisher import xmlrpc from zope.component import getMultiAdapter, ComponentLookupError from zope.interface import implements, Interface @@ -29,8 +30,11 @@ from zope.app.interface import queryType from AccessControl import getSecurityManager +from Acquisition import aq_base from Products.Five.security import newInteraction +from webdav.NullResource import NullResource + _marker = object class FakeRequest(dict): @@ -56,7 +60,7 @@ Just raise a AttributeError to indicate traversal has failed and let Zope do it's job. -raise AttributeError, name +raise NotImplementedError __fallback_traverse__.__five_method__ = True def __bobo_traverse__(self, REQUEST, name): @@ -86,14 +90,36 @@ AttributeError, KeyError, NotFound): pass try: -return getattr(self, name) -except AttributeError: +return self.__fallback_traverse__(REQUEST, name) +except
[Zope-Checkins] SVN: Zope/trunk/test.py Have test.py remove iself from the pythonpath.
Log message for revision 41392: Have test.py remove iself from the pythonpath. Changed: U Zope/trunk/test.py -=- Modified: Zope/trunk/test.py === --- Zope/trunk/test.py 2006-01-20 21:49:12 UTC (rev 41391) +++ Zope/trunk/test.py 2006-01-21 12:16:22 UTC (rev 41392) @@ -21,6 +21,10 @@ import os.path, sys +# Remove this directory from path: +here = os.path.abspath(os.path.dirname(sys.argv[0])) +sys.path[:] = [p for p in sys.path if os.path.abspath(p) != here] + shome = os.environ.get('SOFTWARE_HOME') zhome = os.environ.get('ZOPE_HOME') ihome = os.environ.get('INSTANCE_HOME') ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/tags/2-8-6/inst/WinBuilders/etc/zope.iss.in More installer bitmap repair.
Log message for revision 65845: More installer bitmap repair. Changed: U Zope/tags/2-8-6/inst/WinBuilders/etc/zope.iss.in -=- Modified: Zope/tags/2-8-6/inst/WinBuilders/etc/zope.iss.in === --- Zope/tags/2-8-6/inst/WinBuilders/etc/zope.iss.in2006-03-07 01:13:23 UTC (rev 65844) +++ Zope/tags/2-8-6/inst/WinBuilders/etc/zope.iss.in2006-03-07 03:53:47 UTC (rev 65845) @@ -10,6 +10,10 @@ OutputBaseFilename=Zope-VERSION-win32 WizardImageFile=MAKEFILEDIR\etc\zlogo_left.bmp WizardSmallImageFile=MAKEFILEDIR\etc\zlogo_top.bmp +; Starting w/ Inno 4.1.3, Inno decided to stretch the .bmp files in various +; ways. Hard to know why, but it looks terrible on my pretty vanilla box. +; Luckily, 4.1.3 also added WizardImageStretch to turn that off. +WizardImageStretch=no SolidCompression=yes SourceDir=. @@ -69,7 +73,7 @@ PasswordChars : array of char; DataDirValues: array of String; - + Password : string; DataDir: String; @@ -87,7 +91,7 @@ { set up data dir data structures } SetArrayLength(DataDirValues, 1); DataDir := ''; - + Result := True; end; @@ -106,9 +110,9 @@ if DataDirValues[0] '' then DataDirValues[0]:= ''; { Ask for a dir until the user has approved one or clicked Back or Cancel } - + Next:= InputDir(False, DataDirValues[0], DataDir); - + if Next and FileOrDirExists(DataDir) then DirOk := False; while Next and not DirOk do begin @@ -133,7 +137,7 @@ ScriptDlgPageSetSubCaption1('Specify administrator password'); ScriptDlgPageSetSubCaption2('The login name for your Zope administrator account is admin. When you first connect to the Zope management interface, you will need to login using the admin username and the password you specify below.'); Next := InputQueryArrayEx(PasswordPrompts, PasswordChars, PasswordValues); - + while Next and (PasswordValues[0] = '') do begin MsgBox('You must enter an administrator password', mbError, MB_OK) Next := InputQueryArrayEx(PasswordPrompts, PasswordChars, PasswordValues); @@ -172,7 +176,7 @@ if ( (not BackClicked and (CurPage = wpSelectTasks)) or (BackClicked and (CurPage = wpReady)) ) and DoInstanceHome() then begin if not BackClicked then CurSubPage:=0 else CurSubPage:=1; - + ScriptDlgPageOpen(); ScriptDlgPageSetCaption('Instance Setup'); ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/tags/2-8-6/inst/WinBuilders/etc/zeo.iss.in Repair distorted installer bitmaps.
Log message for revision 65844: Repair distorted installer bitmaps. Changed: U Zope/tags/2-8-6/inst/WinBuilders/etc/zeo.iss.in -=- Modified: Zope/tags/2-8-6/inst/WinBuilders/etc/zeo.iss.in === --- Zope/tags/2-8-6/inst/WinBuilders/etc/zeo.iss.in 2006-03-07 01:07:59 UTC (rev 65843) +++ Zope/tags/2-8-6/inst/WinBuilders/etc/zeo.iss.in 2006-03-07 01:13:23 UTC (rev 65844) @@ -10,6 +10,10 @@ OutputBaseFilename=ZEO-VERSION-win32 WizardImageFile=MAKEFILEDIR\etc\zlogo_left.bmp WizardSmallImageFile=MAKEFILEDIR\etc\zlogo_top.bmp +; Starting w/ Inno 4.1.3, Inno decided to stretch the .bmp files in various +; ways. Hard to know why, but it looks terrible on my pretty vanilla box. +; Luckily, 4.1.3 also added WizardImageStretch to turn that off. +WizardImageStretch=no SourceDir=. OutputDir=. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ reverted r65902:
Log message for revision 66022: reverted r65902: - I still believe this was the Right Thing to do, but not everybody agrees Changed: U Zope/branches/Zope-2_8-branch/doc/CHANGES.txt U Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py U Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py -=- Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt === --- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2006-03-15 08:12:10 UTC (rev 66021) +++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2006-03-15 08:16:56 UTC (rev 66022) @@ -18,9 +18,6 @@ Bugs fixed - - OFS ObjectManager: Fixed 'checkValidId'. -Names starting with '@' are reserved for views and not allowed in IDs. - - Collector #2039: 'ZPublisher.HTTPRequest.HTTPRequest._authUserPW' choked on passwords which contained colons. Modified: Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py === --- Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py 2006-03-15 08:12:10 UTC (rev 66021) +++ Zope/branches/Zope-2_8-branch/lib/python/OFS/ObjectManager.py 2006-03-15 08:16:56 UTC (rev 66022) @@ -72,9 +72,6 @@ 'The id %s is invalid because it begins with aq_.' % id) if id.endswith('__'): raise BadRequest, ( 'The id %s is invalid because it ends with two underscores.' % id) -if id[0] == '@': -raise BadRequest('The id %s is invalid because it begins with ' - '@.' % id) if not allow_dup: obj = getattr(self, id, None) if obj is not None: Modified: Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py === --- Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py 2006-03-15 08:12:10 UTC (rev 66021) +++ Zope/branches/Zope-2_8-branch/lib/python/OFS/tests/testObjectManager.py 2006-03-15 08:16:56 UTC (rev 66022) @@ -354,9 +354,7 @@ self.assertRaises(BadRequest, om._setObject, '111', si) self.assertRaises(BadRequest, om._setObject, 'REQUEST', si) self.assertRaises(BadRequest, om._setObject, '/', si) -self.assertRaises(BadRequest, om._setObject, '@@view', si) - def test_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite( ObjectManagerTests ) ) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/philikon-local-components/ - fixed import errors
Log message for revision 67141: - fixed import errors Changed: U Products.Five/branches/philikon-local-components/fiveconfigure.py U Products.Five/branches/philikon-local-components/meta.zcml -=- Modified: Products.Five/branches/philikon-local-components/fiveconfigure.py === --- Products.Five/branches/philikon-local-components/fiveconfigure.py 2006-04-19 16:02:48 UTC (rev 67140) +++ Products.Five/branches/philikon-local-components/fiveconfigure.py 2006-04-19 16:06:57 UTC (rev 67141) @@ -35,7 +35,7 @@ from zope.security.interfaces import IPermission from zope.app.component.interface import provideInterface -from zope.app.component.metaconfigure import adapter +from zope.component.zcml import adapter from Products.Five import isFiveMethod from Products.Five.viewable import Viewable Modified: Products.Five/branches/philikon-local-components/meta.zcml === --- Products.Five/branches/philikon-local-components/meta.zcml 2006-04-19 16:02:48 UTC (rev 67140) +++ Products.Five/branches/philikon-local-components/meta.zcml 2006-04-19 16:06:57 UTC (rev 67141) @@ -8,6 +8,7 @@ meta:directives namespace=http://namespaces.zope.org/zope; +!-- FIXME: the definePermission handler is not found -- meta:directive name=permission schema=zope.app.security.metadirectives.IDefinePermissionDirective @@ -16,8 +17,8 @@ meta:directive name=interface -schema=zope.app.component.metadirectives.IInterfaceDirective -handler=zope.app.component.metaconfigure.interface +schema=zope.component.zcml.IInterfaceDirective +handler=zope.component.zcml.interface / meta:directive @@ -28,20 +29,20 @@ meta:directive name=adapter -schema=zope.app.component.metadirectives.IAdapterDirective -handler=zope.app.component.metaconfigure.adapter +schema=zope.component.zcml.IAdapterDirective +handler=zope.component.zcml.adapter / meta:directive name=subscriber -schema=zope.app.component.metadirectives.ISubscriberDirective -handler=zope.app.component.metaconfigure.subscriber +schema=zope.component.zcml.ISubscriberDirective +handler=zope.component.zcml.subscriber / meta:directive name=utility -schema=zope.app.component.metadirectives.IUtilityDirective -handler=zope.app.component.metaconfigure.utility +schema=zope.component.zcml.IUtilityDirective +handler=zope.component.zcml.utility / meta:directive @@ -162,14 +163,14 @@ meta:directive name=redefinePermission namespace=http://namespaces.zope.org/meta; - schema=zope.app.security.metadirectives.IRedefinePermission - handler=zope.app.security.metaconfigure.redefinePermission + schema=zope.security.zcml.IRedefinePermission + handler=zope.security.zcml.redefinePermission / !-- load the zope:modulealias directive -- include package=zope.modulealias file=meta.zcml / !-- load the i18n:registerTranslations directive -- - include package=zope.app.i18n file=meta.zcml / + include package=zope.i18n file=meta.zcml / /configure ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.4/ Merge from trunk and add CHANGES.txt message.
Log message for revision 67959: Merge from trunk and add CHANGES.txt message. r67957 | jinty | 2006-05-04 02:11:01 +0200 (Thu, 04 May 2006) | 1 line Five.testbrowser did not do the munging of the headers that the zope2 HTTP response did. It was also inconsistent with Zope3 testbrowser tests. Fix that. r67936 | jinty | 2006-05-03 21:49:06 +0200 (Wed, 03 May 2006) | 1 line Commit patch and test to make testbrowser not swallow cookies. Contributed by Daniel Nouri and modified by me Changed: U Products.Five/branches/1.4/CHANGES.txt U Products.Five/branches/1.4/testbrowser.py A Products.Five/branches/1.4/tests/test_testbrowser.py -=- Modified: Products.Five/branches/1.4/CHANGES.txt === --- Products.Five/branches/1.4/CHANGES.txt 2006-05-04 00:27:31 UTC (rev 67958) +++ Products.Five/branches/1.4/CHANGES.txt 2006-05-04 00:56:11 UTC (rev 67959) @@ -2,6 +2,19 @@ Five Changes +Five 1.4 (Unreleased) += + +Bugfixes + + +* Five.testbrowser does not swallow cookies anymore, based on patch by + Daniel Nouri. + +* Five.testbrowser capitalizes headers in the same way as the Zope2 + HTTPResponse. i.e. content-length - Content-Length. + + Five 1.4c (2006-05-04) == Modified: Products.Five/branches/1.4/testbrowser.py === --- Products.Five/branches/1.4/testbrowser.py 2006-05-04 00:27:31 UTC (rev 67958) +++ Products.Five/branches/1.4/testbrowser.py 2006-05-04 00:56:11 UTC (rev 67959) @@ -30,8 +30,23 @@ real_response = self.response._response status = real_response.getStatus() reason = zope.publisher.http.status_reasons[real_response.status] - -headers = real_response.headers.items() +headers = [] +# Convert header keys to camel case. This is basically a copy +# paste from ZPublisher.HTTPResponse +for key, val in real_response.headers.items(): +if key.lower() == key: +# only change non-literal header names +key = %s%s % (key[:1].upper(), key[1:]) +start = 0 +l = key.find('-',start) +while l = start: +key = %s-%s%s % (key[:l],key[l+1:l+2].upper(),key[l+2:]) +start = l + 1 +l = key.find('-', start) +headers.append((key, val)) +# get the cookies, breaking them into tuples for sorting +cookies = [(c[:10], c[12:]) for c in real_response._cookie_list()] +headers.extend(cookies) headers.sort() headers.insert(0, ('Status', %s %s % (status, reason))) headers = '\r\n'.join('%s: %s' % h for h in headers) Copied: Products.Five/branches/1.4/tests/test_testbrowser.py (from rev 67936, Products.Five/trunk/tests/test_testbrowser.py) === --- Products.Five/trunk/tests/test_testbrowser.py 2006-05-03 19:49:06 UTC (rev 67936) +++ Products.Five/branches/1.4/tests/test_testbrowser.py2006-05-04 00:56:11 UTC (rev 67959) @@ -0,0 +1,83 @@ +## +# +# Copyright (c) 2004, 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. +# +## +Unit tests for the testbrowser module. + +$Id$ + + +import unittest +from Testing.ZopeTestCase import FunctionalDocTestSuite +from OFS.SimpleItem import Item + +class CookieStub(Item): +This is a cookie stub. + +def __call__(self, REQUEST): +REQUEST.RESPONSE.setCookie('evil', 'cookie') +return 'Stub' + +def doctest_cookies(): + +We want to make sure that our testbrowser correctly understands +cookies. We'll add a stub to ``self.folder`` that sets a cookie. + + from Products.Five.tests.test_testbrowser import CookieStub + self.folder._setObject('stub', CookieStub()) +'stub' + +This response looks alright: + + response = self.publish('/test_folder_1_/stub') + print str(response) #doctest: +ELLIPSIS +Status: 200 OK +... +Set-Cookie: evil=cookie +... + +Let's try to look at the same
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Shared/DC/ZRDB/DA.py Backport fix for collector #1429 to 2.8 branch: Fix name/value traversal of ZSQL methods
Log message for revision 68160: Backport fix for collector #1429 to 2.8 branch: Fix name/value traversal of ZSQL methods Changed: U Zope/branches/Zope-2_8-branch/lib/python/Shared/DC/ZRDB/DA.py -=- Modified: Zope/branches/Zope-2_8-branch/lib/python/Shared/DC/ZRDB/DA.py === --- Zope/branches/Zope-2_8-branch/lib/python/Shared/DC/ZRDB/DA.py 2006-05-17 06:48:19 UTC (rev 68159) +++ Zope/branches/Zope-2_8-branch/lib/python/Shared/DC/ZRDB/DA.py 2006-05-17 06:51:42 UTC (rev 68160) @@ -527,10 +527,10 @@ class Traverse(ExtensionClass.Base): Helper class for 'traversing' searches during URL traversal -_r=None _da=None def __init__(self, da, args, name=None): +self._r=None self._da=da self._args=args self._name=name ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/skel/etc/site.zcml - set svn:eol-style
Log message for revision 68390: - set svn:eol-style - removed tabs Changed: UU Zope/trunk/skel/etc/site.zcml -=- Modified: Zope/trunk/skel/etc/site.zcml === --- Zope/trunk/skel/etc/site.zcml 2006-05-30 05:25:36 UTC (rev 68389) +++ Zope/trunk/skel/etc/site.zcml 2006-05-30 08:11:11 UTC (rev 68390) @@ -1,6 +1,7 @@ -configure xmlns=http://namespaces.zope.org/zope; - xmlns:meta=http://namespaces.zope.org/meta; - xmlns:five=http://namespaces.zope.org/five; +configure +xmlns=http://namespaces.zope.org/zope; +xmlns:meta=http://namespaces.zope.org/meta; +xmlns:five=http://namespaces.zope.org/five; include package=Products.Five / meta:redefinePermission from=zope2.Public to=zope.Public / Property changes on: Zope/trunk/skel/etc/site.zcml ___ 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/ - Collector #2063: cleaned up some mess in MailHost.sendTemplate()
Log message for revision 68645: - Collector #2063: cleaned up some mess in MailHost.sendTemplate() Changed: U Zope/branches/2.9/doc/CHANGES.txt U Zope/branches/2.9/lib/python/Products/MailHost/MailHost.py -=- Modified: Zope/branches/2.9/doc/CHANGES.txt === --- Zope/branches/2.9/doc/CHANGES.txt 2006-06-15 09:43:53 UTC (rev 68644) +++ Zope/branches/2.9/doc/CHANGES.txt 2006-06-15 09:44:48 UTC (rev 68645) @@ -27,6 +27,8 @@ - Collector #2073: fixed misbehaviour of OFS.Owned.changeOwnership + - Collector #2063: cleaned up some mess in MailHost.sendTemplate() + Zope 2.9.3 (2006/05/13) Bugs fixed Modified: Zope/branches/2.9/lib/python/Products/MailHost/MailHost.py === --- Zope/branches/2.9/lib/python/Products/MailHost/MailHost.py 2006-06-15 09:43:53 UTC (rev 68644) +++ Zope/branches/2.9/lib/python/Products/MailHost/MailHost.py 2006-06-15 09:44:48 UTC (rev 68645) @@ -125,7 +125,7 @@ messageText = mtemplate(self, trueself.REQUEST) messageText, mto, mfrom = _mungeHeaders( messageText, mto, mfrom) messageText=_encode(messageText, encode) -self._send(mfrom, mto, messageText) +trueself._send(mfrom, mto, messageText) if not statusTemplate: return SEND OK ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.4/ * Enabled the viewlet related directives by default.
Log message for revision 68635: * Enabled the viewlet related directives by default. * Added acquisition wrappers to viewlets before updating or rendering. * Made the provider directive acquisition wrap the resultant content provider so that simple providers that need security declarations (e.g. those that render pagetemplates) can work with the Zope 2 security machinery. Changed: U Products.Five/branches/1.4/CHANGES.txt U Products.Five/branches/1.4/browser/ProviderExpression.py U Products.Five/branches/1.4/browser/tests/provider.txt U Products.Five/branches/1.4/browser/tests/provider.zcml A Products.Five/branches/1.4/browser/tests/provider_template_based.pt U Products.Five/branches/1.4/configure.zcml U Products.Five/branches/1.4/viewlet/configure.zcml U Products.Five/branches/1.4/viewlet/directives.txt U Products.Five/branches/1.4/viewlet/manager.py U Products.Five/branches/1.4/viewlet/tests.py -=- Modified: Products.Five/branches/1.4/CHANGES.txt === --- Products.Five/branches/1.4/CHANGES.txt 2006-06-14 18:34:19 UTC (rev 68634) +++ Products.Five/branches/1.4/CHANGES.txt 2006-06-14 21:50:00 UTC (rev 68635) @@ -5,6 +5,14 @@ Five 1.4.1 (unreleased) === +* Enabled the viewlet related directives by default. + +* Added acquisition wrappers to viewlets before updating or rendering. + +* Made the provider directive acquisition wrap the resultant content provider + so that simple providers that need security declarations (e.g. those that + render pagetemplates) can work with the Zope 2 security machinery. + * Added Five.browser.pagetemplatefile.ViewPageTemplateFile as an alias to ZopeTwoPageTemplateFile and as a Zope 2 correspondence to zope.app.pagetemplate.ViewPageTemplateFile. Modified: Products.Five/branches/1.4/browser/ProviderExpression.py === --- Products.Five/branches/1.4/browser/ProviderExpression.py2006-06-14 18:34:19 UTC (rev 68634) +++ Products.Five/branches/1.4/browser/ProviderExpression.py2006-06-14 21:50:00 UTC (rev 68635) @@ -49,6 +49,9 @@ if provider is None: raise interfaces.ContentProviderLookupError(name) +if getattr(provider, '__of__', None) is not None: +provider = provider.__of__(context) + # Insert the data gotten from the context addTALNamespaceData(provider, econtext) Modified: Products.Five/branches/1.4/browser/tests/provider.txt === --- Products.Five/branches/1.4/browser/tests/provider.txt 2006-06-14 18:34:19 UTC (rev 68634) +++ Products.Five/branches/1.4/browser/tests/provider.txt 2006-06-14 21:50:00 UTC (rev 68635) @@ -189,3 +189,45 @@ /div /body /html + +Now we test a provider using a PageTemplateFile to render itself. It must +inherit from an Acquisition base class so that the template can use Zope 2 +security mechanisms: + + import os, tempfile + temp_dir = tempfile.mkdtemp() + dynTemplate = os.path.join(temp_dir, 'dynamic_template.pt') + open(dynTemplate, 'w').write( + ... 'A simple template: tal:simple replace=python:view.my_property /') + from Acquisition import Explicit + from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile + class TemplateProvider(Explicit): + ... zope.component.adapts(zope.interface.Interface, + ... browser.IDefaultBrowserLayer, + ... zope.interface.Interface) + ... + ... def __init__(self, context, request, view): + ... self.__parent__ = view + ... self.context = context + ... self.request = request + ... self.view = view + ... + ... def update(self): + ... pass + ... # Is there a better way to tell it to look in the current dir? + ... render = ZopeTwoPageTemplateFile(dynTemplate, temp_dir) + ... my_property = 'A string for you' + + zope.component.provideAdapter(TemplateProvider, name='mypage.TemplateProvider', provides=interfaces.IContentProvider) + print http(r''' + ... GET /test_folder_1_/content_obj/template_based.html HTTP/1.1 + ... ''') + HTTP/1.1 200 OK + ... + A simple template: A string for you + + Cleanup + --- + + import shutil + shutil.rmtree(temp_dir) Modified: Products.Five/branches/1.4/browser/tests/provider.zcml === --- Products.Five/branches/1.4/browser/tests/provider.zcml 2006-06-14 18:34:19 UTC (rev 68634) +++ Products.Five/branches/1.4/browser/tests/provider.zcml 2006-06-14 21:50:00 UTC (rev 68635) @@ -29,5 +29,11 @@ name=namespace2.html permission=zope2.Public / + browser:page + for=Products.Five.tests.testing.simplecontent.ISimpleContent +
[Zope-Checkins] SVN: Zope/trunk/ - Collector #2063: cleaned up some mess in MailHost.sendTemplate()
Log message for revision 68643: - Collector #2063: cleaned up some mess in MailHost.sendTemplate() Changed: U Zope/trunk/doc/CHANGES.txt U Zope/trunk/lib/python/Products/MailHost/MailHost.py -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt 2006-06-15 00:36:27 UTC (rev 68642) +++ Zope/trunk/doc/CHANGES.txt 2006-06-15 09:42:55 UTC (rev 68643) @@ -31,4 +31,6 @@ - Collector #2073: fixed misbehaviour of OFS.Owned.changeOwnership + - Collector #2063: cleaned up some mess in MailHost.sendTemplate() + Modified: Zope/trunk/lib/python/Products/MailHost/MailHost.py === --- Zope/trunk/lib/python/Products/MailHost/MailHost.py 2006-06-15 00:36:27 UTC (rev 68642) +++ Zope/trunk/lib/python/Products/MailHost/MailHost.py 2006-06-15 09:42:55 UTC (rev 68643) @@ -125,7 +125,7 @@ messageText = mtemplate(self, trueself.REQUEST) messageText, mto, mfrom = _mungeHeaders( messageText, mto, mfrom) messageText=_encode(messageText, encode) -self._send(mfrom, mto, messageText) +trueself._send(mfrom, mto, messageText) if not statusTemplate: return SEND OK ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/ - Collector #2063: cleaned up some mess in MailHost.sendTemplate()
Log message for revision 68644: - Collector #2063: cleaned up some mess in MailHost.sendTemplate() Changed: U Zope/branches/2.10/doc/CHANGES.txt U Zope/branches/2.10/lib/python/Products/MailHost/MailHost.py -=- Modified: Zope/branches/2.10/doc/CHANGES.txt === --- Zope/branches/2.10/doc/CHANGES.txt 2006-06-15 09:42:55 UTC (rev 68643) +++ Zope/branches/2.10/doc/CHANGES.txt 2006-06-15 09:43:53 UTC (rev 68644) @@ -33,6 +33,8 @@ - Collector #2073: fixed misbehaviour of OFS.Owned.changeOwnership + - Collector #2063: cleaned up some mess in MailHost.sendTemplate() + Zope 2.10.0 beta 1 (2006/05/30) Restructuring Modified: Zope/branches/2.10/lib/python/Products/MailHost/MailHost.py === --- Zope/branches/2.10/lib/python/Products/MailHost/MailHost.py 2006-06-15 09:42:55 UTC (rev 68643) +++ Zope/branches/2.10/lib/python/Products/MailHost/MailHost.py 2006-06-15 09:43:53 UTC (rev 68644) @@ -125,7 +125,7 @@ messageText = mtemplate(self, trueself.REQUEST) messageText, mto, mfrom = _mungeHeaders( messageText, mto, mfrom) messageText=_encode(messageText, encode) -self._send(mfrom, mto, messageText) +trueself._send(mfrom, mto, messageText) if not statusTemplate: return SEND OK ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ - Collector #2063: cleaned up some mess in MailHost.sendTemplate()
Log message for revision 68646: - Collector #2063: cleaned up some mess in MailHost.sendTemplate() Changed: U Zope/branches/Zope-2_8-branch/doc/CHANGES.txt U Zope/branches/Zope-2_8-branch/lib/python/Products/MailHost/MailHost.py -=- Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt === --- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2006-06-15 09:44:48 UTC (rev 68645) +++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2006-06-15 09:45:34 UTC (rev 68646) @@ -25,8 +25,10 @@ - Collector #2073: fixed misbehaviour of OFS.Owned.changeOwnership - - Collector #1944: HTTPRequest.resolve_url has error in raising errors + - Collector #1944: HTTPRequest.resolve_url has error in raising error + - Collector #2063: cleaned up some mess in MailHost.sendTemplate() + Zope 2.8.7 (2007/05/29) Features added: Modified: Zope/branches/Zope-2_8-branch/lib/python/Products/MailHost/MailHost.py === --- Zope/branches/Zope-2_8-branch/lib/python/Products/MailHost/MailHost.py 2006-06-15 09:44:48 UTC (rev 68645) +++ Zope/branches/Zope-2_8-branch/lib/python/Products/MailHost/MailHost.py 2006-06-15 09:45:34 UTC (rev 68646) @@ -125,7 +125,7 @@ messageText = mtemplate(self, trueself.REQUEST) messageText, mto, mfrom = _mungeHeaders( messageText, mto, mfrom) messageText=_encode(messageText, encode) -self._send(mfrom, mto, messageText) +trueself._send(mfrom, mto, messageText) if not statusTemplate: return SEND OK ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py Collector #2133: standard_error_messages are out of sync.
Log message for revision 68666: Collector #2133: standard_error_messages are out of sync. Changed: U Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py -=- Modified: Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py === --- Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py2006-06-15 18:04:52 UTC (rev 68665) +++ Zope/branches/2.10/lib/python/ZPublisher/HTTPResponse.py2006-06-15 18:05:20 UTC (rev 68666) @@ -626,18 +626,9 @@ def _error_html(self,title,body): # XXX could this try to use standard_error_message somehow? return (\ -table border=0 width=100% -tr valign=top - -td width=10% align=center -nbsp; -/td - -td width=90% h2Site Error/h2 pAn error was encountered while publishing this resource. - /p + \ - + /p pstrong%s/strong/p %s %(title,body) + \ @@ -654,14 +645,12 @@ /ul pFor more detailed information about the error, please - refer to error log. + refer to the error log. /p pIf the error persists please contact the site maintainer. Thank you for your patience. - /p -/td/tr -/table) + /p) def notFoundError(self,entry='Unknown'): ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/regebro-traversalfix/ View and attribute lookup order was changed to the following:
Log message for revision 68655: View and attribute lookup order was changed to the following: 1. Unacquired attributes 2. Views 3. Acquired attributes According to consensus in z3-five mailing list: http://codespeak.net/pipermail/z3-five/2006q2/001474.html Changed: U Zope/branches/regebro-traversalfix/doc/CHANGES.txt U Zope/branches/regebro-traversalfix/lib/python/OFS/Traversable.py U Zope/branches/regebro-traversalfix/lib/python/OFS/tests/testTraverse.py U Zope/branches/regebro-traversalfix/lib/python/ZPublisher/BaseRequest.py -=- Modified: Zope/branches/regebro-traversalfix/doc/CHANGES.txt === --- Zope/branches/regebro-traversalfix/doc/CHANGES.txt 2006-06-15 14:47:15 UTC (rev 68654) +++ Zope/branches/regebro-traversalfix/doc/CHANGES.txt 2006-06-15 15:18:40 UTC (rev 68655) @@ -33,4 +33,10 @@ - Collector #2063: cleaned up some mess in MailHost.sendTemplate() - + - View and attribute lookup order was changed to the following: + 1. Unacquired attributes + 2. Views + 3. Acquired attributes +According to consensus in z3-five mailing list: +http://codespeak.net/pipermail/z3-five/2006q2/001474.html + Modified: Zope/branches/regebro-traversalfix/lib/python/OFS/Traversable.py === --- Zope/branches/regebro-traversalfix/lib/python/OFS/Traversable.py 2006-06-15 14:47:15 UTC (rev 68654) +++ Zope/branches/regebro-traversalfix/lib/python/OFS/Traversable.py 2006-06-15 15:18:40 UTC (rev 68655) @@ -190,76 +190,93 @@ continue bobo_traverse = _getattr(obj, '__bobo_traverse__', _none) -if name and name[:1] in '@+': -# Process URI segment parameters. -ns, nm = nsParse(name) -if ns: -try: -next = namespaceLookup(ns, nm, obj, - self.REQUEST).__of__(obj) -if restricted and not securityManager.validate( -obj, obj, name, next): +try: +if name and name[:1] in '@+': +# Process URI segment parameters. +ns, nm = nsParse(name) +if ns: +try: +next = namespaceLookup(ns, nm, obj, + self.REQUEST).__of__(obj) +if restricted and not securityManager.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: +if aq_base(next) is not next: +# The object is wrapped, so the acquisition +# context is the container. +container = aq_parent(aq_inner(next)) +elif _getattr(next, 'im_self', _none) is not _none: +# Bound method, the bound instance +# is the container +container = next.im_self +elif _getattr(aq_base(obj), name, marker) == next: +# Unwrapped direct attribute of the object so +# object is the container +container = obj +else: +# Can't determine container +container = _none +try: +validated = securityManager.validate( + obj, container, name, next) +except Unauthorized: +# If next is a simple unwrapped property, it's +# parentage is indeterminate, but it may have been +# acquired safely. In this case validate will +# raise an error, and we can explicitly check that +# our value was acquired safely. +validated = 0 +if container is _none and \ + guarded_getattr(obj, name, marker) is next: +validated = 1 +if not
[Zope-Checkins] SVN: Zope/branches/2.10/ Use updated ZODB 3.7 (http://www.zope.org/Collectors/Zope/2016).
Log message for revision 68682: Use updated ZODB 3.7 (http://www.zope.org/Collectors/Zope/2016). Changed: U Zope/branches/2.10/doc/CHANGES.txt _U Zope/branches/2.10/lib/python/ -=- Modified: Zope/branches/2.10/doc/CHANGES.txt === --- Zope/branches/2.10/doc/CHANGES.txt 2006-06-16 02:10:26 UTC (rev 68681) +++ Zope/branches/2.10/doc/CHANGES.txt 2006-06-16 02:12:17 UTC (rev 68682) @@ -18,6 +18,9 @@ Bugs Fixed + - Collector #2016: DemoStorage couldn't wrap base storages without + an '_oid' attribute. + - Collector #2118: Empty TALES path expressions are allowed in Zope 2. Property changes on: Zope/branches/2.10/lib/python ___ Name: svn:externals - ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/BTrees persistent -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/persistent ThreadedAsync -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ThreadedAsync transaction-r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/transaction ZEO-r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZEO ZODB -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZODB ZopeUndo -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/pytz zodbcode -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/zodbcode ClientCookie -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/ClientCookie mechanize -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/mechanize docutils svn://svn.zope.org/repos/main/docutils/tags/0.4.0 + ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/BTrees persistent -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/persistent ThreadedAsync -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ThreadedAsync transaction-r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/transaction ZEO-r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZEO ZODB -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZODB ZopeUndo -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/pytz zodbcode -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/zodbcode ClientCookie -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/ClientCookie mechanize -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/mechanize docutils svn://svn.zope.org/repos/main/docutils/tags/0.4.0 ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/ Use updated ZODB 3.7 (http://www.zope.org/Collectors/Zope/2016).
Log message for revision 68683: Use updated ZODB 3.7 (http://www.zope.org/Collectors/Zope/2016). Changed: _U Zope/trunk/lib/python/ -=- Property changes on: Zope/trunk/lib/python ___ Name: svn:externals - ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/BTrees persistent -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/persistent ThreadedAsync -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ThreadedAsync transaction-r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/transaction ZEO-r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZEO ZODB -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZODB ZopeUndo -r 68012 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/pytz zodbcode -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/zodbcode ClientCookie -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/ClientCookie mechanize -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/mechanize docutils svn://svn.zope.org/repos/main/docutils/tags/0.4.0 + ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/BTrees persistent -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/persistent ThreadedAsync -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ThreadedAsync transaction-r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/transaction ZEO-r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZEO ZODB -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZODB ZopeUndo -r 68677 svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/pytz zodbcode -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/zodbcode ClientCookie -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/ClientCookie mechanize -r 68324 svn://svn.zope.org/repos/main/Zope3/branches/3.3/src/mechanize docutils svn://svn.zope.org/repos/main/docutils/tags/0.4.0 ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/ZPublisher/ DateTime marshalling addendum:
Log message for revision 68713: DateTime marshalling addendum: Fixed edge case of attribute name ''. Changed: U Zope/branches/2.10/lib/python/ZPublisher/tests/test_xmlrpc.py U Zope/branches/2.10/lib/python/ZPublisher/xmlrpc.py -=- Modified: Zope/branches/2.10/lib/python/ZPublisher/tests/test_xmlrpc.py === --- Zope/branches/2.10/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-17 16:29:57 UTC (rev 68712) +++ Zope/branches/2.10/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-17 16:32:56 UTC (rev 68713) @@ -191,7 +191,20 @@ response.setBody(body) self.assertRaises(xmlrpclib.Fault, xmlrpclib.loads, faux._body) +def test_emptystringattribute(self): +# Test an edge case: attribute name '' is possible, +# at least in theory. +import xmlrpclib +body = FauxInstance(_secret='abc') +setattr(body, '', True) +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0] +self.assertEqual(data, {'': True}) + def test_suite(): return unittest.TestSuite((unittest.makeSuite(XMLRPCResponseTests),)) Modified: Zope/branches/2.10/lib/python/ZPublisher/xmlrpc.py === --- Zope/branches/2.10/lib/python/ZPublisher/xmlrpc.py 2006-06-17 16:29:57 UTC (rev 68712) +++ Zope/branches/2.10/lib/python/ZPublisher/xmlrpc.py 2006-06-17 16:32:56 UTC (rev 68713) @@ -43,7 +43,8 @@ # We want to avoid disclosing private attributes. # Private attributes are by convention named with # a leading underscore character. -value = dict([(k, v) for (k, v) in value.__dict__.items() if k[0] != '_']) +value = dict([(k, v) for (k, v) in value.__dict__.items() + if k[:1] != '_']) self.dump_struct(value, write) xmlrpclib.Marshaller.dispatch[types.InstanceType] = dump_instance ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/ Made DateTime.DateTime marshallable via XML-RPC.
Log message for revision 68691: Made DateTime.DateTime marshallable via XML-RPC. Fixes http://www.zope.org/Collectors/Zope/2109 Changed: U Zope/branches/2.10/lib/python/DateTime/DateTime.py U Zope/branches/2.10/lib/python/ZPublisher/tests/test_xmlrpc.py U Zope/branches/2.10/lib/python/ZPublisher/xmlrpc.py -=- Modified: Zope/branches/2.10/lib/python/DateTime/DateTime.py === --- Zope/branches/2.10/lib/python/DateTime/DateTime.py 2006-06-16 15:45:43 UTC (rev 68690) +++ Zope/branches/2.10/lib/python/DateTime/DateTime.py 2006-06-16 15:54:47 UTC (rev 68691) @@ -1797,7 +1797,15 @@ d1 = (( d4 - L) % 365) + L return d1/7 + 1 +def encode(self, out): + +Encode value for XML-RPC + +out.write('valuedateTime.iso8601') +out.write(self.ISO8601()) +out.write('/dateTime.iso8601/value\n') + class strftimeFormatter: def __init__(self, dt, format): Modified: Zope/branches/2.10/lib/python/ZPublisher/tests/test_xmlrpc.py === --- Zope/branches/2.10/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-16 15:45:43 UTC (rev 68690) +++ Zope/branches/2.10/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-16 15:54:47 UTC (rev 68691) @@ -1,4 +1,5 @@ import unittest +from DateTime import DateTime class FauxResponse: @@ -12,6 +13,9 @@ def setHeader(self, name, value): self._headers[name] = value +def setStatus(self, status): +self._status = status + class FauxInstance: def __init__(self, **kw): self.__dict__.update(kw) @@ -55,7 +59,139 @@ data, method = xmlrpclib.loads(faux._body) self.assert_(data[0]['public'] is None) +def test_instance(self): +# Instances are turned into dicts with their private +# attributes removed. +import xmlrpclib +body = FauxInstance(_secret='abc', public='def') +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0] +self.assertEqual(data, {'public': 'def'}) +def test_instanceattribute(self): +# While the removal of private ('_') attributes works fine for the +# top-level instance, how about attributes that are themselves +# instances? +import xmlrpclib +body = FauxInstance(public=FauxInstance(_secret='abc', public='def')) +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0]['public'] +self.assertEqual(data, {'public': 'def'}) + +def test_instanceattribute_recursive(self): +# Instance flattening should work recursively, ad infinitum +import xmlrpclib +body = FauxInstance(public=FauxInstance(public=FauxInstance(_secret='abc', public='def'))) +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0]['public']['public'] +self.assertEqual(data, {'public': 'def'}) + +def test_instance_in_list(self): +# Instances are turned into dicts with their private +# attributes removed, even when embedded in another +# data structure. +import xmlrpclib +body = [FauxInstance(_secret='abc', public='def')] +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0][0] +self.assertEqual(data, {'public': 'def'}) + +def test_instance_in_dict(self): +# Instances are turned into dicts with their private +# attributes removed, even when embedded in another +# data structure. +import xmlrpclib +body = {'faux': FauxInstance(_secret='abc', public='def')} +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0]['faux'] +self.assertEqual(data, {'public': 'def'}) + +def test_zopedatetimeinstance(self): +# DateTime instance at top-level +import xmlrpclib +body = DateTime('2006-05-24 07:00:00 GMT+0') +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0] +self.failUnless(isinstance(data, xmlrpclib.DateTime)) +self.assertEqual(data.value, u'2006-05-24T07:00:00+00:00') + +def test_zopedatetimeattribute(self): +# DateTime instance as attribute +import xmlrpclib +body = FauxInstance(public=DateTime('2006-05-24
[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/ZPublisher/ DateTime marshalling addendum:
Log message for revision 68712: DateTime marshalling addendum: Fixed edge case of attribute name ''. Changed: U Zope/branches/2.9/lib/python/ZPublisher/tests/test_xmlrpc.py U Zope/branches/2.9/lib/python/ZPublisher/xmlrpc.py -=- Modified: Zope/branches/2.9/lib/python/ZPublisher/tests/test_xmlrpc.py === --- Zope/branches/2.9/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-17 16:09:40 UTC (rev 68711) +++ Zope/branches/2.9/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-17 16:29:57 UTC (rev 68712) @@ -191,7 +191,20 @@ response.setBody(body) self.assertRaises(xmlrpclib.Fault, xmlrpclib.loads, faux._body) +def test_emptystringattribute(self): +# Test an edge case: attribute name '' is possible, +# at least in theory. +import xmlrpclib +body = FauxInstance(_secret='abc') +setattr(body, '', True) +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0] +self.assertEqual(data, {'': True}) + def test_suite(): return unittest.TestSuite((unittest.makeSuite(XMLRPCResponseTests),)) Modified: Zope/branches/2.9/lib/python/ZPublisher/xmlrpc.py === --- Zope/branches/2.9/lib/python/ZPublisher/xmlrpc.py 2006-06-17 16:09:40 UTC (rev 68711) +++ Zope/branches/2.9/lib/python/ZPublisher/xmlrpc.py 2006-06-17 16:29:57 UTC (rev 68712) @@ -43,7 +43,8 @@ # We want to avoid disclosing private attributes. # Private attributes are by convention named with # a leading underscore character. -value = dict([(k, v) for (k, v) in value.__dict__.items() if k[0] != '_']) +value = dict([(k, v) for (k, v) in value.__dict__.items() + if k[:1] != '_']) self.dump_struct(value, write) xmlrpclib.Marshaller.dispatch[types.InstanceType] = dump_instance ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/ Made DateTime.DateTime marshallable via XML-RPC.
Log message for revision 68692: Made DateTime.DateTime marshallable via XML-RPC. Fixes http://www.zope.org/Collectors/Zope/2109 Changed: U Zope/trunk/lib/python/DateTime/DateTime.py U Zope/trunk/lib/python/ZPublisher/tests/test_xmlrpc.py U Zope/trunk/lib/python/ZPublisher/xmlrpc.py -=- Modified: Zope/trunk/lib/python/DateTime/DateTime.py === --- Zope/trunk/lib/python/DateTime/DateTime.py 2006-06-16 15:54:47 UTC (rev 68691) +++ Zope/trunk/lib/python/DateTime/DateTime.py 2006-06-16 15:55:50 UTC (rev 68692) @@ -1797,7 +1797,15 @@ d1 = (( d4 - L) % 365) + L return d1/7 + 1 +def encode(self, out): + +Encode value for XML-RPC + +out.write('valuedateTime.iso8601') +out.write(self.ISO8601()) +out.write('/dateTime.iso8601/value\n') + class strftimeFormatter: def __init__(self, dt, format): Modified: Zope/trunk/lib/python/ZPublisher/tests/test_xmlrpc.py === --- Zope/trunk/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-16 15:54:47 UTC (rev 68691) +++ Zope/trunk/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-16 15:55:50 UTC (rev 68692) @@ -1,4 +1,5 @@ import unittest +from DateTime import DateTime class FauxResponse: @@ -12,6 +13,9 @@ def setHeader(self, name, value): self._headers[name] = value +def setStatus(self, status): +self._status = status + class FauxInstance: def __init__(self, **kw): self.__dict__.update(kw) @@ -55,7 +59,139 @@ data, method = xmlrpclib.loads(faux._body) self.assert_(data[0]['public'] is None) +def test_instance(self): +# Instances are turned into dicts with their private +# attributes removed. +import xmlrpclib +body = FauxInstance(_secret='abc', public='def') +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0] +self.assertEqual(data, {'public': 'def'}) +def test_instanceattribute(self): +# While the removal of private ('_') attributes works fine for the +# top-level instance, how about attributes that are themselves +# instances? +import xmlrpclib +body = FauxInstance(public=FauxInstance(_secret='abc', public='def')) +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0]['public'] +self.assertEqual(data, {'public': 'def'}) + +def test_instanceattribute_recursive(self): +# Instance flattening should work recursively, ad infinitum +import xmlrpclib +body = FauxInstance(public=FauxInstance(public=FauxInstance(_secret='abc', public='def'))) +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0]['public']['public'] +self.assertEqual(data, {'public': 'def'}) + +def test_instance_in_list(self): +# Instances are turned into dicts with their private +# attributes removed, even when embedded in another +# data structure. +import xmlrpclib +body = [FauxInstance(_secret='abc', public='def')] +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0][0] +self.assertEqual(data, {'public': 'def'}) + +def test_instance_in_dict(self): +# Instances are turned into dicts with their private +# attributes removed, even when embedded in another +# data structure. +import xmlrpclib +body = {'faux': FauxInstance(_secret='abc', public='def')} +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0]['faux'] +self.assertEqual(data, {'public': 'def'}) + +def test_zopedatetimeinstance(self): +# DateTime instance at top-level +import xmlrpclib +body = DateTime('2006-05-24 07:00:00 GMT+0') +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0] +self.failUnless(isinstance(data, xmlrpclib.DateTime)) +self.assertEqual(data.value, u'2006-05-24T07:00:00+00:00') + +def test_zopedatetimeattribute(self): +# DateTime instance as attribute +import xmlrpclib +body = FauxInstance(public=DateTime('2006-05-24 07:00:00 GMT+0')) +faux = FauxResponse() +response =
[Zope-Checkins] SVN: Zope/branches/2.9/ Made DateTime.DateTime marshallable via XML-RPC.
Log message for revision 68690: Made DateTime.DateTime marshallable via XML-RPC. Fixes http://www.zope.org/Collectors/Zope/2109 Changed: U Zope/branches/2.9/doc/CHANGES.txt U Zope/branches/2.9/lib/python/DateTime/DateTime.py U Zope/branches/2.9/lib/python/ZPublisher/tests/test_xmlrpc.py U Zope/branches/2.9/lib/python/ZPublisher/xmlrpc.py -=- Modified: Zope/branches/2.9/doc/CHANGES.txt === --- Zope/branches/2.9/doc/CHANGES.txt 2006-06-16 12:02:13 UTC (rev 68689) +++ Zope/branches/2.9/doc/CHANGES.txt 2006-06-16 15:45:43 UTC (rev 68690) @@ -18,6 +18,8 @@ Bugs fixed + - Collector #2109: XML-RPC did not handle DateTime.DateTime objects. + - Collector #2016: DemoStorage couldn't wrap base storages without an '_oid' attribute. Modified: Zope/branches/2.9/lib/python/DateTime/DateTime.py === --- Zope/branches/2.9/lib/python/DateTime/DateTime.py 2006-06-16 12:02:13 UTC (rev 68689) +++ Zope/branches/2.9/lib/python/DateTime/DateTime.py 2006-06-16 15:45:43 UTC (rev 68690) @@ -1805,7 +1805,15 @@ d1 = (( d4 - L) % 365) + L return d1/7 + 1 +def encode(self, out): + +Encode value for XML-RPC + +out.write('valuedateTime.iso8601') +out.write(self.ISO8601()) +out.write('/dateTime.iso8601/value\n') + class strftimeFormatter: def __init__(self, dt, format): Modified: Zope/branches/2.9/lib/python/ZPublisher/tests/test_xmlrpc.py === --- Zope/branches/2.9/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-16 12:02:13 UTC (rev 68689) +++ Zope/branches/2.9/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-16 15:45:43 UTC (rev 68690) @@ -1,4 +1,5 @@ import unittest +from DateTime import DateTime class FauxResponse: @@ -12,6 +13,9 @@ def setHeader(self, name, value): self._headers[name] = value +def setStatus(self, status): +self._status = status + class FauxInstance: def __init__(self, **kw): self.__dict__.update(kw) @@ -55,7 +59,139 @@ data, method = xmlrpclib.loads(faux._body) self.assert_(data[0]['public'] is None) +def test_instance(self): +# Instances are turned into dicts with their private +# attributes removed. +import xmlrpclib +body = FauxInstance(_secret='abc', public='def') +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0] +self.assertEqual(data, {'public': 'def'}) +def test_instanceattribute(self): +# While the removal of private ('_') attributes works fine for the +# top-level instance, how about attributes that are themselves +# instances? +import xmlrpclib +body = FauxInstance(public=FauxInstance(_secret='abc', public='def')) +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0]['public'] +self.assertEqual(data, {'public': 'def'}) + +def test_instanceattribute_recursive(self): +# Instance flattening should work recursively, ad infinitum +import xmlrpclib +body = FauxInstance(public=FauxInstance(public=FauxInstance(_secret='abc', public='def'))) +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0]['public']['public'] +self.assertEqual(data, {'public': 'def'}) + +def test_instance_in_list(self): +# Instances are turned into dicts with their private +# attributes removed, even when embedded in another +# data structure. +import xmlrpclib +body = [FauxInstance(_secret='abc', public='def')] +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0][0] +self.assertEqual(data, {'public': 'def'}) + +def test_instance_in_dict(self): +# Instances are turned into dicts with their private +# attributes removed, even when embedded in another +# data structure. +import xmlrpclib +body = {'faux': FauxInstance(_secret='abc', public='def')} +faux = FauxResponse() +response = self._makeOne(faux) +response.setBody(body) +data, method = xmlrpclib.loads(faux._body) +data = data[0]['faux'] +self.assertEqual(data, {'public': 'def'}) + +def test_zopedatetimeinstance(self): +# DateTime instance at top-level +import
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/OFS/tests/testObjectManager.py Add simple tests for manage_hasId
Log message for revision 68648: Add simple tests for manage_hasId Changed: U Zope/branches/2.10/lib/python/OFS/tests/testObjectManager.py -=- Modified: Zope/branches/2.10/lib/python/OFS/tests/testObjectManager.py === --- Zope/branches/2.10/lib/python/OFS/tests/testObjectManager.py 2006-06-15 10:24:55 UTC (rev 68647) +++ Zope/branches/2.10/lib/python/OFS/tests/testObjectManager.py 2006-06-15 11:22:56 UTC (rev 68648) @@ -411,6 +411,16 @@ self.failUnless(filename.endswith('.zexp') or filename.endswith('.xml')) +def test_hasId(self): +om = self._makeOne() +request={'id' : 'test'} +self.assertRaises(KeyError, om.manage_hasId, request) + +si = SimpleItem('test') +om._setObject('test', si) +om.manage_hasId(request) + + def test_suite(): suite = unittest.TestSuite() suite.addTest( unittest.makeSuite( ObjectManagerTests ) ) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/regebro-traversalfix/traversable.py BBB fix.
Log message for revision 68747: BBB fix. Changed: U Products.Five/branches/regebro-traversalfix/traversable.py -=- Modified: Products.Five/branches/regebro-traversalfix/traversable.py === --- Products.Five/branches/regebro-traversalfix/traversable.py 2006-06-19 06:56:11 UTC (rev 68746) +++ Products.Five/branches/regebro-traversalfix/traversable.py 2006-06-19 11:12:18 UTC (rev 68747) @@ -22,8 +22,8 @@ __bobo_traverse__ and ITraverser/ITraversable for controlling URL traversal have become obsolete. Use an IPublishTraverse adapter instead. This reference will go away in Zope 2.12., -Traversable = Products.Five.bbb.Traversable, -FiveTraversable = zope.traversing.adapters.DefaultTraversable, +Traversable = Products.Five.bbb:Traversable, +FiveTraversable = zope.traversing.adapters:DefaultTraversable, ) zope.deferredimport.deprecated( Use zope.publisher.browser.TestRequest instead., ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/regebro-traversalfix/ * Added tests to make sure that views are not blocked by acquired attributes.
Log message for revision 68748: * Added tests to make sure that views are not blocked by acquired attributes. * Changed the tests to reflect that defaultView no only works for views (and not on attributes). Changed: U Products.Five/branches/regebro-traversalfix/CHANGES.txt U Products.Five/branches/regebro-traversalfix/browser/tests/test_defaultview.py -=- Modified: Products.Five/branches/regebro-traversalfix/CHANGES.txt === --- Products.Five/branches/regebro-traversalfix/CHANGES.txt 2006-06-19 11:12:18 UTC (rev 68747) +++ Products.Five/branches/regebro-traversalfix/CHANGES.txt 2006-06-19 11:19:30 UTC (rev 68748) @@ -8,7 +8,12 @@ * Added Five.browser.pagetemplatefile.ViewPageTemplateFile as an alias to ZopeTwoPageTemplateFile and as a Zope 2 correspondence to zope.app.pagetemplate.ViewPageTemplateFile. + +* Added tests to make sure that views are not blocked by acquired attributes. +* Changed the tests to reflect that defaultView no only works for views + (and not on attributes). + Five 1.5c (2006-05-29) == Modified: Products.Five/branches/regebro-traversalfix/browser/tests/test_defaultview.py === --- Products.Five/branches/regebro-traversalfix/browser/tests/test_defaultview.py 2006-06-19 11:12:18 UTC (rev 68747) +++ Products.Five/branches/regebro-traversalfix/browser/tests/test_defaultview.py 2006-06-19 11:19:30 UTC (rev 68748) @@ -88,15 +88,14 @@ ... The mouse has been eaten by the eagle -This tests whether an existing ``index_html`` method is still -supported and called: - +In Five 1.5 ``index_html`` you can no longer set default views to anything +else than views: + print http(r''' ... GET /test_folder_1_/testindex HTTP/1.1 ... ''') - HTTP/1.1 200 OK + HTTP/1.1 404 Not Found ... - Default index_html called Disabled __call__ overriding for now. Causes more trouble than it fixes. Thus, no test here: ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/ Use updated ZODB 3.6 (http://www.zope.org/Collectors/Zope/2016).
Log message for revision 68681: Use updated ZODB 3.6 (http://www.zope.org/Collectors/Zope/2016). Changed: U Zope/branches/2.9/doc/CHANGES.txt _U Zope/branches/2.9/lib/python/ -=- Modified: Zope/branches/2.9/doc/CHANGES.txt === --- Zope/branches/2.9/doc/CHANGES.txt 2006-06-16 02:07:30 UTC (rev 68680) +++ Zope/branches/2.9/doc/CHANGES.txt 2006-06-16 02:10:26 UTC (rev 68681) @@ -18,6 +18,9 @@ Bugs fixed + - Collector #2016: DemoStorage couldn't wrap base storages without + an '_oid' attribute. + - Collector #2133: standard_error_messages are out of sync. - Updated Five to bugfix release 1.3.6. 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 svn://svn.zope.org/repos/main/ZODB/tags/3.6.1/src/BTrees persistent svn://svn.zope.org/repos/main/ZODB/tags/3.6.1/src/persistent ThreadedAsync svn://svn.zope.org/repos/main/ZODB/tags/3.6.1/src/ThreadedAsync transactionsvn://svn.zope.org/repos/main/ZODB/tags/3.6.1/src/transaction ZEOsvn://svn.zope.org/repos/main/ZODB/tags/3.6.1/src/ZEO ZODB svn://svn.zope.org/repos/main/ZODB/tags/3.6.1/src/ZODB ZopeUndo svn://svn.zope.org/repos/main/ZODB/tags/3.6.1/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 + ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 68676 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/BTrees persistent -r 68676 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/persistent ThreadedAsync -r 68676 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ThreadedAsync transaction-r 68676 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/transaction ZEO-r 68676 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZEO ZODB -r 68676 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZODB ZopeUndo -r 68676 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 ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PageTemplates/Expressions.py Use custom Provider expression from Five instead of the Zope 3 one which doesn't do acquisition wrapping.
Log message for revision 68672: Use custom Provider expression from Five instead of the Zope 3 one which doesn't do acquisition wrapping. Changed: U Zope/trunk/lib/python/Products/PageTemplates/Expressions.py -=- Modified: Zope/trunk/lib/python/Products/PageTemplates/Expressions.py === --- Zope/trunk/lib/python/Products/PageTemplates/Expressions.py 2006-06-15 21:46:10 UTC (rev 68671) +++ Zope/trunk/lib/python/Products/PageTemplates/Expressions.py 2006-06-15 21:47:12 UTC (rev 68672) @@ -24,13 +24,13 @@ from zope.tales.pythonexpr import PythonExpr from zope.traversing.interfaces import ITraversable from zope.traversing.adapters import traversePathElement -from zope.contentprovider.tales import TALESProviderExpression from zope.proxy import removeAllProxies import zope.app.pagetemplate.engine import OFS.interfaces from Acquisition import aq_base from zExceptions import NotFound, Unauthorized +from Products.Five.browser.providerexpression import Z2ProviderExpression from Products.PageTemplates import ZRPythonExpr from Products.PageTemplates.DeferExpr import LazyExpr from Products.PageTemplates.GlobalTranslationService import getGlobalTranslationService @@ -257,7 +257,7 @@ e.registerType('not', NotExpr) e.registerType('defer', DeferExpr) e.registerType('lazy', LazyExpr) -e.registerType('provider', TALESProviderExpression) +e.registerType('provider', Z2ProviderExpression) e.registerBaseName('modules', SecureModuleImporter) return e ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/regebro-traversalfix/doc/CHANGES.txt The defaultView directive now only looks up views, not attributes.
Log message for revision 68749: The defaultView directive now only looks up views, not attributes. Changed: U Zope/branches/regebro-traversalfix/doc/CHANGES.txt -=- Modified: Zope/branches/regebro-traversalfix/doc/CHANGES.txt === --- Zope/branches/regebro-traversalfix/doc/CHANGES.txt 2006-06-19 11:19:30 UTC (rev 68748) +++ Zope/branches/regebro-traversalfix/doc/CHANGES.txt 2006-06-19 11:26:07 UTC (rev 68749) @@ -40,3 +40,5 @@ According to consensus in z3-five mailing list: http://codespeak.net/pipermail/z3-five/2006q2/001474.html + - The defaultView directive now only looks up views, not attributes. + \ No newline at end of file ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/ * Enabled the viewlet related directives by default.
Log message for revision 68671: * Enabled the viewlet related directives by default. * Added acquisition wrappers to viewlets before updating or rendering. * Moved the custom 'provider:' tales expression back into Five. Made the provider directive acquisition wrap the resultant content provider so that simple providers that need security declarations (e.g. those that render pagetemplates) can work with the Zope 2 security machinery. Changed: U Products.Five/trunk/CHANGES.txt A Products.Five/trunk/browser/providerexpression.py U Products.Five/trunk/browser/tests/provider.txt U Products.Five/trunk/browser/tests/provider.zcml A Products.Five/trunk/browser/tests/provider_template_based.pt U Products.Five/trunk/configure.zcml U Products.Five/trunk/viewlet/configure.zcml U Products.Five/trunk/viewlet/directives.txt U Products.Five/trunk/viewlet/manager.py U Products.Five/trunk/viewlet/tests.py -=- Modified: Products.Five/trunk/CHANGES.txt === --- Products.Five/trunk/CHANGES.txt 2006-06-15 18:19:07 UTC (rev 68670) +++ Products.Five/trunk/CHANGES.txt 2006-06-15 21:46:10 UTC (rev 68671) @@ -5,6 +5,15 @@ Five 1.5 (unreleased) = +* Enabled the viewlet related directives by default. + +* Added acquisition wrappers to viewlets before updating or rendering. + +* Moved the custom 'provider:' tales expression back into Five. Made the + provider directive acquisition wrap the resultant content provider so that + simple providers that need security declarations (e.g. those that render + pagetemplates) can work with the Zope 2 security machinery. + * Added Five.browser.pagetemplatefile.ViewPageTemplateFile as an alias to ZopeTwoPageTemplateFile and as a Zope 2 correspondence to zope.app.pagetemplate.ViewPageTemplateFile. @@ -17,11 +26,11 @@ * Zope 2.10+ now includes site.zcml as part of its instance creation skel directory. As a consequence Five now requires this file to exist - in every instance. If upgrading a site from Zope 2.9 to 2.10, you will - need to copy site.zcml and package-includes/ from your installed Zope - installation location (skel/etc/) into the etc/ directory of your upgraded + in every instance. If upgrading a site from Zope 2.9 to 2.10, you will + need to copy site.zcml and package-includes/ from your installed Zope + installation location (skel/etc/) into the etc/ directory of your upgraded instance. - + The rationale for requiring this new file is to bring Zope 2 instances closer in consistency to Zope 3 instances. It also eases use of Zope 3 coding techniques in Zope 2 and removes some confusion when trying @@ -190,7 +199,7 @@ When no Zope 3-style view is found, first the object's original ``__bobo_traverse__`` is tried. If that does not exist, Traversable resorts to attribute look-up. - + * Unit tests that did i18n via Localizer would fail because the request attribute that keeps Localizers list of preferred languages did not exist. Added: Products.Five/trunk/browser/providerexpression.py === --- Products.Five/trunk/browser/providerexpression.py 2006-06-15 18:19:07 UTC (rev 68670) +++ Products.Five/trunk/browser/providerexpression.py 2006-06-15 21:46:10 UTC (rev 68671) @@ -0,0 +1,37 @@ +import zope.component +from zope.contentprovider import interfaces as cp_interfaces +from zope.contentprovider.tales import addTALNamespaceData +from zope.interface import implements +from zope.tales.expressions import StringExpr + +class Z2ProviderExpression(StringExpr): +Create a custom provider expression which overrides __call__ to + acquisition wrap the provider so that security lookups can be done. + +implements(cp_interfaces.ITALESProviderExpression) + +def __call__(self, econtext): +name = super(Z2ProviderExpression, self).__call__(econtext) +context = econtext.vars['context'] +request = econtext.vars['request'] +view = econtext.vars['view'] + +# Try to look up the provider. +provider = zope.component.queryMultiAdapter( +(context, request, view), cp_interfaces.IContentProvider, name) + +# Provide a useful error message, if the provider was not found. +if provider is None: +raise cp_interfaces.ContentProviderLookupError(name) + +if getattr(provider, '__of__', None) is not None: +provider = provider.__of__(context) + +# Insert the data gotten from the context +addTALNamespaceData(provider, econtext) + +# Stage 1: Do the state update. +provider.update() + +# Stage 2: Render the HTML content. +return provider.render() Modified: Products.Five/trunk/browser/tests/provider.txt === ---
[Zope-Checkins] SVN: Zope/trunk/lib/python/ZPublisher/HTTPRequest.py Spaceified some tabs.
Log message for revision 68751: Spaceified some tabs. Changed: U Zope/trunk/lib/python/ZPublisher/HTTPRequest.py -=- Modified: Zope/trunk/lib/python/ZPublisher/HTTPRequest.py === --- Zope/trunk/lib/python/ZPublisher/HTTPRequest.py 2006-06-19 14:35:22 UTC (rev 68750) +++ Zope/trunk/lib/python/ZPublisher/HTTPRequest.py 2006-06-19 14:51:45 UTC (rev 68751) @@ -1498,11 +1498,11 @@ else: # Broken Cookie without = nor value. - broken_p = paramlessre.match(text) - if broken_p: - l = len(broken_p.group(1)) - name = broken_p.group(2) - value = '' +broken_p = paramlessre.match(text) +if broken_p: +l = len(broken_p.group(1)) +name = broken_p.group(2) +value = '' else: return result ___ 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/ Use updated ZODB 3.4 (http://www.zope.org/Collectors/Zope/2016).
Log message for revision 68679: Use updated ZODB 3.4 (http://www.zope.org/Collectors/Zope/2016). Changed: _U Zope/branches/Zope-2_8-branch/lib/python/ -=- Property changes on: Zope/branches/Zope-2_8-branch/lib/python ___ Name: svn:externals - zope svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3 BTrees svn://svn.zope.org/repos/main/ZODB/tags/3.4.3/src/BTrees Persistencesvn://svn.zope.org/repos/main/ZODB/tags/3.4.3/src/Persistence persistent svn://svn.zope.org/repos/main/ZODB/tags/3.4.3/src/persistent ThreadedAsync svn://svn.zope.org/repos/main/ZODB/tags/3.4.3/src/ThreadedAsync transactionsvn://svn.zope.org/repos/main/ZODB/tags/3.4.3/src/transaction ZEOsvn://svn.zope.org/repos/main/ZODB/tags/3.4.3/src/ZEO ZODB svn://svn.zope.org/repos/main/ZODB/tags/3.4.3/src/ZODB ZopeUndo svn://svn.zope.org/repos/main/ZODB/tags/3.4.3/src/ZopeUndo zdaemonsvn://svn.zope.org/repos/main/zdaemon/tags/zdaemon-1.1 + zope svn://svn.zope.org/repos/main/Zope3/tags/ZopeX3-3.0.1-Zope-2.8/src/zope ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3 BTrees -r 68674 svn://svn.zope.org/repos/main/ZODB/branches/3.4/src/BTrees Persistence-r 68674 svn://svn.zope.org/repos/main/ZODB/branches/3.4/src/Persistence persistent -r 68674 svn://svn.zope.org/repos/main/ZODB/branches/3.4/src/persistent ThreadedAsync -r 68674 svn://svn.zope.org/repos/main/ZODB/branches/3.4/src/ThreadedAsync transaction-r 68674 svn://svn.zope.org/repos/main/ZODB/branches/3.4/src/transaction ZEO-r 68674 svn://svn.zope.org/repos/main/ZODB/branches/3.4/src/ZEO ZODB -r 68674 svn://svn.zope.org/repos/main/ZODB/branches/3.4/src/ZODB ZopeUndo -r 68674 svn://svn.zope.org/repos/main/ZODB/branches/3.4/src/ZopeUndo zdaemonsvn://svn.zope.org/repos/main/zdaemon/tags/zdaemon-1.1 ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/ * Added tests to make sure that views are not blocked by acquired attributes.
Log message for revision 68752: * Added tests to make sure that views are not blocked by acquired attributes. * Changed the tests to reflect that defaultView no only works for views (and not on attributes). Changed: U Products.Five/trunk/CHANGES.txt U Products.Five/trunk/browser/tests/test_defaultview.py U Products.Five/trunk/browser/tests/test_traversable.py U Products.Five/trunk/traversable.py -=- Modified: Products.Five/trunk/CHANGES.txt === --- Products.Five/trunk/CHANGES.txt 2006-06-19 14:51:45 UTC (rev 68751) +++ Products.Five/trunk/CHANGES.txt 2006-06-19 15:02:21 UTC (rev 68752) @@ -17,7 +17,12 @@ * Added Five.browser.pagetemplatefile.ViewPageTemplateFile as an alias to ZopeTwoPageTemplateFile and as a Zope 2 correspondence to zope.app.pagetemplate.ViewPageTemplateFile. + +* Added tests to make sure that views are not blocked by acquired attributes. +* Changed the tests to reflect that defaultView no only works for views + (and not on attributes). + Five 1.5c (2006-05-29) == Modified: Products.Five/trunk/browser/tests/test_defaultview.py === --- Products.Five/trunk/browser/tests/test_defaultview.py 2006-06-19 14:51:45 UTC (rev 68751) +++ Products.Five/trunk/browser/tests/test_defaultview.py 2006-06-19 15:02:21 UTC (rev 68752) @@ -88,15 +88,14 @@ ... The mouse has been eaten by the eagle -This tests whether an existing ``index_html`` method is still -supported and called: - +In Five 1.5 ``index_html`` you can no longer set default views to anything +else than views: + print http(r''' ... GET /test_folder_1_/testindex HTTP/1.1 ... ''') - HTTP/1.1 200 OK + HTTP/1.1 404 Not Found ... - Default index_html called Disabled __call__ overriding for now. Causes more trouble than it fixes. Thus, no test here: Modified: Products.Five/trunk/browser/tests/test_traversable.py === --- Products.Five/trunk/browser/tests/test_traversable.py 2006-06-19 14:51:45 UTC (rev 68751) +++ Products.Five/trunk/browser/tests/test_traversable.py 2006-06-19 15:02:21 UTC (rev 68752) @@ -206,6 +206,13 @@ ... attribute=eagle ... permission=zope2.Public ... / + ... browser:page + ... name=mouse + ... for=OFS.interfaces.IObjectManager + ... class=Products.Five.browser.tests.pages.SimpleView + ... attribute=mouse + ... permission=zope2.Public + ... / ... /configure''' import Products.Five from Products.Five import zcml @@ -262,6 +269,17 @@ ... The eagle has landed +However, acquired attributes *should* be shadowed. See discussion on +http://codespeak.net/pipermail/z3-five/2006q2/001474.html + + manage_addIndexSimpleContent(self.folder, 'mouse', 'Mouse') + print http(r''' + ... GET /test_folder_1_/ftf/mouse HTTP/1.1 + ... ''') + HTTP/1.1 200 OK + ... + The mouse has been eaten by the eagle + Clean up: from zope.app.testing.placelesssetup import tearDown Modified: Products.Five/trunk/traversable.py === --- Products.Five/trunk/traversable.py 2006-06-19 14:51:45 UTC (rev 68751) +++ Products.Five/trunk/traversable.py 2006-06-19 15:02:21 UTC (rev 68752) @@ -22,8 +22,8 @@ __bobo_traverse__ and ITraverser/ITraversable for controlling URL traversal have become obsolete. Use an IPublishTraverse adapter instead. This reference will go away in Zope 2.12., -Traversable = Products.Five.bbb.Traversable, -FiveTraversable = zope.traversing.adapters.DefaultTraversable, +Traversable = Products.Five.bbb:Traversable, +FiveTraversable = zope.traversing.adapters:DefaultTraversable, ) zope.deferredimport.deprecated( Use zope.publisher.browser.TestRequest instead., ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/ - View and attribute lookup order was changed to the following:
Log message for revision 68753: - View and attribute lookup order was changed to the following: 1. Unacquired attributes 2. Views 3. Acquired attributes According to consensus in z3-five mailing list: http://codespeak.net/pipermail/z3-five/2006q2/001474.html - The defaultView directive now only looks up views, not attributes. Changed: U Zope/trunk/doc/CHANGES.txt U Zope/trunk/lib/python/OFS/Traversable.py U Zope/trunk/lib/python/OFS/tests/testTraverse.py U Zope/trunk/lib/python/ZPublisher/BaseRequest.py U Zope/trunk/lib/python/ZPublisher/tests/testBaseRequest.py -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt 2006-06-19 15:02:21 UTC (rev 68752) +++ Zope/trunk/doc/CHANGES.txt 2006-06-19 15:03:17 UTC (rev 68753) @@ -33,4 +33,12 @@ - Collector #2063: cleaned up some mess in MailHost.sendTemplate() - + - View and attribute lookup order was changed to the following: + 1. Unacquired attributes + 2. Views + 3. Acquired attributes +According to consensus in z3-five mailing list: +http://codespeak.net/pipermail/z3-five/2006q2/001474.html + + - The defaultView directive now only looks up views, not attributes. + \ No newline at end of file Modified: Zope/trunk/lib/python/OFS/Traversable.py === --- Zope/trunk/lib/python/OFS/Traversable.py2006-06-19 15:02:21 UTC (rev 68752) +++ Zope/trunk/lib/python/OFS/Traversable.py2006-06-19 15:03:17 UTC (rev 68753) @@ -190,76 +190,93 @@ continue bobo_traverse = _getattr(obj, '__bobo_traverse__', _none) -if name and name[:1] in '@+': -# Process URI segment parameters. -ns, nm = nsParse(name) -if ns: -try: -next = namespaceLookup(ns, nm, obj, - self.REQUEST).__of__(obj) -if restricted and not securityManager.validate( -obj, obj, name, next): +try: +if name and name[:1] in '@+': +# Process URI segment parameters. +ns, nm = nsParse(name) +if ns: +try: +next = namespaceLookup(ns, nm, obj, + self.REQUEST).__of__(obj) +if restricted and not securityManager.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: +if aq_base(next) is not next: +# The object is wrapped, so the acquisition +# context is the container. +container = aq_parent(aq_inner(next)) +elif _getattr(next, 'im_self', _none) is not _none: +# Bound method, the bound instance +# is the container +container = next.im_self +elif _getattr(aq_base(obj), name, marker) == next: +# Unwrapped direct attribute of the object so +# object is the container +container = obj +else: +# Can't determine container +container = _none +try: +validated = securityManager.validate( + obj, container, name, next) +except Unauthorized: +# If next is a simple unwrapped property, it's +# parentage is indeterminate, but it may have been +# acquired safely. In this case validate will +# raise an error, and we can explicitly check that +# our value was acquired safely. +validated = 0 +if container is _none and \ + guarded_getattr(obj, name, marker) is next: +
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/ Backport provider expression fix (-r68672) from trunk.
Log message for revision 68757: Backport provider expression fix (-r68672) from trunk. Changed: _U Zope/branches/2.10/lib/python/Products/ U Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py -=- Property changes on: Zope/branches/2.10/lib/python/Products ___ Name: svn:externals - Five-r 68410 svn://svn.zope.org/repos/main/Products.Five/trunk + Five-r 68672 svn://svn.zope.org/repos/main/Products.Five/trunk Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py === --- Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py 2006-06-19 15:44:03 UTC (rev 68756) +++ Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py 2006-06-19 17:09:48 UTC (rev 68757) @@ -24,13 +24,13 @@ from zope.tales.pythonexpr import PythonExpr from zope.traversing.interfaces import ITraversable from zope.traversing.adapters import traversePathElement -from zope.contentprovider.tales import TALESProviderExpression from zope.proxy import removeAllProxies import zope.app.pagetemplate.engine import OFS.interfaces from Acquisition import aq_base from zExceptions import NotFound, Unauthorized +from Products.Five.browser.providerexpression import Z2ProviderExpression from Products.PageTemplates import ZRPythonExpr from Products.PageTemplates.DeferExpr import LazyExpr from Products.PageTemplates.GlobalTranslationService import getGlobalTranslationService @@ -257,7 +257,7 @@ e.registerType('not', NotExpr) e.registerType('defer', DeferExpr) e.registerType('lazy', LazyExpr) -e.registerType('provider', TALESProviderExpression) +e.registerType('provider', Z2ProviderExpression) e.registerBaseName('modules', SecureModuleImporter) return e ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/regebro-traversalfix/lib/python/ZPublisher/HTTPRequest.py Removed some tabs.
Log message for revision 68649: Removed some tabs. Changed: U Zope/branches/regebro-traversalfix/lib/python/ZPublisher/HTTPRequest.py -=- Modified: Zope/branches/regebro-traversalfix/lib/python/ZPublisher/HTTPRequest.py === --- Zope/branches/regebro-traversalfix/lib/python/ZPublisher/HTTPRequest.py 2006-06-15 11:22:56 UTC (rev 68648) +++ Zope/branches/regebro-traversalfix/lib/python/ZPublisher/HTTPRequest.py 2006-06-15 11:25:08 UTC (rev 68649) @@ -1498,11 +1498,11 @@ else: # Broken Cookie without = nor value. - broken_p = paramlessre.match(text) - if broken_p: - l = len(broken_p.group(1)) - name = broken_p.group(2) - value = '' +broken_p = paramlessre.match(text) +if broken_p: +l = len(broken_p.group(1)) +name = broken_p.group(2) +value = '' else: return result ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt Use updated ZODB 3.4 (http://www.zope.org/Collectors/Zope/2016).
Log message for revision 68680: Use updated ZODB 3.4 (http://www.zope.org/Collectors/Zope/2016). Changed: U Zope/branches/Zope-2_8-branch/doc/CHANGES.txt -=- Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt === --- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2006-06-16 02:06:27 UTC (rev 68679) +++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2006-06-16 02:07:30 UTC (rev 68680) @@ -18,6 +18,9 @@ Bugs fixed + - Collector #2016: DemoStorage couldn't wrap base storages without + an '_oid' attribute. + - Collector #2116: sequence.sort() did not work properly locale related comparison methods ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/ Merge from regebro-traversalfix branch:
Log message for revision 68776: Merge from regebro-traversalfix branch: - View and attribute lookup order was changed to the following: 1. Unacquired attributes 2. Views 3. Acquired attributes According to consensus in z3-five mailing list: http://codespeak.net/pipermail/z3-five/2006q2/001474.html - The defaultView directive now only looks up views, not attributes. Changed: U Zope/branches/2.10/doc/CHANGES.txt U Zope/branches/2.10/lib/python/OFS/Traversable.py U Zope/branches/2.10/lib/python/OFS/tests/testTraverse.py _U Zope/branches/2.10/lib/python/Products/ U Zope/branches/2.10/lib/python/ZPublisher/BaseRequest.py U Zope/branches/2.10/lib/python/ZPublisher/HTTPRequest.py U Zope/branches/2.10/lib/python/ZPublisher/tests/testBaseRequest.py -=- Modified: Zope/branches/2.10/doc/CHANGES.txt === --- Zope/branches/2.10/doc/CHANGES.txt 2006-06-20 15:58:06 UTC (rev 68775) +++ Zope/branches/2.10/doc/CHANGES.txt 2006-06-21 11:26:57 UTC (rev 68776) @@ -38,6 +38,15 @@ - Collector #2063: cleaned up some mess in MailHost.sendTemplate() + - View and attribute lookup order was changed to the following: + 1. Unacquired attributes + 2. Views + 3. Acquired attributes +According to consensus in z3-five mailing list: +http://codespeak.net/pipermail/z3-five/2006q2/001474.html + + - The defaultView directive now only looks up views, not attributes. + Zope 2.10.0 beta 1 (2006/05/30) Restructuring Modified: Zope/branches/2.10/lib/python/OFS/Traversable.py === --- Zope/branches/2.10/lib/python/OFS/Traversable.py2006-06-20 15:58:06 UTC (rev 68775) +++ Zope/branches/2.10/lib/python/OFS/Traversable.py2006-06-21 11:26:57 UTC (rev 68776) @@ -190,76 +190,93 @@ continue bobo_traverse = _getattr(obj, '__bobo_traverse__', _none) -if name and name[:1] in '@+': -# Process URI segment parameters. -ns, nm = nsParse(name) -if ns: -try: -next = namespaceLookup(ns, nm, obj, - self.REQUEST).__of__(obj) -if restricted and not securityManager.validate( -obj, obj, name, next): +try: +if name and name[:1] in '@+': +# Process URI segment parameters. +ns, nm = nsParse(name) +if ns: +try: +next = namespaceLookup(ns, nm, obj, + self.REQUEST).__of__(obj) +if restricted and not securityManager.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: +if aq_base(next) is not next: +# The object is wrapped, so the acquisition +# context is the container. +container = aq_parent(aq_inner(next)) +elif _getattr(next, 'im_self', _none) is not _none: +# Bound method, the bound instance +# is the container +container = next.im_self +elif _getattr(aq_base(obj), name, marker) == next: +# Unwrapped direct attribute of the object so +# object is the container +container = obj +else: +# Can't determine container +container = _none +try: +validated = securityManager.validate( + obj, container, name, next) +except Unauthorized: +# If next is a simple unwrapped property, it's +# parentage is indeterminate, but it may have been +# acquired safely. In this case validate will +# raise an error, and we can explicitly check that +# our value was acquired safely. +
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Collector #2136: Map ResourceLockedError to the correct response code.
Log message for revision 68778: Collector #2136: Map ResourceLockedError to the correct response code. Changed: U Zope/branches/Zope-2_8-branch/doc/CHANGES.txt U Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py U Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py -=- Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt === --- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2006-06-21 16:10:05 UTC (rev 68777) +++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2006-06-21 16:47:12 UTC (rev 68778) @@ -18,6 +18,8 @@ Bugs fixed + - Collector #2136: Map ResourceLockedError to the correct response code. + - Collector #2016: DemoStorage couldn't wrap base storages without an '_oid' attribute. Modified: Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py === --- Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py 2006-06-21 16:10:05 UTC (rev 68777) +++ Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/HTTPResponse.py 2006-06-21 16:47:12 UTC (rev 68778) @@ -97,6 +97,7 @@ status_codes['nameerror'] = 503 status_codes['keyerror'] = 503 status_codes['redirect'] = 300 +status_codes['resourcelockederror'] = 423 start_of_header_search = re.compile('(head[^]*)', re.IGNORECASE).search Modified: Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py === --- Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py 2006-06-21 16:10:05 UTC (rev 68777) +++ Zope/branches/Zope-2_8-branch/lib/python/ZPublisher/tests/testHTTPResponse.py 2006-06-21 16:47:12 UTC (rev 68778) @@ -74,7 +74,13 @@ response.appendHeader('XXX', 'foo') self.assertEqual(response.headers.get('xxx'), 'bar,\n\tfoo') +def test_setStatus_ResourceLockedError(self): +response = self._makeOne() +from webdav.Lockable import ResourceLockedError +response.setStatus(ResourceLockedError) +self.assertEqual(response.status, 423) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test')) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/ Collector #2136: Map ResourceLockedError to the correct response code.
Log message for revision 68779: Collector #2136: Map ResourceLockedError to the correct response code. Changed: U Zope/branches/2.9/doc/CHANGES.txt U Zope/branches/2.9/lib/python/ZPublisher/HTTPResponse.py U Zope/branches/2.9/lib/python/ZPublisher/tests/testHTTPResponse.py -=- Modified: Zope/branches/2.9/doc/CHANGES.txt === --- Zope/branches/2.9/doc/CHANGES.txt 2006-06-21 16:47:12 UTC (rev 68778) +++ Zope/branches/2.9/doc/CHANGES.txt 2006-06-21 16:48:26 UTC (rev 68779) @@ -18,6 +18,8 @@ Bugs fixed + - Collector #2136: Map ResourceLockedError to the correct response code. + - Collector #2109: XML-RPC did not handle DateTime.DateTime objects. - Collector #2016: DemoStorage couldn't wrap base storages without Modified: Zope/branches/2.9/lib/python/ZPublisher/HTTPResponse.py === --- Zope/branches/2.9/lib/python/ZPublisher/HTTPResponse.py 2006-06-21 16:47:12 UTC (rev 68778) +++ Zope/branches/2.9/lib/python/ZPublisher/HTTPResponse.py 2006-06-21 16:48:26 UTC (rev 68779) @@ -97,6 +97,7 @@ status_codes['nameerror'] = 503 status_codes['keyerror'] = 503 status_codes['redirect'] = 300 +status_codes['resourcelockederror'] = 423 start_of_header_search = re.compile('(head[^]*)', re.IGNORECASE).search Modified: Zope/branches/2.9/lib/python/ZPublisher/tests/testHTTPResponse.py === --- Zope/branches/2.9/lib/python/ZPublisher/tests/testHTTPResponse.py 2006-06-21 16:47:12 UTC (rev 68778) +++ Zope/branches/2.9/lib/python/ZPublisher/tests/testHTTPResponse.py 2006-06-21 16:48:26 UTC (rev 68779) @@ -51,7 +51,8 @@ # Verify that the cookie is expired even if an expires kw arg is passed # http://zope.org/Collectors/Zope/1160 response = self._makeOne() -response.expireCookie('foo', path='/', expires='Mon, 22-Mar-2004 17:59 GMT', max_age=99) +response.expireCookie('foo', path='/', + expires='Mon, 22-Mar-2004 17:59 GMT', max_age=99) cookie = response.cookies.get('foo', None) self.failUnless(cookie) self.assertEqual(cookie.get('expires'), 'Wed, 31-Dec-97 23:59:59 GMT') @@ -76,27 +77,43 @@ response.appendHeader('XXX', 'foo') self.assertEqual(response.headers.get('xxx'), 'bar,\n\tfoo') -def test_CharsetNoHeader(self): +def test_setStatus_ResourceLockedError(self): +response = self._makeOne() +from webdav.Lockable import ResourceLockedError +response.setStatus(ResourceLockedError) +self.assertEqual(response.status, 423) + +def test_charset_no_header(self): response = self._makeOne(body='foo') -self.assertEqual(response.headers.get('content-type'), 'text/plain; charset=iso-8859-15') +self.assertEqual(response.headers.get('content-type'), + 'text/plain; charset=iso-8859-15') -def test_CharsetTextHeader(self): -response = self._makeOne(body='foo', headers={'content-type': 'text/plain'}) -self.assertEqual(response.headers.get('content-type'), 'text/plain; charset=iso-8859-15') +def test_charset_text_header(self): +response = self._makeOne(body='foo', +headers={'content-type': 'text/plain'}) +self.assertEqual(response.headers.get('content-type'), + 'text/plain; charset=iso-8859-15') -def test_CharsetApplicationHeader(self): -response = self._makeOne(body='foo', headers={'content-type': 'application/foo'}) -self.assertEqual(response.headers.get('content-type'), 'application/foo; charset=iso-8859-15') +def test_charset_application_header(self): +response = self._makeOne(body='foo', +headers={'content-type': 'application/foo'}) +self.assertEqual(response.headers.get('content-type'), + 'application/foo; charset=iso-8859-15') -def test_CharsetApplicationHeaderUnicode(self): -response = self._makeOne(body=unicode('ärger', 'iso-8859-15'), headers={'content-type': 'application/foo'}) -self.assertEqual(response.headers.get('content-type'), 'application/foo; charset=iso-8859-15') +def test_charset_application_header_unicode(self): +response = self._makeOne(body=unicode('ärger', 'iso-8859-15'), +headers={'content-type': 'application/foo'}) +self.assertEqual(response.headers.get('content-type'), + 'application/foo; charset=iso-8859-15') self.assertEqual(response.body, 'ärger') -def test_CharsetApplicationHeader1Unicode(self): -response = self._makeOne(body=unicode('ärger', 'iso-8859-15'), headers={'content-type': 'application/foo; charset=utf-8'}) -