[Zope-Checkins] SVN: Zope/branches/zope33-port/lib/python/ZPublisher/ Make request.debug be backward-compatible with old Zope 2 code as
Log message for revision 67815: Make request.debug be backward-compatible with old Zope 2 code as suggested by Florent in http://mail.zope.org/pipermail/zope-dev/2006-April/027424.html. request.debug will resolve to a form variable for all code except code that lies in a 'zope.*' package. Eventually, we should deprecate form variable access through getattr. I'm leaving a big comment to remind us of that. Changed: U Zope/branches/zope33-port/lib/python/ZPublisher/HTTPRequest.py U Zope/branches/zope33-port/lib/python/ZPublisher/tests/testHTTPRequest.py -=- Modified: Zope/branches/zope33-port/lib/python/ZPublisher/HTTPRequest.py === --- Zope/branches/zope33-port/lib/python/ZPublisher/HTTPRequest.py 2006-05-02 06:30:58 UTC (rev 67814) +++ Zope/branches/zope33-port/lib/python/ZPublisher/HTTPRequest.py 2006-05-02 08:22:56 UTC (rev 67815) @@ -13,7 +13,7 @@ __version__='$Revision: 1.96 $'[11:-2] -import re, sys, os, time, random, codecs +import re, sys, os, time, random, codecs, inspect from types import StringType, UnicodeType from BaseRequest import BaseRequest from HTTPResponse import HTTPResponse @@ -258,13 +258,13 @@ have_env=environ.has_key get_env=environ.get self.response=response -other=self.other={'RESPONSE': response, - 'debug': DebugFlags()} +other=self.other={'RESPONSE': response} self.form={} self.taintedform={} self.steps=[] self._steps=[] self._lazies={} +self._debug = DebugFlags() if environ.has_key('REMOTE_ADDR'): @@ -1216,7 +1216,18 @@ raise KeyError, key return v +# Using the getattr protocol to retrieve form values and similar +# is discouraged and is likely to be deprecated in the future. +# request.get(key) or request[key] should be used instead def __getattr__(self, key, default=_marker, returnTaints=0): +# ugly hack to make request.debug work for Zope 3 code (the +# ZPT engine, to be exact) while retaining request.debug +# functionality for all other code +if key == 'debug': +lastframe = inspect.currentframe().f_back +if lastframe.f_globals['__name__'].startswith('zope.'): +return self._debug + v = self.get(key, default, returnTaints=returnTaints) if v is _marker: raise AttributeError, key Modified: Zope/branches/zope33-port/lib/python/ZPublisher/tests/testHTTPRequest.py === --- Zope/branches/zope33-port/lib/python/ZPublisher/tests/testHTTPRequest.py 2006-05-02 06:30:58 UTC (rev 67814) +++ Zope/branches/zope33-port/lib/python/ZPublisher/tests/testHTTPRequest.py 2006-05-02 08:22:56 UTC (rev 67815) @@ -701,6 +701,45 @@ f.seek(0) self.assertEqual(f.xreadlines(),f) +def testDebug(self): +TEST_ENVIRON = { +'REQUEST_METHOD': 'GET', +'SERVER_NAME': 'localhost', +'SERVER_PORT': '80', +} +from StringIO import StringIO +from ZPublisher.HTTPRequest import HTTPRequest +s = StringIO('') + +# accessing request.debug from non-Zope3 code will raise an +# AttributeError +env = TEST_ENVIRON.copy() +request = HTTPRequest(s, env, None) +request.processInputs() +self.assertRaises(AttributeError, getattr, request, 'debug') + +# or it will actually yield a 'debug' form variable if it +# exists +env = TEST_ENVIRON.copy() +env['QUERY_STRING'] = 'debug=1' +request = HTTPRequest(s, env, None) +request.processInputs() +self.assertEqual(request.debug, '1') + +# if we access request.debug from a Zope 3 package, however, +# we will see the DebugFlags instance +def getDebug(request): +return request.debug +# make a forged copy of getDebug that looks as if its module +# was a Zope 3 package +z3globals = globals().copy() +z3globals['__name__'] = 'zope.apackage' +import new +getDebugFromZope3 = new.function(getDebug.func_code, z3globals) +from zope.publisher.base import DebugFlags +self.assertEqual(getDebug(request), '1') +self.assert_(isinstance(getDebugFromZope3(request), DebugFlags)) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(AuthCredentialsTestsa, 'test')) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/ sanely deal with deprecation warnings and remove a warning as well.
Log message for revision 67816: sanely deal with deprecation warnings and remove a warning as well. Changed: U Products.Five/trunk/browser/tests/test_defaultview.py U Products.Five/trunk/fiveconfigure.py U Products.Five/trunk/fivedirectives.py U Products.Five/trunk/viewlet/directives.txt -=- Modified: Products.Five/trunk/browser/tests/test_defaultview.py === --- Products.Five/trunk/browser/tests/test_defaultview.py 2006-05-02 08:22:56 UTC (rev 67815) +++ Products.Five/trunk/browser/tests/test_defaultview.py 2006-05-02 08:39:48 UTC (rev 67816) @@ -46,18 +46,21 @@ uf = self.folder.acl_users uf._doAddUser('manager', 'r00t', ['Manager'], []) -BBB This is a test of backwards comaptibility with Five 1.3/Zope2.9. -The deprecated directive five:defaultViewable would before make -index.html the default view. Test that this is still the case. -five:defaultViewable goes away in Zope 2.12, and this test goes then too: - import zope.deprecation - zope.deprecation.__show__.off() +BBB This is a test of backwards comaptibility with Five 1.3/Zope +2.9. The deprecated directive five:defaultViewable would before +make index.html the default view. Test that this is still the +case. five:defaultViewable goes away in Zope 2.12, and this test +goes then too: + + import warnings + showwarning = warnings.showwarning + warnings.showwarning = lambda *a, **k: None + zcml.load_string(''' ... configure xmlns:five=http://namespaces.zope.org/five; ... five:defaultViewable ... class=Products.Five.tests.testing.simplecontent.SimpleContent / ... /configure''') - zope.deprecation.__show__.on() print http(r''' ... GET /test_folder_1_/testoid HTTP/1.1 ... Authorization: Basic manager:r00t @@ -66,9 +69,11 @@ ... The eagle has landed + warnings.showwarning = showwarning -But if we want to, we can specify another default view with +But if we want to, we can specify another default view with browser:defaultView: + zcml.load_string(''' ... configure xmlns:browser=http://namespaces.zope.org/browser; ... browser:defaultView @@ -93,7 +98,7 @@ ... Default index_html called -Disabled __call__ overriding for now. Causese more trouble than it +Disabled __call__ overriding for now. Causes more trouble than it fixes. Thus, no test here: # print http(r''' Modified: Products.Five/trunk/fiveconfigure.py === --- Products.Five/trunk/fiveconfigure.py2006-05-02 08:22:56 UTC (rev 67815) +++ Products.Five/trunk/fiveconfigure.py2006-05-02 08:39:48 UTC (rev 67816) @@ -111,21 +111,21 @@ def isFiveMethod(m): return hasattr(m, '__five_method__') +# BBB 2006/05/01 -- to be removed after 12 months def traversable(_context, class_): -warnings.warn(The five:traversable statement is no longer needed \ - and will be removed in Zope 2.12, - DeprecationWarning) - +warnings.warn(The five:traversable statement is no longer needed + and will be removed in Zope 2.12., + DeprecationWarning, 2) + +# BBB 2006/05/01 -- to be removed after 12 months def defaultViewable(_context, class_): -if zope.deprecation.__show__(): -warnings.warn(The five:defaultViewable statement is no longer \ - needed and will be removed in Zope 2.12. \n If you rely \ - on it to make 'index.html' the default view, replace it \ +warnings.warn(The five:defaultViewable statement is no longer + needed and will be removed in Zope 2.12. \n If you rely + on it to make 'index.html' the default view, replace it with browser:defaultView name='index.html' /, DeprecationWarning, 2) implements(_context, class_, (IBrowserDefault,)) - def createZope2Bridge(zope2, package, name): # Map a Zope 2 interface into a Zope3 interface, seated within 'package' # as 'name'. Modified: Products.Five/trunk/fivedirectives.py === --- Products.Five/trunk/fivedirectives.py 2006-05-02 08:22:56 UTC (rev 67815) +++ Products.Five/trunk/fivedirectives.py 2006-05-02 08:39:48 UTC (rev 67816) @@ -38,6 +38,7 @@ value_type=GlobalObject() ) +# BBB 2006/05/01 -- to be removed after 12 months class ITraversableDirective(Interface): Make instances of class traversable publically. @@ -50,6 +51,7 @@ required=True ) +# BBB 2006/05/01 -- to be removed after 12 months class IDefaultViewableDirective(Interface): Make instances of class viewable publically.
[Zope-Checkins] SVN: Products.Five/trunk/INSTALL.txt get rid of zope 2.7 in compat matrix
Log message for revision 67817: get rid of zope 2.7 in compat matrix Changed: U Products.Five/trunk/INSTALL.txt -=- Modified: Products.Five/trunk/INSTALL.txt === --- Products.Five/trunk/INSTALL.txt 2006-05-02 08:39:48 UTC (rev 67816) +++ Products.Five/trunk/INSTALL.txt 2006-05-02 08:43:49 UTC (rev 67817) @@ -17,22 +17,19 @@ The following table shows which Five version can and should be used with which Zope 2 and Zope 3 versions. - === === = -.Zope 2.7 Zope 2.8 Zope 2.9 Zope 2.10 - --- --- - -.Zope X3 3.0 (not incl.) Zope X3 3.0 Zope 3.2 Zope 3.3 - === === = -Five 1.0X included -Five 1.1[#]_X X -Five 1.2 X -Five 1.3 included -Five 1.4 X -Five trunkincluded - === === = + === = +. Zope 2.8 Zope 2.9 Zope 2.10 + --- - +.Zope X3 3.0 Zope 3.2 Zope 3.3 + === = +Five 1.0 included +Five 1.2 X +Five 1.3 included +Five 1.4 X +Five trunkincluded + === = -.. [#] This branch is no longer actively maintained. - Running the tests - ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/fiveconfigure.py remove unused import
Log message for revision 67818: remove unused import Changed: U Products.Five/trunk/fiveconfigure.py -=- Modified: Products.Five/trunk/fiveconfigure.py === --- Products.Five/trunk/fiveconfigure.py2006-05-02 08:43:49 UTC (rev 67817) +++ Products.Five/trunk/fiveconfigure.py2006-05-02 08:50:05 UTC (rev 67818) @@ -26,7 +26,6 @@ import App.config import Products -import zope.deprecation from zope.interface import classImplements, classImplementsOnly, implementedBy from zope.interface.interface import InterfaceClass from zope.configuration import xmlconfig ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/browser/tests/provider.txt make test more tolerant towards different test setups (why running tests
Log message for revision 67822: make test more tolerant towards different test setups (why running tests as part of Zope has different effects on error handling than when running them separately is beyond me) Changed: U Products.Five/trunk/browser/tests/provider.txt -=- Modified: Products.Five/trunk/browser/tests/provider.txt === --- Products.Five/trunk/browser/tests/provider.txt 2006-05-02 09:31:16 UTC (rev 67821) +++ Products.Five/trunk/browser/tests/provider.txt 2006-05-02 09:53:32 UTC (rev 67822) @@ -94,17 +94,15 @@ /body /html - Failure to lookup a Content Provider print http(r''' ... GET /test_folder_1_/content_obj/error.html HTTP/1.1 - ... ''') - HTTP/1.1 500 Internal Server Error - ... - ...ContentProviderLookupError: mypage.UnknownName - ... + ... ''', handle_errors=False) + Traceback (most recent call last): +... + ContentProviderLookupError: ...mypage.UnknownName... Additional Data from TAL ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/ Merge zope33-port branch: Use most recent Zope 3 trunk (after jim-adapter branch merge)
Log message for revision 67823: Merge zope33-port branch: Use most recent Zope 3 trunk (after jim-adapter branch merge) and a corresponding Five trunk Changed: _U Zope/trunk/lib/python/ U Zope/trunk/lib/python/App/ImageFile.py U Zope/trunk/lib/python/OFS/CopySupport.py U Zope/trunk/lib/python/OFS/DTMLDocument.py U Zope/trunk/lib/python/OFS/DTMLMethod.py U Zope/trunk/lib/python/OFS/Image.py U Zope/trunk/lib/python/OFS/ObjectManager.py U Zope/trunk/lib/python/OFS/content_types.py U Zope/trunk/lib/python/OFS/event.py U Zope/trunk/lib/python/OFS/interfaces.py U Zope/trunk/lib/python/OFS/subscribers.py _U Zope/trunk/lib/python/Products/ U Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py U Zope/trunk/lib/python/TAL/TALInterpreter.py U Zope/trunk/lib/python/Testing/makerequest.py U Zope/trunk/lib/python/ZClasses/Method.py U Zope/trunk/lib/python/ZPublisher/HTTPRequest.py U Zope/trunk/lib/python/ZPublisher/Publish.py U Zope/trunk/lib/python/ZPublisher/Test.py U Zope/trunk/lib/python/ZPublisher/tests/testHTTPRequest.py U Zope/trunk/lib/python/Zope2/Startup/handlers.py U Zope/trunk/lib/python/webdav/NullResource.py _U Zope/trunk/lib/python/zope/ -=- Property changes on: Zope/trunk/lib/python ___ Name: svn:externals - ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1 BTrees -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/BTrees persistent -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/persistent ThreadedAsync -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ThreadedAsync transaction-r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/transaction ZEO-r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZEO ZODB -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZODB ZopeUndo -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz -r 41215 svn://svn.zope.org/repos/main/Zope3/trunk/src/pytz zodbcode -r 41215 svn://svn.zope.org/repos/main/Zope3/trunk/src/zodbcode ClientCookie -r 41215 svn://svn.zope.org/repos/main/Zope3/trunk/src/ClientCookie mechanize -r 41215 svn://svn.zope.org/repos/main/Zope3/trunk/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 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/BTrees persistent -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/persistent ThreadedAsync -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ThreadedAsync transaction-r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/transaction ZEO-r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZEO ZODB -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZODB ZopeUndo -r 41153 svn://svn.zope.org/repos/main/ZODB/branches/3.6/src/ZopeUndo zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon pytz -r 67819 svn://svn.zope.org/repos/main/Zope3/trunk/src/pytz zodbcode -r 67819 svn://svn.zope.org/repos/main/Zope3/trunk/src/zodbcode ClientCookie -r 67819 svn://svn.zope.org/repos/main/Zope3/trunk/src/ClientCookie mechanize -r 67819 svn://svn.zope.org/repos/main/Zope3/trunk/src/mechanize docutils svn://svn.zope.org/repos/main/docutils/tags/0.4.0 Modified: Zope/trunk/lib/python/App/ImageFile.py === --- Zope/trunk/lib/python/App/ImageFile.py 2006-05-02 09:53:32 UTC (rev 67822) +++ Zope/trunk/lib/python/App/ImageFile.py 2006-05-02 09:55:17 UTC (rev 67823) @@ -26,7 +26,7 @@ from Common import rfc1123_date from DateTime import DateTime -from zope.app.contenttypes import guess_content_type +from zope.contenttype import guess_content_type class ImageFile(Acquisition.Explicit): Image objects stored in external files. Modified: Zope/trunk/lib/python/OFS/CopySupport.py === --- Zope/trunk/lib/python/OFS/CopySupport.py2006-05-02 09:53:32 UTC (rev 67822) +++ Zope/trunk/lib/python/OFS/CopySupport.py2006-05-02 09:55:17 UTC (rev 67823) @@ -37,7 +37,7 @@ from ZODB.POSException import ConflictError from zope.interface import implements from zope.event import notify -from zope.app.event.objectevent import ObjectCopiedEvent +from zope.lifecycleevent import ObjectCopiedEvent from zope.app.container.contained import ObjectMovedEvent from zope.app.container.contained import notifyContainerModified from OFS.event import ObjectWillBeMovedEvent Modified:
[Zope-Checkins] SVN: Products.Five/trunk/ Use new import locations of some zope 3 packages
Log message for revision 67826: Use new import locations of some zope 3 packages Changed: U Products.Five/trunk/browser/TrustedExpression.py U Products.Five/trunk/viewlet/README.txt U Products.Five/trunk/viewlet/directives.txt U Products.Five/trunk/viewlet/metaconfigure.py U Products.Five/trunk/viewlet/tests.py -=- Modified: Products.Five/trunk/browser/TrustedExpression.py === --- Products.Five/trunk/browser/TrustedExpression.py2006-05-02 10:14:24 UTC (rev 67825) +++ Products.Five/trunk/browser/TrustedExpression.py2006-05-02 10:27:58 UTC (rev 67826) @@ -30,9 +30,8 @@ from zope.publisher.interfaces.browser import IBrowserRequest from zope.interface import implements, Interface -from zope.app.publication.browser import setDefaultSkin -from zope.app.traversing.namespace import nsParse -from zope.app.traversing.namespace import namespaceLookup +from zope.publisher.browser import setDefaultSkin +from zope.traversing.namespace import nsParse, namespaceLookup from zope.component import queryMultiAdapter class FakeRequest(dict): Modified: Products.Five/trunk/viewlet/README.txt === --- Products.Five/trunk/viewlet/README.txt 2006-05-02 10:14:24 UTC (rev 67825) +++ Products.Five/trunk/viewlet/README.txt 2006-05-02 10:27:58 UTC (rev 67826) @@ -71,7 +71,7 @@ from Products.Five.traversable import FakeRequest request = FakeRequest() - from zope.app.publication.browser import setDefaultSkin + from zope.publisher.browser import setDefaultSkin setDefaultSkin(request) from Products.Five.browser import BrowserView as View @@ -89,7 +89,7 @@ import zope.component from zope.publisher.interfaces.browser import IDefaultBrowserLayer - from zope.app.publisher.interfaces.browser import IBrowserView + from zope.publisher.interfaces.browser import IBrowserView from Acquisition import Explicit class WeatherBox(Explicit): Modified: Products.Five/trunk/viewlet/directives.txt === --- Products.Five/trunk/viewlet/directives.txt 2006-05-02 10:14:24 UTC (rev 67825) +++ Products.Five/trunk/viewlet/directives.txt 2006-05-02 10:27:58 UTC (rev 67826) @@ -42,7 +42,7 @@ from Products.Five.traversable import FakeRequest request = FakeRequest() - from zope.app.publication.browser import setDefaultSkin + from zope.publisher.browser import setDefaultSkin setDefaultSkin(request) from Products.Five.browser import BrowserView as View Modified: Products.Five/trunk/viewlet/metaconfigure.py === --- Products.Five/trunk/viewlet/metaconfigure.py2006-05-02 10:14:24 UTC (rev 67825) +++ Products.Five/trunk/viewlet/metaconfigure.py2006-05-02 10:27:58 UTC (rev 67826) @@ -1,12 +1,11 @@ import os from zope.configuration.exceptions import ConfigurationError from zope.viewlet import interfaces -from zope.interface import Interface -from zope.interface import classImplements +from zope.interface import Interface, classImplements +from zope.component import zcml from zope.publisher.interfaces.browser import IDefaultBrowserLayer -from zope.app.component import metaconfigure +from zope.publisher.interfaces.browser import IBrowserView from zope.app.publisher.browser import viewmeta -from zope.app.publisher.interfaces.browser import IBrowserView from Products.Five.security import getSecurityInfo, protectClass, protectName import viewlet @@ -49,15 +48,15 @@ # Register interfaces viewmeta._handle_for(_context, for_) -metaconfigure.interface(_context, view) +zcml.interface(_context, view) # register a viewlet manager _context.action( discriminator = ('viewletManager', for_, layer, view, name), -callable = metaconfigure.handler, -args = ('provideAdapter', -(for_, layer, view), provides, name, - new_class, _context.info),) +callable = zcml.handler, +args = ('registerAdapter', +new_class, (for_, layer, view), provides, name, +_context.info),) _context.action( discriminator = ('five:protectClass', new_class), callable = protectClass, @@ -148,12 +147,12 @@ # Register the interfaces. viewmeta._handle_for(_context, for_) -metaconfigure.interface(_context, view) +zcml.interface(_context, view) # register viewlet _context.action( discriminator = ('viewlet', for_, layer, view, manager, name), -callable = metaconfigure.handler, +callable = zcml.handler, args = ('provideAdapter', (for_, layer, view, manager), interfaces.IViewlet, name, new_class, _context.info),) @@ -174,4 +173,4 @@ discriminator =
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ Switch to newest five
Log message for revision 67827: Switch to newest five Changed: _U Zope/trunk/lib/python/Products/ -=- Property changes on: Zope/trunk/lib/python/Products ___ Name: svn:externals - Five -r 67822 svn://svn.zope.org/repos/main/Products.Five/trunk + Five -r 67826 svn://svn.zope.org/repos/main/Products.Five/trunk ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/regebro-wsgi_refactor/ Removed dead branch.
Log message for revision 67833: Removed dead branch. Changed: D Zope/branches/regebro-wsgi_refactor/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/regebro-issue_1888/ Pruning some branches. This was merged a long time ago.
Log message for revision 67834: Pruning some branches. This was merged a long time ago. Changed: D Zope/branches/regebro-issue_1888/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/ When you add roles in manage_access, roles are now stripped of any leading or trailing
Log message for revision 67839: When you add roles in manage_access, roles are now stripped of any leading or trailing spaces. Changed: U Zope/trunk/doc/CHANGES.txt U Zope/trunk/lib/python/AccessControl/Role.py -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt 2006-05-02 14:09:09 UTC (rev 67838) +++ Zope/trunk/doc/CHANGES.txt 2006-05-02 14:22:06 UTC (rev 67839) @@ -240,6 +240,8 @@ from the Zope 3 source tree (to get rid of redundant packages) Bugs Fixed + - When you add roles in manage_access, roles are now stripped of +any leading or trailing spaces. - Collector #2062: Fix manage_historyCopy, which was broken, and write tests for it. Modified: Zope/trunk/lib/python/AccessControl/Role.py === --- Zope/trunk/lib/python/AccessControl/Role.py 2006-05-02 14:09:09 UTC (rev 67838) +++ Zope/trunk/lib/python/AccessControl/Role.py 2006-05-02 14:22:06 UTC (rev 67839) @@ -473,7 +473,7 @@ if submit=='Add Role': -role=reqattr(REQUEST, 'role') +role=reqattr(REQUEST, 'role').strip() return self._addRole(role, REQUEST) if submit=='Delete Role': ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/CHANGES.txt reclassify changelog item
Log message for revision 67841: reclassify changelog item Changed: U Products.Five/trunk/CHANGES.txt -=- Modified: Products.Five/trunk/CHANGES.txt === --- Products.Five/trunk/CHANGES.txt 2006-05-02 15:35:27 UTC (rev 67840) +++ Products.Five/trunk/CHANGES.txt 2006-05-02 17:26:18 UTC (rev 67841) @@ -10,6 +10,10 @@ * Added Viewlet and Content Provider support. +* five:defaultViewable and five:traversable are now unessecary and + deprecated, as the functionality exists in the Zope core publisher + from Zope 2.10 and up. + Five 1.4 (unreleased) = @@ -24,9 +28,6 @@ * fiveconfigure.py: replaced zLOG with logging module -* five:defaultViewable and five:traversable are now unessecary, as the - functionality exists in the Zope core publisher from Zope 2.10 and up. - Five 1.4b (2006-03-31) == ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/ Some cleanup of viewlet stuff.
Log message for revision 67842: Some cleanup of viewlet stuff. Changed: U Products.Five/trunk/browser/TrustedExpression.py U Products.Five/trunk/viewlet/metaconfigure.py U Products.Five/trunk/viewlet/tests.py -=- Modified: Products.Five/trunk/browser/TrustedExpression.py === --- Products.Five/trunk/browser/TrustedExpression.py2006-05-02 17:26:18 UTC (rev 67841) +++ Products.Five/trunk/browser/TrustedExpression.py2006-05-02 17:35:27 UTC (rev 67842) @@ -22,7 +22,7 @@ getEngine, installHandlers,\ SecureModuleImporter -from ProviderExpression import ProviderExpr +from Products.Five.browser.ProviderExpression import ProviderExpr from ReuseUtils import rebindFunction Modified: Products.Five/trunk/viewlet/metaconfigure.py === --- Products.Five/trunk/viewlet/metaconfigure.py2006-05-02 17:26:18 UTC (rev 67841) +++ Products.Five/trunk/viewlet/metaconfigure.py2006-05-02 17:35:27 UTC (rev 67842) @@ -8,8 +8,8 @@ from zope.app.publisher.browser import viewmeta from Products.Five.security import getSecurityInfo, protectClass, protectName -import viewlet -import manager +from Products.Five.viewlet import viewlet +from Products.Five.viewlet import manager from Globals import InitializeClass as initializeClass Modified: Products.Five/trunk/viewlet/tests.py === --- Products.Five/trunk/viewlet/tests.py2006-05-02 17:26:18 UTC (rev 67841) +++ Products.Five/trunk/viewlet/tests.py2006-05-02 17:35:27 UTC (rev 67842) @@ -19,13 +19,9 @@ import unittest from Testing.ZopeTestCase import FunctionalDocFileSuite -from zope.app.testing import setup, ztapi -from zope.component import provideAdapter +from zope.app.testing import setup from zope.interface import Interface from zope.interface import implements -from zope.traversing.interfaces import ITraversable, ITraverser -from zope.traversing.adapters import Traverser -from zope.traversing.namespace import resource from zope.viewlet import interfaces from OFS.SimpleItem import SimpleItem @@ -53,25 +49,20 @@ def checkPermission( self, permission, object, context) : return 1 - class ILeftColumn(interfaces.IViewletManager): Left column of my page. - class INewColumn(interfaces.IViewletManager): Left column of my page. - class WeightBasedSorting(object): def sort(self, viewlets): return sorted(viewlets, lambda x, y: cmp(x[1].weight, y[1].weight)) - class Weather(object): weight = 0 - class Stock(object): weight = 0 def getStockTicker(self): @@ -82,47 +73,18 @@ def __call__(self): return u'Red Sox vs. White Sox' - def setUp(test): setup.placefulSetUp() -## resource namespace setup -#from zope.traversing.interfaces import ITraversable -#from zope.traversing.namespace import resource -#ztapi.provideAdapter(None, ITraversable, resource, name=resource) -#ztapi.provideView(None, None, ITraversable, resource, resource) -# -#from zope.app.pagetemplate import metaconfigure -#from zope.contentprovider import tales -#metaconfigure.registerType('provider', tales.TALESProviderExpression) -# -#zope.security.management.getInteraction().add(TestParticipation()) - -#def directivesSetUp(test): -#setUp(test) -#setup.setUpTestAsModule(test, 'zope.viewlet.directives') - - def tearDown(test): setup.placefulTearDown() -#def directivesTearDown(test): -#tearDown(test) -#setup.tearDownTestAsModule(test) - - def test_suite(): return unittest.TestSuite(( -FunctionalDocFileSuite('README.txt', - setUp=setUp, tearDown=tearDown - ), +FunctionalDocFileSuite('README.txt'), FunctionalDocFileSuite('directives.txt', setUp=setUp, tearDown=tearDown ), -#DocFileSuite('directives.txt', -# setUp=directivesSetUp, tearDown=directivesTearDown, -# optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS, -# ), )) if __name__ == '__main__': ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/browser/configure.zcml define index.html generically as the default view name
Log message for revision 67843: define index.html generically as the default view name Changed: U Products.Five/trunk/browser/configure.zcml -=- Modified: Products.Five/trunk/browser/configure.zcml === --- Products.Five/trunk/browser/configure.zcml 2006-05-02 17:35:27 UTC (rev 67842) +++ Products.Five/trunk/browser/configure.zcml 2006-05-02 17:40:45 UTC (rev 67843) @@ -1,8 +1,7 @@ configure xmlns=http://namespaces.zope.org/zope; xmlns:browser=http://namespaces.zope.org/browser; - browser:defaultView for=Products.Five.interfaces.IBrowserDefault - name=index.html / + browser:defaultView name=index.html / interface interface=zope.publisher.interfaces.browser.IBrowserSkinType ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/form/ Some fixes for add/edit forms to ensure that events are fired as expected.
Log message for revision 67845: Some fixes for add/edit forms to ensure that events are fired as expected. Changed: U Products.Five/trunk/form/__init__.py U Products.Five/trunk/form/tests/configure.zcml U Products.Five/trunk/form/tests/forms.txt U Products.Five/trunk/form/tests/schemacontent.py -=- Modified: Products.Five/trunk/form/__init__.py === --- Products.Five/trunk/form/__init__.py2006-05-02 17:56:17 UTC (rev 67844) +++ Products.Five/trunk/form/__init__.py2006-05-02 18:30:57 UTC (rev 67845) @@ -22,6 +22,7 @@ import transaction from zope.event import notify from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent +from zope.lifecycleevent import Attributes from zope.location.interfaces import ILocation from zope.location import LocationProxy from zope.schema.interfaces import ValidationError @@ -100,9 +101,16 @@ changed = applyWidgetsChanges(self, self.schema, target=content, names=self.fieldNames) # We should not generate events when an adapter is used. -# That's the adapter's job. -if changed and self.context is self.adapted: -notify(ObjectModifiedEvent(content)) +# That's the adapter's job. We need to unwrap the objects to +# compare them, as they are wrapped differently. +# Additionally, we can't use Acquisition.aq_base() because +# it strangely returns different objects for these two even +# when they are identical. In particular +# aq_base(self.adapted) != self.adapted.aq_base :-( +if changed and getattr(self.context, 'aq_base', self.context)\ +is getattr(self.adapted, 'aq_base', self.adapted): +description = Attributes(self.schema, *self.fieldNames) +notify(ObjectModifiedEvent(content, description)) except WidgetsError, errors: self.errors = errors status = _(An error occurred.) @@ -158,7 +166,9 @@ def create(self, *args, **kw): Do the actual instantiation. # hack to please typical Zope 2 factories, which expect id and title -args = ('tmp_id', 'Temporary title') + args +# Any sane schema will use a unicode title, and may fail on a +# non-unicode one. +args = ('tmp_id', u'Temporary title') + args return self._factory(*args, **kw) def createAndAdd(self, data): @@ -198,7 +208,6 @@ notify(ObjectCreatedEvent(content)) content = self.add(content) - adapted = self.schema(content) if self._set_after_add: @@ -209,6 +218,10 @@ field.set(adapted, data[name]) except ValidationError: errors.append(sys.exc_info()[1]) +# We have modified the object, so we need to publish an +# object-modified event: +description = Attributes(self.schema, *self._set_after_add) +notify(ObjectModifiedEvent(content, description)) if errors: raise WidgetsError(*errors) Modified: Products.Five/trunk/form/tests/configure.zcml === --- Products.Five/trunk/form/tests/configure.zcml 2006-05-02 17:56:17 UTC (rev 67844) +++ Products.Five/trunk/form/tests/configure.zcml 2006-05-02 18:30:57 UTC (rev 67845) @@ -62,7 +62,8 @@ schema=.schemacontent.IFieldContent content_factory=.schemacontent.FieldContent name=addwidgetoverride.html - permission=zope2.Public + permission=zope2.Public + set_before_add=title description somenumber somelist widget field=description @@ -78,6 +79,18 @@ permission=zope2.ViewManagementScreens / + subscriber + for=.schemacontent.IFieldContent + zope.lifecycleevent.interfaces.IObjectModifiedEvent + handler=.schemacontent.modifiedSubscriber + / + + subscriber + for=.schemacontent.IFieldContent + zope.lifecycleevent.interfaces.IObjectCreatedEvent + handler=.schemacontent.createdSubscriber + / + i18n:registerTranslations directory=locales/ /configure Modified: Products.Five/trunk/form/tests/forms.txt === --- Products.Five/trunk/form/tests/forms.txt2006-05-02 17:56:17 UTC (rev 67844) +++ Products.Five/trunk/form/tests/forms.txt2006-05-02 18:30:57 UTC (rev 67845) @@ -77,7 +77,20 @@ u'title' edittest.description #XXX shouldn't we get a u'' here??? +We can also verify that the IObjectCreatedEvent was fired, and the test +subscriber we registered set a flag indicating such: + edittest._created_flag + True + +Because the process of adding an
[Zope-Checkins] SVN: Products.Five/trunk/browser/configure.zcml bring this back. Five breaks utterly otherwise. looks like IBrowserDefault
Log message for revision 67846: bring this back. Five breaks utterly otherwise. looks like IBrowserDefault etc. aren't so unnecessary after all... something is definitely rotten in the state of denmark. Changed: U Products.Five/trunk/browser/configure.zcml -=- Modified: Products.Five/trunk/browser/configure.zcml === --- Products.Five/trunk/browser/configure.zcml 2006-05-02 18:30:57 UTC (rev 67845) +++ Products.Five/trunk/browser/configure.zcml 2006-05-02 18:45:19 UTC (rev 67846) @@ -1,7 +1,10 @@ configure xmlns=http://namespaces.zope.org/zope; xmlns:browser=http://namespaces.zope.org/browser; - browser:defaultView name=index.html / + browser:defaultView + for=Products.Five.interfaces.IBrowserDefault + name=index.html + / interface interface=zope.publisher.interfaces.browser.IBrowserSkinType ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/viewlet/metaconfigure.py Use new component registry API.
Log message for revision 67847: Use new component registry API. Changed: U Products.Five/trunk/viewlet/metaconfigure.py -=- Modified: Products.Five/trunk/viewlet/metaconfigure.py === --- Products.Five/trunk/viewlet/metaconfigure.py2006-05-02 18:45:19 UTC (rev 67846) +++ Products.Five/trunk/viewlet/metaconfigure.py2006-05-02 18:54:18 UTC (rev 67847) @@ -153,9 +153,9 @@ _context.action( discriminator = ('viewlet', for_, layer, view, manager, name), callable = zcml.handler, -args = ('provideAdapter', -(for_, layer, view, manager), interfaces.IViewlet, - name, new_class, _context.info),) +args = ('registerAdapter', +new_class, (for_, layer, view, manager), +interfaces.IViewlet, name, _context.info),) _context.action( discriminator = ('five:protectClass', new_class), ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.3/ Form fixes for 1.3
Log message for revision 67851: Form fixes for 1.3 Changed: U Products.Five/branches/1.3/CHANGES.txt U Products.Five/branches/1.3/form/__init__.py U Products.Five/branches/1.3/form/tests/configure.zcml U Products.Five/branches/1.3/form/tests/forms.txt U Products.Five/branches/1.3/form/tests/schemacontent.py -=- Modified: Products.Five/branches/1.3/CHANGES.txt === --- Products.Five/branches/1.3/CHANGES.txt 2006-05-02 19:04:39 UTC (rev 67850) +++ Products.Five/branches/1.3/CHANGES.txt 2006-05-02 19:08:45 UTC (rev 67851) @@ -8,6 +8,8 @@ Bugfixes +* Made sure that events are fired as expected in add and edit forms. + * Made sure LocalizerLanguages class normalized language codes to xx-yy, instead of xx_YY or xx-YY. Modified: Products.Five/branches/1.3/form/__init__.py === --- Products.Five/branches/1.3/form/__init__.py 2006-05-02 19:04:39 UTC (rev 67850) +++ Products.Five/branches/1.3/form/__init__.py 2006-05-02 19:08:45 UTC (rev 67851) @@ -130,8 +130,14 @@ changed = applyWidgetsChanges(self, self.schema, target=content, names=self.fieldNames) # We should not generate events when an adapter is used. -# That's the adapter's job. -if changed and self.context is self.adapted: +# That's the adapter's job. We need to unwrap the objects to +# compare them, as they are wrapped differently. +# Additionally, we can't use Acquisition.aq_base() because +# it strangely returns different objects for these two even +# when they are identical. In particular +# aq_base(self.adapted) != self.adapted.aq_base :-( +if changed and getattr(self.context, 'aq_base', self.context)\ +is getattr(self.adapted, 'aq_base', self.adapted): notify(ObjectModifiedEvent(content)) except WidgetsError, errors: self.errors = errors @@ -153,6 +159,7 @@ mapping={'date_time': str(datetime.utcnow())}) self.update_status = status + return status class AddView(EditView): @@ -188,7 +195,9 @@ def create(self, *args, **kw): Do the actual instantiation. # hack to please typical Zope 2 factories, which expect id and title -args = ('tmp_id', 'Temporary title') + args +# Any sane schema will use a unicode title, and may fail on a +# non-unicode one. +args = ('tmp_id', u'Temporary title') + args return self._factory(*args, **kw) def createAndAdd(self, data): @@ -228,7 +237,6 @@ notify(ObjectCreatedEvent(content)) content = self.add(content) - adapted = self.schema(content) if self._set_after_add: @@ -239,6 +247,9 @@ field.set(adapted, data[name]) except ValidationError: errors.append(sys.exc_info()[1]) +# We have modified the object, so we need to publish an +# object-modified event: +notify(ObjectModifiedEvent(content)) if errors: raise WidgetsError(*errors) Modified: Products.Five/branches/1.3/form/tests/configure.zcml === --- Products.Five/branches/1.3/form/tests/configure.zcml2006-05-02 19:04:39 UTC (rev 67850) +++ Products.Five/branches/1.3/form/tests/configure.zcml2006-05-02 19:08:45 UTC (rev 67851) @@ -65,7 +65,8 @@ schema=.schemacontent.IFieldContent content_factory=.schemacontent.FieldContent name=addwidgetoverride.html - permission=zope2.Public + permission=zope2.Public + set_before_add=title description somenumber somelist widget field=description @@ -81,6 +82,18 @@ permission=zope2.ViewManagementScreens / + subscriber + for=.schemacontent.IFieldContent + zope.app.event.interfaces.IObjectModifiedEvent + handler=.schemacontent.modifiedSubscriber + / + + subscriber + for=.schemacontent.IFieldContent + zope.app.event.interfaces.IObjectCreatedEvent + handler=.schemacontent.createdSubscriber + / + i18n:registerTranslations directory=locales/ /configure Modified: Products.Five/branches/1.3/form/tests/forms.txt === --- Products.Five/branches/1.3/form/tests/forms.txt 2006-05-02 19:04:39 UTC (rev 67850) +++ Products.Five/branches/1.3/form/tests/forms.txt 2006-05-02 19:08:45 UTC (rev 67851) @@ -100,7 +100,20 @@ u'title' edittest.description #XXX shouldn't we get a u'' here??? +We can also verify that the IObjectCreatedEvent was
[Zope-Checkins] SVN: Products.Five/branches/1.2/ Port form fixes to 1.2
Log message for revision 67856: Port form fixes to 1.2 Changed: U Products.Five/branches/1.2/CHANGES.txt U Products.Five/branches/1.2/browser/pagetemplatefile.py U Products.Five/branches/1.2/form/__init__.py U Products.Five/branches/1.2/form/tests/configure.zcml U Products.Five/branches/1.2/form/tests/forms.txt U Products.Five/branches/1.2/form/tests/schemacontent.py -=- Modified: Products.Five/branches/1.2/CHANGES.txt === --- Products.Five/branches/1.2/CHANGES.txt 2006-05-02 19:46:35 UTC (rev 67855) +++ Products.Five/branches/1.2/CHANGES.txt 2006-05-02 19:48:17 UTC (rev 67856) @@ -14,6 +14,14 @@ * Fixed a problem with the new traversal look-up order and the root object (OFS.Application.Application). +Five 1.2.4 (unreleased) +=== + +Bugfixes + + +* Made sure that events are fired as expected in add and edit forms. + Five 1.2.3 (2006-03-31) === Modified: Products.Five/branches/1.2/browser/pagetemplatefile.py === --- Products.Five/branches/1.2/browser/pagetemplatefile.py 2006-05-02 19:46:35 UTC (rev 67855) +++ Products.Five/branches/1.2/browser/pagetemplatefile.py 2006-05-02 19:48:17 UTC (rev 67856) @@ -34,10 +34,10 @@ Uses Zope 2's engine, but with security disabled and with some initialization and API from Zope 3. - + def __init__(self, filename, _prefix=None, content_type=None): # XXX doesn't use content_type yet - + self.ZBindings_edit(self._default_bindings) path = self.get_path_from_prefix(_prefix) @@ -47,7 +47,7 @@ basepath, ext = os.path.splitext(self.filename) self.__name__ = os.path.basename(basepath) - + def get_path_from_prefix(self, _prefix): if isinstance(_prefix, str): path = _prefix @@ -55,24 +55,24 @@ if _prefix is None: _prefix = sys._getframe(2).f_globals path = package_home(_prefix) -return path +return path _cook = rebindFunction(PageTemplateFile._cook, getEngine=getEngine) - + pt_render = rebindFunction(PageTemplateFile.pt_render, getEngine=getEngine) def _pt_getContext(self): try: root = self.getPhysicalRoot() -view = self._getContext() except AttributeError: -# self has no attribute getPhysicalRoot. This typically happens -# when the template has no proper acquisition context. -# That also means it has no view. /regebro root = self.context.getPhysicalRoot() -view = None +# Even if the context isn't a view (when would that be exaclty?), +# there shouldn't be any dange in applying a view, because it +# won't be used. However assuming that a lack of getPhysicalRoot +# implies a missing view causes problems. +view = self._getContext() here = self.context.aq_inner @@ -87,7 +87,7 @@ 'request': request, 'modules': ModuleImporter, } -if view: +if view is not None: c['view'] = view c['views'] = ViewMapper(here, request) Modified: Products.Five/branches/1.2/form/__init__.py === --- Products.Five/branches/1.2/form/__init__.py 2006-05-02 19:46:35 UTC (rev 67855) +++ Products.Five/branches/1.2/form/__init__.py 2006-05-02 19:48:17 UTC (rev 67856) @@ -130,8 +130,14 @@ changed = applyWidgetsChanges(self, self.schema, target=content, names=self.fieldNames) # We should not generate events when an adapter is used. -# That's the adapter's job. -if changed and self.context is self.adapted: +# That's the adapter's job. We need to unwrap the objects to +# compare them, as they are wrapped differently. +# Additionally, we can't use Acquisition.aq_base() because +# it strangely returns different objects for these two even +# when they are identical. In particular +# aq_base(self.adapted) != self.adapted.aq_base :-( +if changed and getattr(self.context, 'aq_base', self.context)\ +is getattr(self.adapted, 'aq_base', self.adapted): notify(ObjectModifiedEvent(content)) except WidgetsError, errors: self.errors = errors @@ -152,6 +158,7 @@ status.mapping = {'date_time': str(datetime.utcnow())} self.update_status = status + return status class AddView(EditView): @@ -187,7 +194,9 @@ def
[Zope-Checkins] SVN: Products.Five/branches/1.2/CHANGES.txt Fix incorrect CHANGES.txt update
Log message for revision 67857: Fix incorrect CHANGES.txt update Changed: U Products.Five/branches/1.2/CHANGES.txt -=- Modified: Products.Five/branches/1.2/CHANGES.txt === --- Products.Five/branches/1.2/CHANGES.txt 2006-05-02 19:48:17 UTC (rev 67856) +++ Products.Five/branches/1.2/CHANGES.txt 2006-05-02 19:50:45 UTC (rev 67857) @@ -8,20 +8,14 @@ Bugfixes +* Made sure that events are fired as expected in add and edit forms. + * Made sure LocalizerLanguages class normalized language codes to xx-yy, instead of xx_YY or xx-YY. * Fixed a problem with the new traversal look-up order and the root object (OFS.Application.Application). -Five 1.2.4 (unreleased) -=== - -Bugfixes - - -* Made sure that events are fired as expected in add and edit forms. - Five 1.2.3 (2006-03-31) === @@ -155,18 +149,18 @@ * When Zope was not in debug mode, an error in a ZCML file would cause Five to stop loading ZCML completely, making all subsequent products dead. The - effect would typically be that objects appeared to have no views at all. - Now a ZCML error will only stop the ZCML loading for that product, but the - rest of the products will load as usual. A traceback will still be printed + effect would typically be that objects appeared to have no views at all. + Now a ZCML error will only stop the ZCML loading for that product, but the + rest of the products will load as usual. A traceback will still be printed in the event log. - In debug mode the behaviour has not changed; a ZCML error will stop Zope + In debug mode the behaviour has not changed; a ZCML error will stop Zope startup completely, and print a traceback if running in foreground mode. - + Restructuring - -* The deprecated FivePageTemplateFile was removed, and the erroneous use of +* The deprecated FivePageTemplateFile was removed, and the erroneous use of this by EditView was changed. Bugfixes @@ -177,7 +171,7 @@ Note that this test fails on Zope 2.8.1, which incorrectly ignored 'handle_errors'. -* FiveTraversable should only do a view lookup and not call the traverse +* FiveTraversable should only do a view lookup and not call the traverse method of its superclass. * Fixed manage_beforeDelete triggering for classes using five:sendEvents. @@ -192,13 +186,13 @@ * 'zope' domain translations are now set up by default. Form i18n needs them. -* Added backwards compatibility for some moved classes (AddForm, EditForm, +* Added backwards compatibility for some moved classes (AddForm, EditForm, ContentAdding) * The ZPT variable 'container' makes little sense in Zope3/Five, but is now always set to be the same as 'here' which is normal Zope2 behaviour. It is in Five 1.0.x set to be the same as 'view' which breaks some templates. - + * In some hard to replicate cases, using the modules variable in ZPT cause an AuthenticationError. Using the secure module importer fixes this. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.3/ Fix CHANGES.TXT and add fix for pagetemplatefile needed for working forms
Log message for revision 67858: Fix CHANGES.TXT and add fix for pagetemplatefile needed for working forms Changed: U Products.Five/branches/1.3/CHANGES.txt U Products.Five/branches/1.3/browser/pagetemplatefile.py -=- Modified: Products.Five/branches/1.3/CHANGES.txt === --- Products.Five/branches/1.3/CHANGES.txt 2006-05-02 19:50:45 UTC (rev 67857) +++ Products.Five/branches/1.3/CHANGES.txt 2006-05-02 19:57:15 UTC (rev 67858) @@ -8,8 +8,6 @@ Bugfixes -* Made sure that events are fired as expected in add and edit forms. - * Made sure LocalizerLanguages class normalized language codes to xx-yy, instead of xx_YY or xx-YY. @@ -281,18 +279,18 @@ * When Zope was not in debug mode, an error in a ZCML file would cause Five to stop loading ZCML completely, making all subsequent products dead. The - effect would typically be that objects appeared to have no views at all. - Now a ZCML error will only stop the ZCML loading for that product, but the - rest of the products will load as usual. A traceback will still be printed + effect would typically be that objects appeared to have no views at all. + Now a ZCML error will only stop the ZCML loading for that product, but the + rest of the products will load as usual. A traceback will still be printed in the event log. - In debug mode the behaviour has not changed; a ZCML error will stop Zope + In debug mode the behaviour has not changed; a ZCML error will stop Zope startup completely, and print a traceback if running in foreground mode. - + Restructuring - -* The deprecated FivePageTemplateFile was removed, and the erroneous use of +* The deprecated FivePageTemplateFile was removed, and the erroneous use of this by EditView was changed. Bugfixes @@ -303,7 +301,7 @@ Note that this test fails on Zope 2.8.1, which incorrectly ignored 'handle_errors'. -* FiveTraversable should only do a view lookup and not call the traverse +* FiveTraversable should only do a view lookup and not call the traverse method of its superclass. * Fixed manage_beforeDelete triggering for classes using five:sendEvents. @@ -318,13 +316,13 @@ * 'zope' domain translations are now set up by default. Form i18n needs them. -* Added backwards compatibility for some moved classes (AddForm, EditForm, +* Added backwards compatibility for some moved classes (AddForm, EditForm, ContentAdding) * The ZPT variable 'container' makes little sense in Zope3/Five, but is now always set to be the same as 'here' which is normal Zope2 behaviour. It is in Five 1.0.x set to be the same as 'view' which breaks some templates. - + * In some hard to replicate cases, using the modules variable in ZPT cause an AuthenticationError. Using the secure module importer fixes this. Modified: Products.Five/branches/1.3/browser/pagetemplatefile.py === --- Products.Five/branches/1.3/browser/pagetemplatefile.py 2006-05-02 19:50:45 UTC (rev 67857) +++ Products.Five/branches/1.3/browser/pagetemplatefile.py 2006-05-02 19:57:15 UTC (rev 67858) @@ -34,10 +34,10 @@ Uses Zope 2's engine, but with security disabled and with some initialization and API from Zope 3. - + def __init__(self, filename, _prefix=None, content_type=None): # XXX doesn't use content_type yet - + self.ZBindings_edit(self._default_bindings) path = self.get_path_from_prefix(_prefix) @@ -47,7 +47,7 @@ basepath, ext = os.path.splitext(self.filename) self.__name__ = os.path.basename(basepath) - + def get_path_from_prefix(self, _prefix): if isinstance(_prefix, str): path = _prefix @@ -55,24 +55,24 @@ if _prefix is None: _prefix = sys._getframe(2).f_globals path = package_home(_prefix) -return path +return path _cook = rebindFunction(PageTemplateFile._cook, getEngine=getEngine) - + pt_render = rebindFunction(PageTemplateFile.pt_render, getEngine=getEngine) def _pt_getContext(self): try: root = self.getPhysicalRoot() -view = self._getContext() except AttributeError: -# self has no attribute getPhysicalRoot. This typically happens -# when the template has no proper acquisition context. -# That also means it has no view. /regebro root = self.context.getPhysicalRoot() -view = None +# Even if the context isn't a view (when would that be exaclty?), +# there shouldn't be any dange in applying a view, because it +# won't be used. However assuming that a lack of getPhysicalRoot +# implies a missing view causes problems. +
[Zope-Checkins] SVN: Products.Five/branches/1.4/CHANGES.txt The changes come via the 1.2.4 release, so we'll let them get merged in that way.
Log message for revision 67860: The changes come via the 1.2.4 release, so we'll let them get merged in that way. Changed: U Products.Five/branches/1.4/CHANGES.txt -=- Modified: Products.Five/branches/1.4/CHANGES.txt === --- Products.Five/branches/1.4/CHANGES.txt 2006-05-02 19:58:24 UTC (rev 67859) +++ Products.Five/branches/1.4/CHANGES.txt 2006-05-02 19:58:34 UTC (rev 67860) @@ -16,8 +16,6 @@ Bugfixes -* Made sure that events are fired as expected in add and edit forms. - * Made sure LocalizerLanguages class normalized language codes to xx-yy, instead of xx_YY or xx-YY. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/browser/TrustedExpression.py only use setDefaultSkin when a fake request has just been created. otherwise
Log message for revision 67861: only use setDefaultSkin when a fake request has just been created. otherwise it might be harmful, but it's definitely not necessary. Changed: U Products.Five/trunk/browser/TrustedExpression.py -=- Modified: Products.Five/trunk/browser/TrustedExpression.py === --- Products.Five/trunk/browser/TrustedExpression.py2006-05-02 19:58:34 UTC (rev 67860) +++ Products.Five/trunk/browser/TrustedExpression.py2006-05-02 20:11:49 UTC (rev 67861) @@ -54,7 +54,7 @@ REQUEST = get(ob, 'REQUEST', None) if REQUEST is None: REQUEST=FakeRequest() - setDefaultSkin(REQUEST) +setDefaultSkin(REQUEST) REQUEST['TraversalRequestNameStack'] = path path.reverse() pop=path.pop ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/traversable.py officially deprecate stupid FakeRequet construct
Log message for revision 67863: officially deprecate stupid FakeRequet construct Changed: U Products.Five/trunk/traversable.py -=- Modified: Products.Five/trunk/traversable.py === --- Products.Five/trunk/traversable.py 2006-05-02 20:12:44 UTC (rev 67862) +++ Products.Five/trunk/traversable.py 2006-05-02 20:16:21 UTC (rev 67863) @@ -13,26 +13,19 @@ ## Machinery for making things traversable through adaptation +BBB 2006/05/01 -- to be removed after 12 months + $Id$ -from zope.interface import implements -from zope.publisher.interfaces.browser import IBrowserRequest - -class FakeRequest(dict): -implements(IBrowserRequest) - -def has_key(self, key): -return False - -def getURL(self): -return http://codespeak.net/z3/five; - -# BBB 2006/05/01 -- to be removed after 12 months import zope.deferredimport zope.deferredimport.deprecated( __bobo_traverse__ and ITraverser/ITraversable for controlling -URL traversal has become obsolete. Use an IPublishTraverse -adapter instead., +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, ) +zope.deferredimport.deprecated( +Use zope.publisher.browser.TestRequest instead., +FakeRequest = zope.publisher.browser:TestRequest, +) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.3/CHANGES.txt do mention the form bugfix. in 1.x.y (x=const) we do like to mention
Log message for revision 67864: do mention the form bugfix. in 1.x.y (x=const) we do like to mention bugfixes, even if they might seem redudant. The reason is that several 1.x.y and 1.a.b releases are usually going on in parallel and it'd be hard to figure out otherwise what a release contains. Confused? :) Changed: U Products.Five/branches/1.3/CHANGES.txt -=- Modified: Products.Five/branches/1.3/CHANGES.txt === --- Products.Five/branches/1.3/CHANGES.txt 2006-05-02 20:16:21 UTC (rev 67863) +++ Products.Five/branches/1.3/CHANGES.txt 2006-05-02 20:32:00 UTC (rev 67864) @@ -8,6 +8,8 @@ Bugfixes +* Made sure that events are fired as expected in add and edit forms. + * Made sure LocalizerLanguages class normalized language codes to xx-yy, instead of xx_YY or xx-YY. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/1.4/ changelog fixes
Log message for revision 67865: changelog fixes Changed: U Products.Five/branches/1.4/CHANGES.txt U Products.Five/branches/1.4/version.txt -=- Modified: Products.Five/branches/1.4/CHANGES.txt === --- Products.Five/branches/1.4/CHANGES.txt 2006-05-02 20:32:00 UTC (rev 67864) +++ Products.Five/branches/1.4/CHANGES.txt 2006-05-02 20:32:37 UTC (rev 67865) @@ -2,20 +2,19 @@ Five Changes -Five 1.5 (unreleased) -= +Five 1.4c (unreleased) +== Features * Added Viewlet and Content Provider support. -Five 1.4 (unreleased) -= - Bugfixes +* Made sure that events are fired as expected in add and edit forms. + * Made sure LocalizerLanguages class normalized language codes to xx-yy, instead of xx_YY or xx-YY. Modified: Products.Five/branches/1.4/version.txt === --- Products.Five/branches/1.4/version.txt 2006-05-02 20:32:00 UTC (rev 67864) +++ Products.Five/branches/1.4/version.txt 2006-05-02 20:32:37 UTC (rev 67865) @@ -1 +1 @@ -Five 1.4 +Five 1.4c ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/ changelog and version number synchronization
Log message for revision 67866: changelog and version number synchronization (changelog entries from 1.2.x, 1.3.x and 1.4.x will be pasted in here after their releases) Changed: U Products.Five/trunk/CHANGES.txt U Products.Five/trunk/version.txt -=- Modified: Products.Five/trunk/CHANGES.txt === --- Products.Five/trunk/CHANGES.txt 2006-05-02 20:32:37 UTC (rev 67865) +++ Products.Five/trunk/CHANGES.txt 2006-05-02 20:33:32 UTC (rev 67866) @@ -2,14 +2,12 @@ Five Changes -Five 1.5 (unreleased) -= +Five 1.5b (unreleased) +== Features -* Added Viewlet and Content Provider support. - * five:defaultViewable and five:traversable are now unessecary and deprecated, as the functionality exists in the Zope core publisher from Zope 2.10 and up. Modified: Products.Five/trunk/version.txt === --- Products.Five/trunk/version.txt 2006-05-02 20:32:37 UTC (rev 67865) +++ Products.Five/trunk/version.txt 2006-05-02 20:33:32 UTC (rev 67866) @@ -1 +1 @@ -Five 1.5 unreleased +Five 1.5b ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/App/Extensions.py ProductDispatcher's __bobo_traverse__ now checks all products registered in Control_Panel.Products rather than simply checking the python P
Log message for revision 67868: ProductDispatcher's __bobo_traverse__ now checks all products registered in Control_Panel.Products rather than simply checking the python Products namespace package. Changed: U Zope/trunk/lib/python/App/Extensions.py -=- Modified: Zope/trunk/lib/python/App/Extensions.py === --- Zope/trunk/lib/python/App/Extensions.py 2006-05-02 20:44:47 UTC (rev 67867) +++ Zope/trunk/lib/python/App/Extensions.py 2006-05-02 20:57:53 UTC (rev 67868) @@ -78,6 +78,7 @@ if d: raise ValueError, ( 'The file name, %s, should be a simple file name' % name) +result = None if checkProduct: l = name.find('.') if l 0: @@ -85,15 +86,39 @@ n = name[l + 1:] for product_dir in Products.__path__: r = _getPath(product_dir, os.path.join(p, prefix), n, suffixes) -if r is not None: return r +if r is not None: result = r -import App.config -cfg = App.config.getConfiguration() -sw=os.path.dirname(os.path.dirname(cfg.softwarehome)) -for home in (cfg.instancehome, sw): -r=_getPath(home, prefix, name, suffixes) -if r is not None: return r +if result is None: +import App.config +cfg = App.config.getConfiguration() +sw=os.path.dirname(os.path.dirname(cfg.softwarehome)) +for home in (cfg.instancehome, sw): +r=_getPath(home, prefix, name, suffixes) +if r is not None: result = r +if result is None: +try: +l = name.find('.') +if l 0: +realName = name[l + 1:] +toplevel = name[:l] + +m = __import__(toplevel) + +d = os.path.join(m.__path__[0], prefix, realName) + +for s in suffixes: +if s: s=%s.%s % (d, s) +else: s=d +if os.path.exists(s): +result = s +break +except: +pass + + +return result + def getObject(module, name, reload=0, # The use of a mutable default is intentional here, # because modules is a module cache. ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/App/FactoryDispatcher.py External methods can now live outside of Products based python packages.
Log message for revision 67869: External methods can now live outside of Products based python packages. Changed: U Zope/trunk/lib/python/App/FactoryDispatcher.py -=- Modified: Zope/trunk/lib/python/App/FactoryDispatcher.py === --- Zope/trunk/lib/python/App/FactoryDispatcher.py 2006-05-02 20:57:53 UTC (rev 67868) +++ Zope/trunk/lib/python/App/FactoryDispatcher.py 2006-05-02 20:59:07 UTC (rev 67869) @@ -13,12 +13,36 @@ # Implement the manage_addProduct method of object managers +import types import Acquisition, sys, Products from Globals import InitializeClass from AccessControl import ClassSecurityInfo from AccessControl.PermissionMapping import aqwrap from AccessControl.Owned import UnownableOwner +import Zope2 +def _product_packages(): +Returns all product packages including the regularly defined +zope2 packages and those without the Products namespace package. + + +old_product_packages = {} +for x in dir(Products): +m = getattr(Products, x) +if isinstance(m, types.ModuleType): +old_product_packages[x] = m + +packages = {} +products = Zope2.app().Control_Panel.Products +for product_id in products.objectIds(): +product = products[product_id] +if hasattr(product, 'package_name'): +packages[product_id] = __import__(product.package_name) +elif old_product_packages.has_key(product_id): +packages[product_id] = old_product_packages[product_id] + +return packages + class ProductDispatcher(Acquisition.Implicit): # Allow access to factory dispatchers @@ -32,7 +56,7 @@ # Try to get a custom dispatcher from a Python product dispatcher_class=getattr( -getattr(Products, name, None), +_product_packages().get(name, None), '__FactoryDispatcher__', FactoryDispatcher) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/ZPublisher/BaseRequest.py objects will never provide IDefaultViewName. It's just a marker interface
Log message for revision 67870: objects will never provide IDefaultViewName. It's just a marker interface for strings, i believe... Changed: U Zope/trunk/lib/python/ZPublisher/BaseRequest.py -=- Modified: Zope/trunk/lib/python/ZPublisher/BaseRequest.py === --- Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2006-05-02 20:59:07 UTC (rev 67869) +++ Zope/trunk/lib/python/ZPublisher/BaseRequest.py 2006-05-02 21:15:18 UTC (rev 67870) @@ -404,8 +404,7 @@ # BrowserDefault returns the object to be published # (usually self) and a sequence of names to traverse to # find the method to be published. -if (IBrowserPublisher.providedBy(object) or -IDefaultViewName.providedBy(object)): +if IBrowserPublisher.providedBy(object): adapter = object else: adapter = queryMultiAdapter((object, self), ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/trunk/ Enabled ability to declare a regular python package as an official Zope2 product via zcml five:registerPackage.
Log message for revision 67874: Enabled ability to declare a regular python package as an official Zope2 product via zcml five:registerPackage. Changed: U Products.Five/trunk/fiveconfigure.py U Products.Five/trunk/fivedirectives.py U Products.Five/trunk/meta.zcml A Products.Five/trunk/tests/test_registerpackage.py A Products.Five/trunk/tests/testing/pythonproduct1.py A Products.Five/trunk/tests/testing/pythonproduct2/ A Products.Five/trunk/tests/testing/pythonproduct2/Extensions/ A Products.Five/trunk/tests/testing/pythonproduct2/Extensions/__init__.py A Products.Five/trunk/tests/testing/pythonproduct2/Extensions/somemodule.py A Products.Five/trunk/tests/testing/pythonproduct2/__init__.py -=- Modified: Products.Five/trunk/fiveconfigure.py === --- Products.Five/trunk/fiveconfigure.py2006-05-02 22:48:25 UTC (rev 67873) +++ Products.Five/trunk/fiveconfigure.py2006-05-02 23:22:01 UTC (rev 67874) @@ -24,7 +24,10 @@ import logging import App.config +from App.Product import initializeProduct +from App.ProductContext import ProductContext import Products +import Zope2 from zope.interface import classImplements, classImplementsOnly, implementedBy from zope.interface.interface import InterfaceClass @@ -199,6 +202,37 @@ args = (class_, meta_type, permission, addview, icon, global_) ) +def _registerPackage(module_, init_func=None): +Registers the given python package as a Zope 2 style product + + +if not hasattr(module_, '__path__'): +raise ValueError(Must be a package and the \ + package must be filesystem based) + +app = Zope2.app() +product = initializeProduct(module_, +module_.__name__, +module_.__path__[0], +app) + +product.package_name = module_.__name__ + +if init_func is not None: +newContext = ProductContext(product, app, module_) +init_func(newContext) + + +def registerPackage(_context, package, initialize=None): +ZCML directive function for registering a python package product + + +_context.action( +discriminator = ('registerPackage', package), +callable = _registerPackage, +args = (package,initialize) +) + # clean up code def killMonkey(class_, name, fallback, attr=None): Modified: Products.Five/trunk/fivedirectives.py === --- Products.Five/trunk/fivedirectives.py 2006-05-02 22:48:25 UTC (rev 67873) +++ Products.Five/trunk/fivedirectives.py 2006-05-02 23:22:01 UTC (rev 67874) @@ -170,6 +170,8 @@ required=False ) + + class IInclude(Interface): file = BytesLine( @@ -178,3 +180,20 @@ u'installed Product. If the file does not exist, for a ' u'particular product, no error is raised.', required=False) + +class IRegisterPackageDirective(Interface): +Registers the given python package which at a minimum fools zope2 into +thinking of it as a zope2 product. + + +package = GlobalObject( +title=u'Target package', +required=True +) + +initialize = GlobalObject( +title=u'Initialization function to invoke', +description=u'The dotted name of a function that will get invoked ' +u'with a ProductContext instance', +required=False +) Modified: Products.Five/trunk/meta.zcml === --- Products.Five/trunk/meta.zcml 2006-05-02 22:48:25 UTC (rev 67873) +++ Products.Five/trunk/meta.zcml 2006-05-02 23:22:01 UTC (rev 67874) @@ -160,6 +160,12 @@ handler=.fiveconfigure.registerClass / +meta:directive + name=registerPackage + schema=.fivedirectives.IRegisterPackageDirective + handler=.fiveconfigure.registerPackage + / + /meta:directives /configure Added: Products.Five/trunk/tests/test_registerpackage.py === --- Products.Five/trunk/tests/test_registerpackage.py 2006-05-02 22:48:25 UTC (rev 67873) +++ Products.Five/trunk/tests/test_registerpackage.py 2006-05-02 23:22:01 UTC (rev 67874) @@ -0,0 +1,91 @@ +## +# +# Copyright (c) 2006 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT,