[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'}) -
[Zope-dev] Re: Nasty error message with obscure bug
Chris Withers wrote: Jens Vagelpohl wrote: Use the collector. It is *the* place where people go to look for things to fix. What length of time it takes to fix is a totally separate issue. Bugs that get posted on mailing lists get ignored unless they are the world is coming to an end type bugs. Read the thread, I'm not even convinced this _is_ a bug ;-) If, after reading the thread, you feel it is a bug, by all means open a collector entry... Collector entries can always be rejected if it turns out there is no bug. This mailinglist thread will be forgotten next week, though. So, pretty please open a collector issue. Furthermore, I suggest you wrap this bug into a nice reproducible unit test demonstrating the behaviour you would *like* to see. Then this discussion can be much more fruitful. Philipp ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: default view
Martijn Faassen wrote: Philipp von Weitershausen wrote: Florent Guillaume wrote: Florent Guillaume wrote: So here's a proposal: how about having the following order: - __bobo_traverse__ - unacquired attribute - zope 3 views - acquired attributes Attached is the current diff I'm working with (for Zope 2.10). Hey, cool. You know, the real challenge is backporting this all the way to Five 1.2 to ensure compatibility between the current stable Zope 2 releases. We've actually noticed Five 1.2.4 is not compatible with Five 1.2 in some way to do with mysterious 'index.html' bits appearing after URLs where we thought they shouldn't. We haven't tracked this down and we might not for a while (we just switched back to Five 1.2..), just wanted to let you know Five 1.2 has some compatibility issues.. I wasn't aware of this issue. Please file a collector entry so it won't get lost :). Note that it'd be great if you can find out which particular version of Five 1.2.x introduced the problem. And as always, a unit test that demonstrates the problem reproducibly would be superb. Philipp ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Nasty error message with obscure bug
Philipp von Weitershausen wrote: Collector entries can always be rejected if it turns out there is no bug. This mailinglist thread will be forgotten next week, though. So, pretty please open a collector issue. Fine: http://www.zope.org/Collectors/Zope/2135 Furthermore, I suggest you wrap this bug into a nice reproducible unit test demonstrating the behaviour you would *like* to see. Then this discussion can be much more fruitful. Both are in the issue and were in the original mailing list post. Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Flood of deprecation warnings...
Florent Guillaume wrote: Chris Withers wrote: Both core zope and Plone spew forth in their default state. Zope 2.10 does? It shouldn't. Please point out the deprecation warnings it sends. I, like many people I suspect, am still struggling to get projects onto 2.8/2.9. The thought that they're both going to be obsolete already fills me with dread :-( Also could we please bury the zLOG-was-only-halfwy-deprecated issue that's been beaten to death? Maybe once 2.9.4 is out and doesn't spew deprecation warnings? ;-) cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: Unify the Zope 2 and Zope 3 repositories!
Chris Withers wrote: Philipp von Weitershausen wrote: Follow this thread: http://mail.zope.org/pipermail/zope3-dev/2005-November/016561.html *grunt* *sigh* It has to happen at some stage, surely? Jim suggested a different strategy with Zope 5 (http://mail.zope.org/pipermail/zope3-dev/2006-February/018415.html). The little bits and pieces that make up Zope 3 (the zope.* packages) would be developed more or less independently of Zope-the-app-server (which would only be one product called Zope 5 and incorporate ideas from Zope 2 and 3 and use those bits and pieces). Philipp ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: Stable / Development branches?
Chris Withers wrote: Andreas Jung wrote: I for one, is NOT interested in backporting fixed in Five trunk to both Five 1.0, 1.1, 1.3, 1.4 and 1.5, which is what are the current versions of Five if we say that Zope 2.8 and 2.7 should be still supported after the release of 2.10. We don't talk about Zope 2.7 which is dead. ...except for all the people still using it ;-) It's dead from a maintenance point of view. If you still want to maintain it, be our guest. But you yourself said that maintaining too many branches is madness. There's nothing wrong with software being in production whose particular line isn't maintained anymore. I have Linux kernels 2.4 and Apaches 1.3 in production. What's your point? Philipp ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope3-dev] Re: Stable / Development branches?
On 6/21/06, Philipp von Weitershausen [EMAIL PROTECTED] wrote: There's nothing wrong with software being in production whose particular line isn't maintained anymore. I have Linux kernels 2.4 and Apaches 1.3 in production. What's your point? I checked what all my websites run. They are all on Zope 2.5. No problemas. :) -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: Time-based releases a good idea?
Philipp von Weitershausen wrote at 2006-6-18 12:38 +0200: ... deprecation policy ... This policy allows us to move forward (which Zope 2 never really did for the the majority of those five years you mention). Although, it might help in a few cases, it is not at all necessary to cast ones history away when moving forward. I do not agree with you that Zope2 did not move forward in the past 5 years. I agree that currently it moves faster -- but not because you cast out things but because you move lots of new functionality in. -- Dieter ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: default view
Florent Guillaume wrote at 2006-6-18 02:05 +0200: ... if hasattr(object,'__bobo_traverse__'): subobject=object.__bobo_traverse__(request, name) If you are working on it, then you should implement a means that __bobo_traverse__ can tell the caller that it should use the normal default. This feature makes lots of __bobo_traverse__ implementations much saner. A prominent example is the Archetypes' one. In our private Zope version, I have used an exception (UseTraversalDefault) for this purpose. -- Dieter ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope] Transaction rollback
Luiz Fernando B. Ribeiro schrieb: I need to return an error page with instructions after verifying a request but I need to do a rollback. How can I call a full rollback, like when using raise(), inside a python script and redirect to an error page. I found many posts about get_transaction().rollback() but it is deprecated in Zope 2.9. What is the modern way of doing this? I'd use a custom error_page and just raise the exception. Regards Tino ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How to commit a piece of data in a transaction when the transaction is being aborted later
William Heymann schrieb: On Tuesday 20 June 2006 12:47, Chris McDonough wrote: I'd just record the data from Verisign in response to their POST (do nothing else) and come along later with a separate request to pick through the data to do postprocessing on it every so often; then the data always gets recorded and you can deal with errors in your postprocessing without needing to manage transaction state manually. ClockServer can help with the do something every so often aspect of this. That is probably a good idea for long term to change things that way and I would like to rewrite it. However right now I don't really want to rewrite the way the current system works. I had hoped I could just use get_transaction().commit() almost immediately after seeing the data from Verisign. The problem is, there is no garanty about success of that transaction either. So if it rolls back, what do you do with verysign? Maybe a fifo logfile could solve your problem. Regards Tino ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Display Image Object in DTML
jose carlos schrieb: Hi all, i'm trying to show a Image object in dtml but i don known how to do it. i have a user object and this user have a jpg foto atributte. this foto atributte is a instance of OFS.Image and when i try to view in dtml only view Ascii character.. i think about to create a temporary file and then in dtml use that url but i dont like that solution. i would like hear any ideas.. img src=/path/to/userobject/imageattribute witdh=... height=... alt=the user / maybe? If you cant access the userobject by path, a small wrapper (python script) should do it: if traverse_subpath: return context.acl_users.getUser(traverse_subpath[0]).imageattribute.data then you can have above link in your HTML image tag like /path/to/the/pythonscript/userid which would return, when called by the subsequent browser request, just the image data. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Display Image Object in DTML
Andreas Jung schrieb: --On 21. Juni 2006 10:00:12 +0200 jose carlos [EMAIL PROTECTED] wrote: Hi all, i'm trying to show a Image object in dtml but i don known how to do it. i have a user object and this user have a jpg foto atributte. this foto atributte is a instance of OFS.Image and when i try to view in dtml only view Ascii character.. i think about to create a temporary file and then in dtml use that url but i dont like that solution. Do you have the real need for using DTML? I assume you are new to Zope and you should really remove DTML from your memory and replace it with ZPT in this case. This is definitely the way to go for a newbie. This isnt even a job for ZPT or any other template language at all ;) Regards Tino ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How to commit a piece of data in a transaction when the transaction is being aborted later
William Heymann schrieb: On Wednesday 21 June 2006 01:17, Tino Wildenhain wrote: William Heymann schrieb: That is probably a good idea for long term to change things that way and I would like to rewrite it. However right now I don't really want to rewrite the way the current system works. I had hoped I could just use get_transaction().commit() almost immediately after seeing the data from Verisign. The problem is, there is no garanty about success of that transaction either. So if it rolls back, what do you do with verysign? Maybe a fifo logfile could solve your problem. Actually that is not a problem. If just trying to write the data causes a failure then verisign won't ok the transaction which is the point. However what I want to happen is for the system to try and make sure as much as possible that the data that verisign sends gets written and committed before it tries to do other stuff. If that simple step should fail then there is a very seroius problem occurring and the system should not be okaying any orders. I dont understand what you mean here. Usually the zope transaction spans the whole process (request) so if you have some tasks after your verisign remote request, they will all be covered in the transaction - so if any of them fail, verisign will get that failure message too and no false orders will be taken. The thing with Verisign is called a silent post confirmation. Before verisign will okay a customer transaction it sends a post to my server with various details and my code will look over that and decide if it is all ok. A response code of 200 means ok, anything else means failure. Thus any uncaught error in zope will cause the transaction to fail which is the point. Which transaction? The Verisign control post? That failing would be correct because something indeed went wrong! I just want to try and record the data that verisign sent and commit it before I try the rest so that what if something later should cause it to fail I still have a record of the commands send. Right now I am essentially writing the data to an OOBTree object. Well, but your essential steps indeed failed so why would you commit? How do you recover half done transactions? Regards Tino Wildenhain ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] questions on multilingual sites
John, please keep posts on the list... John Schinnerer wrote: If I'm going to add in internationalization at some point, and do it using zope 3 stuff via five - what is the minimum, and what is the optimum, zope 2.x version to upgrade to? Minimum, I guess 2.8. Optimum? 2.11? ;-) I'm trying with 2.9, so I guess we'll see... I need to upgrade anyhow to support newer plone so I'd like to have it all work together... Don't mention the p word, you'll set me off, and I'm trying ever so hard not to be rude about it ;-) cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Problem with constructTransientObjectContainer - Resolved
Jonathan wrote: folder = self.restrictedTraverse('Coz/TempImages') constructTransientObjectContainer(folder, 'GarbageCollector', timeout_mins=10, limit=0, delNotification=BASEFOLDER+'DeleteTempImage') Be careful, I see a lot of hints in there that make me nervous. I'm of the opinion that if you think you need to use a TOC, you're probably doing something wrong... Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Display Image Object in DTML
thanks doing a small python script and calling to url script like you tell me, show the image perfectly. thanks On Wed, 2006-06-21 at 10:31 +0200, Tino Wildenhain wrote: jose carlos schrieb: Hi all, i'm trying to show a Image object in dtml but i don known how to do it. i have a user object and this user have a jpg foto atributte. this foto atributte is a instance of OFS.Image and when i try to view in dtml only view Ascii character.. i think about to create a temporary file and then in dtml use that url but i dont like that solution. i would like hear any ideas.. img src=/path/to/userobject/imageattribute witdh=... height=... alt=the user / maybe? If you cant access the userobject by path, a small wrapper (python script) should do it: if traverse_subpath: return context.acl_users.getUser(traverse_subpath[0]).imageattribute.data then you can have above link in your HTML image tag like /path/to/the/pythonscript/userid which would return, when called by the subsequent browser request, just the image data. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Problem with constructTransientObjectContainer - Resolved
- Original Message - From: Chris Withers [EMAIL PROTECTED] To: Jonathan [EMAIL PROTECTED] Cc: Chris McDonough [EMAIL PROTECTED]; zope@zope.org Sent: Wednesday, June 21, 2006 6:25 AM Subject: Re: [Zope] Problem with constructTransientObjectContainer - Resolved Jonathan wrote: folder = self.restrictedTraverse('Coz/TempImages') constructTransientObjectContainer(folder, 'GarbageCollector', timeout_mins=10, limit=0, delNotification=BASEFOLDER+'DeleteTempImage') Be careful, I see a lot of hints in there that make me nervous. I'm of the opinion that if you think you need to use a TOC, you're probably doing something wrong... The use case: the zodb contains small image objects which need to have a custom overlay (done with PIL) before being presented to the user. Each overlay is unique. Each customized image is only shown to a single user once, then it is discarded. In order to eliminate many writes to the zodb (disk), I have decided to put the customized images into a temporary folder (RAM). In order to delete the customized images I have created a TOC to act as a 'GarbageCollector'. Whenever a customized image is written to the temporary folder, an entry containing the image object id is placed in the TOC. When the TOC 'times-out' an entry a script (external method) acquires the object id from the TOC entry and deletes the customized image from the temporary folder. This seems to be working... so far ;-) What 'hints' are making you nervous? Is there a 'better' way to do this? Jonathan ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: How to commit a piece of data in a transaction when the transaction is being aborted later
William Heymann wrote: I am dealing with a zope system where Verisign is sending a POST to our server for ecommerece purposes. Currently I am writing the entire contents of the POST from verisign to the ZODB however I have a problem that some of these POSTs are not being recorded because an error occurs later in the transaction. What I would like to do is isolate this recording from everything else. So that no matter what other error is raised that part will commit so I have a record of the conversation later. Currently I can put the logging step as the very first step in the conversation with verisign and call get_transaction().commit() (I am currently using zope 2.7 and working on the migration to zope 2.9) What would be the best way to deal with this problem? Should I just do a commit of the transaction as the very first step so that part is written and then zope will start a new transaction for the rest of the stuff done? Should I somehow tell zope to run a certain function as its own transaction? Also when I switch over to zope 2.9 how will these things need to be changed? The transaction.commit() others suggested is what I would do too. But be aware that if the second part of your transaction provokes a ConflictError (which may happen in the normal course of events), your whole request will be retried, including reinterpreting the POSTed data (which the request always saves anyway) and writing to your OOBTree etc. Florent -- Florent Guillaume, Nuxeo (Paris, France) Director of RD +33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Refreshing zope2 product
In case you've missed this, I've written a little quick article about how I refresh my zope products when developing product code. http://www.fry-it.com/at/refresh-my-zope-products I know that this might be a personal preference but consider how many people who still use zope-restart to test changes I think this is worth a shot. -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Is it possible to render a TAL expression from a Page Template?
Suppose I have a variable foo that has value request/name|nothing. Is it possible from a Python Script to have this evaluated as a TAL expression? Alternatives? Thanks jim ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Is it possible to render a TAL expression from a Page Template?
En/na [EMAIL PROTECTED] ha escrit: Suppose I have a variable foo that has value request/name|nothing. Is it possible from a Python Script to have this evaluated as a TAL expression? AFAIK TALES machinery ($ZOPE_HOME/lib/python/Products/PageTemplates) can't be accessed from restricted code. Maybe ZTUtils, PythonScript.standard or other module expose it in some way, I don't know. Alternatives? * External method: from Products.PageTemplates.Expressions import getEngine def evalTAL(talstr, **kw) : engine = getEngine() comp = engine.compile(talstr) return engine.getContext(**kw).evaluate(comp) then, from a PythonScript do: result = context.evalTAL(request/name|nothing, here=context, request=REQUEST) * Create a PageTemplate named evalTAL with a body like: foo tal:replace=python:path(options['param'])/foo then, from a PythonScript do: result = context.evalTAL(param=request/name|nothing) result will always be an string. Not a serious alternative, just a creative way. HTH ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Is it possible to render a TAL expression from a Page Template?
Thanks, the external method appears to work fine. I thought about the silly Page Template, but forgot the path: modifier exists! But the EM should be far faster, anyway. Thanks again. jim [EMAIL PROTECTED] wrote on 06/21/2006 04:04:31 PM: En/na [EMAIL PROTECTED] ha escrit: Suppose I have a variable foo that has value request/name|nothing. Is it possible from a Python Script to have this evaluated as a TAL expression? AFAIK TALES machinery ($ZOPE_HOME/lib/python/Products/PageTemplates) can't be accessed from restricted code. Maybe ZTUtils, PythonScript.standard or other module expose it in some way, I don't know. Alternatives? * External method: from Products.PageTemplates.Expressions import getEngine def evalTAL(talstr, **kw) : engine = getEngine() comp = engine.compile(talstr) return engine.getContext(**kw).evaluate(comp) then, from a PythonScript do: result = context.evalTAL(request/name|nothing, here=context, request=REQUEST) * Create a PageTemplate named evalTAL with a body like: foo tal:replace=python:path(options['param'])/foo then, from a PythonScript do: result = context.evalTAL(param=request/name|nothing) result will always be an string. Not a serious alternative, just a creative way. HTH ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] load balancing ftp over ZEO clients
Reinoud van Leeuwen wrote at 2006-6-19 17:54 +0200: ... Has anyone experiences with load balancing ftp over several ZEO clients? If the load balancer works on TCP connection level, then it should work for FTP in the same way as for HTTP (with the exception that connections tend to be open for a much longer time, thereby bindung resources). ... Can I forward both port 20 and 21 to the ftp port of the ZEO? ZEO itself is not FTP capable. You need a ZEO client (e.g. Zope) for this. Is it possible to use passive and active ftp? It depends on what your firewall allows. -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] how improving dtml-in nested?
mbr wrote at 2006-6-20 09:58 -0500: ... dtml-let RS=AnotherZSQLMethod return results to one variable dtml-in ZSQLMethod tr tddtml-field1; /tdtddtml-field2; /td td select dtml-in RS option dtml-if expr=anotherfield1==field3selected/dtml-if value=dtml-anotherfield1;dtml-anotherfield2;/option /dtml-in /select /td /tr /dtml-in /dtml-let i think this is more quick Check data in memory (variable RS) what a ZSQLMethod. But is real. RS is a result of ZSQL or a instance? You idea (and thinking) was very good! -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] DeadlockDebugger revisited
Matthew X. Economou wrote at 2006-6-18 11:53 -0400: I tried the whole gdb threads debugging thing, with the following (nil) results. Any other ideas? A lot of the instructions online seem to be Linux-centric, so I'm at a loss as how to proceed: (gdb) info threads ... 2 Thread 0x9064e00 (runnable) 0x0807b36f in PyType_IsSubtype () 1 Thread 0x9a32200 (runnable) 0x08b53622 in ?? () (gdb) thread 2 [Switching to thread 2 (Thread 0x9064e00 (runnable))]#0 0x0807b36f in PyType_IsSubtype () (gdb) call PyRun_SimpleString(import sys, traceback; sys.stderr=open('/tmp/tb','w',0); traceback.print_stack()) Program received signal SIGSEGV, Segmentation fault. I fear that you can call Python functions in general only on the current thread (the other's probably lack the GIL, an essential requirement to execute Python code). Moreover, it seems that your Python is build without debugging symbols. Debugging symbols are almost a must when you try to analyse problems at this level. I would rebuild Python with debugging symbols (and, if possible, without optimizations). -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] converting Dictionary to Result
Alric Aneron wrote at 2006-6-19 09:35 -0700: ... contents of myscript(): mydict = {'key1': 'value1', 'key2': 'value2'} mydict2 = {'key1': 'value3', 'key2': 'value4'} finalList = [mydict, mydict2] return finalList When I do this in a dtml-method: dtml-in myscript() dtml-var key1 br/ /dtml-in This will not return me this: value1 value2 It gives me a key error. You should tell the dtml-in that it is iterating over a sequence of mapping objects. You do this with its mapping attribute. -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] upgraded zope 2.8.1 to zope 2.9.3
Dear I need upgrade zope 2.8.1 to 2.9.3 ... Could someone help me..? Thanks gustavo ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Issue 1896: manage_changeProperties() vs manage_addProperty()
Hello, in Issue #1896 (http://www.zope.org/Collectors/Zope/1896), I describe a difference in the behaviour of manage_changeProperties() and of manage_addProperty(): An array of ints is converted to an array of strings with manage_addProperty(), but not with manage_changeProperties(). You closed the bug with the following comment: Type converters only deal with the outer type but not with the types of contained elements. This should be handled on the application level. Well, first of all this isn't true as my script shows (note: the report has a buggy test script, correct one attached): When using manage_addProperty(), the contents of the array *are* converted from integers to strings. Or maybe I'm reading you wrong? Furthermore, this still doesn't explain why the two functions behave differently. Digging a bit deeper, I found out that the culprit is in lib/python/OFS/PropertyManager.py: In manage_addProperty() the type_converter is always called, but in _updateProperty() the type_converter is only called if the value is a string. Similar code can be found in lib/python/OFS/PropertySheets.py Maybe there is some reason for this behaviour, but I can't think of one. Either of the following diffs (of course not both!) fixes the problem for me: --- lib/python/OFS/PropertyManager.py.old 2006-06-18 09:56:13.0 +0200 +++ lib/python/OFS/PropertyManager.py 2006-06-18 09:57:01.0 +0200 @@ -202,16 +202,13 @@ self._setPropValue(id, value) def _updateProperty(self, id, value): - # Update the value of an existing property. If value - # is a string, an attempt will be made to convert - # the value to the type of the existing property. + # Update the value of an existing property. self._wrapperCheck(value) if not self.hasProperty(id): raise BadRequest, 'The property %s does not exist' % escape(id) - if type(value)==type(''): - proptype=self.getPropertyType(id) or 'string' - if type_converters.has_key(proptype): - value=type_converters[proptype](value) + proptype=self.getPropertyType(id) or 'string' + if type_converters.has_key(proptype): + value=type_converters[proptype](value) self._setPropValue(id, value) def _delProperty(self, id): --- lib/python/OFS/PropertyManager.py.old 2006-06-18 09:56:13.0 +0200 +++ lib/python/OFS/PropertyManager.py 2006-06-20 12:31:56.0 +0200 @@ -265,14 +265,14 @@ # Web interface -def manage_addProperty(self, id, value, type, REQUEST=None): +def manage_addProperty(self, id, value, proptype, REQUEST=None): Add a new property via the web. Sets a new property with the given id, type, and value. -if type_converters.has_key(type): -value=type_converters[type](value) -self._setProperty(id.strip(), value, type) +if type(value)==type('') and type_converters.has_key(proptype): +value=type_converters[proptype](value) +self._setProperty(id.strip(), value, proptype) if REQUEST is not None: return self.manage_propertiesForm(self, REQUEST) This is the working version of my test script: ## Script (Python) test ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## def is_int(i): try: i + 1 return is int except: return isn't int obj = script try: obj.manage_delProperties(ids=('testproperty',)) except: pass print Add property... obj.manage_addProperty('testproperty', [1,2,3], 'lines') for i in obj.testproperty: print is_int(i) print Change property... obj.manage_changeProperties(testproperty=[1,2,3]) for i in obj.testproperty: print is_int(i) return printed Thank you. PS: I know this doesn't seem important, but it gave me a hard to debug problem once. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: upgraded zope 2.8.1 to zope 2.9.3
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 gus wrote: Dear I need upgrade zope 2.8.1 to 2.9.3 ... Could someone help me..? The drill is something like: 1. Install Zope 2.9.3 in a separate location (e.g., '/opt/zope2.9' instead of '/opt/zope2.8'). 2. Create a new instance using the new Zope (*not* on top of your current instance!), e.g.: $ python /opt/zope2.9/bin/mkzopeinstance.py \ --dir /var/zope/newinstance 3. Copy your products from the old instance to the new instance. 4. Stop your old Zope instance, then copy the Data.fs to the new instance. 5. Start the new instance, and verify that it comes up. Run the unit tests of your products in the new instance, and upgrade / fix as needed. Tres. - -- === Tres Seaver +1 202-558-7113 [EMAIL PROTECTED] Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEmcO1+gerLs4ltQ4RAsFRAJ9ennfuwJz3fCvf0Of7HI5RMnSlxgCg2Qmm gpaWmrahehyez3f+9U0WjGk= =oevx -END PGP SIGNATURE- ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] upgraded zope 2.8.1 to zope 2.9.3
gus, you have to state your problem... i have a gut feeling that someone could. what exactly is the issue? - Original Message - From: gus [EMAIL PROTECTED] To: zope@zope.org Sent: Wednesday, June 21, 2006 6:00 PM Subject: [Zope] upgraded zope 2.8.1 to zope 2.9.3 Dear I need upgrade zope 2.8.1 to 2.9.3 ... Could someone help me..? Thanks gustavo ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope-DB] Operation Error : Using Zope2.6.1 and mxODBCZopeDA
I get the below error : OperationalError on Products.mxODBCZopeDA.ZopeDA.DatabaseConnection "DSN=Zope" thread 2476/2476 at 0x27150c4: ('08S01', 11, '[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation.', 6108) for the first time i open a web page .This error vanishes when i reload the page.Does it have anythng to do with 'ON Demand' feature of mxODBCZope DA ar any other reason for read error from Database.Can anyone help me out?RegardsSudesh ___ Zope-DB mailing list Zope-DB@zope.org http://mail.zope.org/mailman/listinfo/zope-db