[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication - PublicationTraverse.py:1.1.2.18.4.1 Traversers.py:1.1.2.18.4.1 ZopePublication.py:1.1.2.39.6.1
Jim Fulton
jim@zope.com
Wed, 29 May 2002 11:10:19 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication
In directory cvs.zope.org:/tmp/cvs-serv12181/lib/python/Zope/App/ZopePublication
Modified Files:
Tag: Zope3InWonderland-branch
PublicationTraverse.py Traversers.py ZopePublication.py
Log Message:
- Added permission_id attribute to adapter and utility directives.
- Got rid of old getView, getResource, and getDefaultViewName.
Renamed getRequestView to getView (and so on).
Changed view interface to use context, rather than getContext.
Introduced notion of presentation types (e.g. IBrowserPresentation,
which is cleaner than IBrowserPublisher).
- Began converting to get/queryFoo, which is much nicer.
- Many formatting fixups.
=== Zope3/lib/python/Zope/App/ZopePublication/PublicationTraverse.py 1.1.2.18 => 1.1.2.18.4.1 ===
from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
-from Zope.ComponentArchitecture import getRequestView, getService
+from Zope.ComponentArchitecture import queryView, getService
from Zope.Publisher.Exceptions import NotFound
from types import StringTypes
from Zope.Proxy.ContextWrapper import ContextWrapper, getWrapperContext
@@ -74,10 +74,10 @@
if nm == '.':
return ob
- if request.getViewType().isImplementedBy(removeAllProxies(ob)):
+ if request.getPresentationType().isImplementedBy(removeAllProxies(ob)):
ob2 = ob.publishTraverse(request, nm)
else:
- adapter = getRequestView(ob, '_traverse', request, self # marker
+ adapter = queryView(ob, '_traverse', request, self # marker
)
if adapter is not self:
=== Zope3/lib/python/Zope/App/ZopePublication/Traversers.py 1.1.2.18 => 1.1.2.18.4.1 ===
from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
from Zope.ComponentArchitecture \
- import getRequestView, getRequestDefaultViewName
+ import getView, getDefaultViewName
from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
class SimpleComponentTraverser:
@@ -22,20 +22,20 @@
"""
__implements__ = IBrowserPublisher
- def __init__(self, target):
+ def __init__(self, target, request):
self.target = target
def browserDefault(self, request):
ob = self.target
- view_name = getRequestDefaultViewName(ob, request)
+ view_name = getDefaultViewName(ob, request)
return ob, (view_name,)
def publishTraverse(self, request, name):
ob = self.target
try:
- return getRequestView(ob, name, request)
+ return getView(ob, name, request)
except ComponentLookupError:
raise NotFound(ob, name)
@@ -52,7 +52,7 @@
def browserDefault(self, request):
ob = self.target
- view_name = getRequestDefaultViewName(ob, request)
+ view_name = getDefaultViewName(ob, request)
view = self.publishTraverse(request, view_name)
if hasattr(view, 'browserDefault'):
view, path = view.browserDefault(request)
@@ -69,7 +69,7 @@
__implements__ = IBrowserPublisher
- def __init__(self, target):
+ def __init__(self, target, request):
self.target = target
def browserDefault(self, request):
@@ -77,7 +77,7 @@
if hasattr(ob, '__implements__'):
- view_name = getRequestDefaultViewName(ob, request)
+ view_name = getDefaultViewName(ob, request)
return ob, (("%s;view" % view_name),)
@@ -86,7 +86,7 @@
def publishTraverse(self, request, name):
ob = self.target
if name.endswith(';view'):
- return getRequestView( ob, name[:-5], request)
+ return getView( ob, name[:-5], request)
if name.startswith('_'):
raise Unauthorized("Name %s begins with an underscore" % `name`)
=== Zope3/lib/python/Zope/App/ZopePublication/ZopePublication.py 1.1.2.39 => 1.1.2.39.6.1 ===
from zLOG import LOG, ERROR, INFO
-from Zope.ComponentArchitecture import getRequestView
from Zope.Publisher.DefaultPublication import DefaultPublication
from Zope.Publisher.mapply import mapply
from Zope.Publisher.Exceptions import Retry