[Zope-Checkins] SVN: Zope/branches/publication-refactor/lib/python/ Using a new ITraversalRequest adapter to adapt the Zope2 requests.traversal method to
Log message for revision 67200: Using a new ITraversalRequest adapter to adapt the Zope2 requests.traversal method to the Zope3 version. Changed: U Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml U Zope/branches/publication-refactor/lib/python/Products/Five/interfaces.py U Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py -=- Modified: Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml === --- Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml 2006-04-21 09:38:13 UTC (rev 67199) +++ Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml 2006-04-21 09:51:55 UTC (rev 67200) @@ -50,5 +50,14 @@ five:implements class=ZPublisher.HTTPRequest.HTTPRequest interface=zope.publisher.interfaces.browser.IBrowserRequest / + + five:implements class=ZPublisher.HTTPRequest.HTTPRequest + interface=.interfaces.IZope2Request + / + adapter + for=.interfaces.IZope2Request + factory=ZPublisher.Publication.Zope3HTTPRequestTraverser + provides=zope.publisher.interfaces.ITraversingRequest + / /configure Modified: Zope/branches/publication-refactor/lib/python/Products/Five/interfaces.py === --- Zope/branches/publication-refactor/lib/python/Products/Five/interfaces.py 2006-04-21 09:38:13 UTC (rev 67199) +++ Zope/branches/publication-refactor/lib/python/Products/Five/interfaces.py 2006-04-21 09:51:55 UTC (rev 67200) @@ -27,6 +27,10 @@ find the method to be published. +class IZope2Request(Interface): +Marks the Zope2 request +pass + class IMenuItemType(IInterface): Menu item type Modified: Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py === --- Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py 2006-04-21 09:38:13 UTC (rev 67199) +++ Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py 2006-04-21 09:51:55 UTC (rev 67200) @@ -49,7 +49,7 @@ _marker = object() class Zope3HTTPRequestTraverser(object): -implements(IPublisherRequest) +implements(zope.publisher.interfaces.ITraversingRequest) def __init__(self, request): self.request = request @@ -61,12 +61,7 @@ return self.request.traverse(path, self.request.response, self.request.publication.validated_hook) -## XXX - Five declares that HTTPRequest implements IPublisherRequest -## but in fact it doesn't, the traverse method API is all wrong. -## component.provideAdapter(Zope3HTTPRequestTraverser, (HTTPRequest,), -## IPublisherRequest) - class ZopePublication(object): Base Zope2 publication specification. @@ -229,7 +224,8 @@ sys.exc_info()[2], ) except: -return request.response.exception() +request.response.exception() +return request.response finally: self._abort() ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/publication-refactor/lib/python/ Refactor some of the Zope2 traversal. This includes using
Log message for revision 67219: Refactor some of the Zope2 traversal. This includes using IPublishTraverse to do the traversal, and using Zope3 to find the views. Changed: U Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml U Zope/branches/publication-refactor/lib/python/ZPublisher/BaseRequest.py U Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py U Zope/branches/publication-refactor/lib/python/ZPublisher/Publish.py U Zope/branches/publication-refactor/lib/python/ZPublisher/Test.py -=- Modified: Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml === --- Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml 2006-04-21 14:18:10 UTC (rev 67218) +++ Zope/branches/publication-refactor/lib/python/Products/Five/configure.zcml 2006-04-21 14:20:05 UTC (rev 67219) @@ -60,4 +60,11 @@ provides=zope.publisher.interfaces.ITraversingRequest / + adapter + for=* + .interfaces.IZope2Request + provides=zope.publisher.interfaces.IPublishTraverse + factory=ZPublisher.Publication.Zope2PublishTraverseAdapter + / + /configure Modified: Zope/branches/publication-refactor/lib/python/ZPublisher/BaseRequest.py === --- Zope/branches/publication-refactor/lib/python/ZPublisher/BaseRequest.py 2006-04-21 14:18:10 UTC (rev 67218) +++ Zope/branches/publication-refactor/lib/python/ZPublisher/BaseRequest.py 2006-04-21 14:20:05 UTC (rev 67219) @@ -230,16 +230,9 @@ if method=='GET' or method=='POST' and not isinstance(response, xmlrpc.Response): -# Probably a browser -no_acquire_flag=0 # index_html is still the default method, only any object can # override it by implementing its own __browser_default__ method method = 'index_html' -elif self.maybe_webdav_client: -# Probably a WebDAV client. -no_acquire_flag=1 -else: -no_acquire_flag=0 URL=request['URL'] parents = request['PARENTS'] @@ -315,7 +308,7 @@ try: subobject = self.publication.traverseName( -self, object, entry_name, no_acquire_flag) +self, object, entry_name) except NotFound: if debug_mode: return response.debugError( @@ -323,30 +316,6 @@ else: return response.notFoundError(URL) -# Ensure that the object has a docstring, or that the parent -# object has a pseudo-docstring for the object. Objects that -# have an empty or missing docstring are not published. -doc = getattr(subobject, '__doc__', None) -if doc is None: -doc = getattr(object, '%s__doc__' % entry_name, None) -if not doc: -return response.debugError( -The object at %s has an empty or missing \ -docstring. Objects must have a docstring to be \ -published. % URL -) - -# Hack for security: in Python 2.2.2, most built-in types -# gained docstrings that they didn't have before. That caused -# certain mutable types (dicts, lists) to become publishable -# when they shouldn't be. The following check makes sure that -# the right thing happens in both 2.2.2+ and earlier versions. - -if not typeCheck(subobject): -return response.debugError( -The object at %s is not publishable. % URL -) - roles = getRoles( object, (not got) and entry_name or None, subobject, roles) Modified: Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py === --- Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py 2006-04-21 14:18:10 UTC (rev 67218) +++ Zope/branches/publication-refactor/lib/python/ZPublisher/Publication.py 2006-04-21 14:20:05 UTC (rev 67219) @@ -16,9 +16,10 @@ import sys import transaction import types +import xmlrpc from zope.event import notify -from zope.component import queryUtility +from zope.component import queryUtility, queryMultiAdapter from zope.interface import implements from zope.publisher.interfaces import IRequest, IPublication from zope.publisher.interfaces import NotFound, IPublicationRequest @@ -30,12 +31,16 @@ from zope.app.publication.interfaces
[Zope-Checkins] SVN: Zope/branches/publication-refactor2/lib/python/ Finish committing changes from the publication-refactor branch.
Log message for revision 67238: Finish committing changes from the publication-refactor branch. Also fixed bug in the traversal when we were always getting unauthorized errors when trying to use Five views. This was because I had left out some code from the Five.traversable. Changed: _U Zope/branches/publication-refactor2/lib/python/ U Zope/branches/publication-refactor2/lib/python/ZPublisher/BaseRequest.py U Zope/branches/publication-refactor2/lib/python/ZPublisher/Publication.py U Zope/branches/publication-refactor2/lib/python/ZPublisher/Test.py U Zope/branches/publication-refactor2/lib/python/ZServer/HTTPResponse.py U Zope/branches/publication-refactor2/lib/python/Zope2/Startup/__init__.py U Zope/branches/publication-refactor2/lib/python/Zope2/Startup/handlers.py U Zope/branches/publication-refactor2/lib/python/Zope2/Startup/zopeschema.xml _U Zope/branches/publication-refactor2/lib/python/zope/ -=- Property changes on: Zope/branches/publication-refactor2/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 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 twisted svn://svn.twistedmatrix.com/svn/Twisted/branches/releases/2.1.x/twisted Modified: Zope/branches/publication-refactor2/lib/python/ZPublisher/BaseRequest.py === --- Zope/branches/publication-refactor2/lib/python/ZPublisher/BaseRequest.py 2006-04-21 17:36:54 UTC (rev 67237) +++ Zope/branches/publication-refactor2/lib/python/ZPublisher/BaseRequest.py 2006-04-21 17:37:21 UTC (rev 67238) @@ -255,6 +255,10 @@ # Set the posttraverse for duration of the traversal here self._post_traverse = post_traverse = [] +# Con Zope 3 into using Zope 2's checkPermission +import Products.Five.security +Products.Five.security.newInteraction() + entry_name = '' try: # We build parents in the wrong order, so we Modified: Zope/branches/publication-refactor2/lib/python/ZPublisher/Publication.py === --- Zope/branches/publication-refactor2/lib/python/ZPublisher/Publication.py 2006-04-21 17:36:54 UTC (rev 67237) +++ Zope/branches/publication-refactor2/lib/python/ZPublisher/Publication.py 2006-04-21 17:37:21 UTC (rev 67238) @@ -251,7 +251,7 @@ except TraversalError: raise NotFound(ob, name) -return ob2 +return ob2.__of__(ob) if nm == '.': return ob @@ -360,12 +360,12 @@ # have an empty or missing docstring are not published. doc = getattr(subobject,
[Zope-Checkins] SVN: Products.Five/branches/publication-refactor2/ Create a branch for holding some changes in Five for
Log message for revision 67243: Create a branch for holding some changes in Five for the publication-refactor2 branch of Zope2. Changed: A Products.Five/branches/publication-refactor2/ -=- Copied: Products.Five/branches/publication-refactor2 (from rev 67242, Products.Five/trunk) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/publication-refactor2/lib/python/Products/ Link in branched version of Five.
Log message for revision 67245: Link in branched version of Five. Changed: _U Zope/branches/publication-refactor2/lib/python/Products/ -=- Property changes on: Zope/branches/publication-refactor2/lib/python/Products ___ Name: svn:externals - Five svn://svn.zope.org/repos/main/Products.Five/tags/1.3.3 + Five svn://svn.zope.org/repos/main/Products.Five/branches/publication-refactor2 ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PageTemplates/ A new test and a new fix.
Log message for revision 67246: A new test and a new fix. Changed: U Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py U Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py -=- Modified: Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py === --- Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py 2006-04-21 18:04:43 UTC (rev 67245) +++ Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py 2006-04-21 18:10:19 UTC (rev 67246) @@ -134,6 +134,14 @@ self.ZBindings_edit(self._default_bindings) self.pt_edit(text, content_type, encoding) +def pt_render(self, namespace, source=False, sourceAnnotations=False, + showtal=False): +if namespace is None: +namespace = self.pt_getContext() +return super(ZopePageTemplate, self).pt_render(namespace, source, sourceAnnotations, + showtal) + + def pt_getEngine(self): return getEngine() Modified: Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py === --- Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2006-04-21 18:04:43 UTC (rev 67245) +++ Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2006-04-21 18:10:19 UTC (rev 67246) @@ -94,6 +94,12 @@ pt = self.app.pt1 self.assertEqual(pt(), self.result) +def testPtErrors(self): +request = self.app.REQUEST +self._addPT('pt1', text=self.text, REQUEST=request) +pt = self.app.pt1 +pt.pt_render(None, source=1) +self.assertEqual(pt.pt_errors(None), None) class DummyFileUpload: ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/publication-refactor2/ define Zope2 specific request traversal type and
Log message for revision 67247: define Zope2 specific request traversal type and configure the IPublisTraverse adapter in ZPublisher.Publication Changed: U Products.Five/branches/publication-refactor2/browser/metaconfigure.py U Products.Five/branches/publication-refactor2/configure.zcml U Products.Five/branches/publication-refactor2/interfaces.py -=- Modified: Products.Five/branches/publication-refactor2/browser/metaconfigure.py === --- Products.Five/branches/publication-refactor2/browser/metaconfigure.py 2006-04-21 18:10:19 UTC (rev 67246) +++ Products.Five/branches/publication-refactor2/browser/metaconfigure.py 2006-04-21 18:14:08 UTC (rev 67247) @@ -20,6 +20,7 @@ import os +from zope.app import zapi from zope.interface import Interface from zope.configuration.exceptions import ConfigurationError from zope.publisher.interfaces.browser import IBrowserRequest, \ Modified: Products.Five/branches/publication-refactor2/configure.zcml === --- Products.Five/branches/publication-refactor2/configure.zcml 2006-04-21 18:10:19 UTC (rev 67246) +++ Products.Five/branches/publication-refactor2/configure.zcml 2006-04-21 18:14:08 UTC (rev 67247) @@ -44,4 +44,20 @@ interface=zope.publisher.interfaces.browser.IBrowserRequest / + five:implements class=ZPublisher.HTTPRequest.HTTPRequest + interface=.interfaces.IZope2Request + / + adapter + for=.interfaces.IZope2Request + factory=ZPublisher.Publication.Zope3HTTPRequestTraverser + provides=zope.publisher.interfaces.ITraversingRequest + / + + adapter + for=* + .interfaces.IZope2Request + provides=zope.publisher.interfaces.IPublishTraverse + factory=ZPublisher.Publication.Zope2PublishTraverseAdapter + / + /configure Modified: Products.Five/branches/publication-refactor2/interfaces.py === --- Products.Five/branches/publication-refactor2/interfaces.py 2006-04-21 18:10:19 UTC (rev 67246) +++ Products.Five/branches/publication-refactor2/interfaces.py 2006-04-21 18:14:08 UTC (rev 67247) @@ -27,6 +27,10 @@ find the method to be published. +class IZope2Request(Interface): +Marks the Zope2 request +pass + class IMenuItemType(IInterface): Menu item type ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/publication-refactor2/configure.zcml register the Zope2 request object with the zope3 publisher
Log message for revision 67251: register the Zope2 request object with the zope3 publisher Changed: U Products.Five/branches/publication-refactor2/configure.zcml -=- Modified: Products.Five/branches/publication-refactor2/configure.zcml === --- Products.Five/branches/publication-refactor2/configure.zcml 2006-04-21 18:42:37 UTC (rev 67250) +++ Products.Five/branches/publication-refactor2/configure.zcml 2006-04-21 18:57:50 UTC (rev 67251) @@ -16,6 +16,14 @@ include package=zope.app.event / include package=zope.app.traversing / + publisher + name=Zope2-HTTP + factory=ZPublisher.Publication.Zope2HTTPFactory + methods=* + mimetypes=* + priority=0 + / + !-- do 'traditional' traversing by default; needed by ZPT -- adapter for=* ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Products.Five/branches/publication-refactor2/meta.zcml try loading the zope.app.publication meta file
Log message for revision 67252: try loading the zope.app.publication meta file Changed: U Products.Five/branches/publication-refactor2/meta.zcml -=- Modified: Products.Five/branches/publication-refactor2/meta.zcml === --- Products.Five/branches/publication-refactor2/meta.zcml 2006-04-21 18:57:50 UTC (rev 67251) +++ Products.Five/branches/publication-refactor2/meta.zcml 2006-04-21 19:00:51 UTC (rev 67252) @@ -195,4 +195,7 @@ !-- load the i18n:registerTranslations directive -- include package=zope.app.i18n file=meta.zcml / + !-- load the zope:publisher directive -- + include package=zope.app.publication 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/publication-refactor2/browser/metaconfigure.py All browser views, implement IPublishTraverse and has such
Log message for revision 67256: All browser views, implement IPublishTraverse and has such they must do the __of__(context) call on the returned object. Changed: U Products.Five/branches/publication-refactor2/browser/metaconfigure.py -=- Modified: Products.Five/branches/publication-refactor2/browser/metaconfigure.py === --- Products.Five/branches/publication-refactor2/browser/metaconfigure.py 2006-04-21 19:54:38 UTC (rev 67255) +++ Products.Five/branches/publication-refactor2/browser/metaconfigure.py 2006-04-21 20:05:25 UTC (rev 67256) @@ -195,10 +195,10 @@ return getattr(self, pages[name]) view = zapi.queryView(self, name, request) if view is not None: -return view +return view.__of__(self) m = class_.publishTraverse.__get__(self) -return m(request, name) +return m(request, name).__of__(self) else: def publishTraverse(self, request, name, @@ -208,7 +208,7 @@ return getattr(self, pages[name]) view = zapi.queryView(self, name, request) if view is not None: -return view +return view.__of__(self) raise NotFoundError(self, name, request) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins