[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser -
__init__.py:1.2.52.1 resource.py:1.5.6.1
resources.py:1.9.24.1 viewmeta.py:1.32.6.1
Jim Fulton
jim at zope.com
Mon Sep 8 15:22:17 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/publisher/browser
In directory cvs.zope.org:/tmp/cvs-serv20092/src/zope/app/publisher/browser
Modified Files:
Tag: parentgeddon-branch
__init__.py resource.py resources.py viewmeta.py
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing. Specific log entries will be provided
when we merge this into the head.
=== Zope3/src/zope/app/publisher/browser/__init__.py 1.2 => 1.2.52.1 ===
--- Zope3/src/zope/app/publisher/browser/__init__.py:1.2 Wed Dec 25 09:13:09 2002
+++ Zope3/src/zope/app/publisher/browser/__init__.py Mon Sep 8 14:21:45 2003
@@ -1,2 +1,31 @@
+##############################################################################
#
-# This file is necessary to make this directory a package.
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""Provide zope app-server customizatioin of publisher browser facilities
+
+$Id$
+"""
+
+import zope.publisher.browser
+import zope.app.location
+
+class BrowserView(zope.publisher.browser.BrowserView,
+ zope.app.location.Location,
+ ):
+
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
+ self.__parent__ = context
+
+
=== Zope3/src/zope/app/publisher/browser/resource.py 1.5 => 1.5.6.1 ===
--- Zope3/src/zope/app/publisher/browser/resource.py:1.5 Fri Aug 15 20:43:46 2003
+++ Zope3/src/zope/app/publisher/browser/resource.py Mon Sep 8 14:21:45 2003
@@ -18,28 +18,26 @@
__metaclass__ = type # All classes are new style when run with Python 2.2+
from zope.component import queryView
-from zope.context import getWrapperContainer, getInnerWrapperData
-from zope.context import ContextMethod
from zope.app.traversing import joinPath
from zope.component.interfaces import IResourceService
+from zope.app.location import Location
-class Resource:
+class Resource(Location):
def __init__(self, request):
self.request = request
def __call__(wrapped_self):
- name = getInnerWrapperData(wrapped_self)['name']
+ name = self.__name__
if name.startswith('++resource++'):
name = name[12:]
- service = getWrapperContainer(wrapped_self)
+ service = self.__parent__
while not IResourceService.isImplementedBy(service):
- name = "%s/%s" % (getInnerWrapperData(service)['name'],
- name)
- service = getWrapperContainer(service)
+ name = "%s/%s" % (service.__name__, name)
+ service = service.__parent__
- site = getWrapperContainer(service)
+ site = service.__parent__
skin = wrapped_self.request.getPresentationSkin()
if skin:
@@ -59,5 +57,3 @@
return joinPath(base_url, skin, '@@', name) # XXX joinPath should
else: # XXX eat empty path
return joinPath(base_url, '@@', name) # XXX elements
-
- __call__ = ContextMethod(__call__)
=== Zope3/src/zope/app/publisher/browser/resources.py 1.9 => 1.9.24.1 ===
--- Zope3/src/zope/app/publisher/browser/resources.py:1.9 Sat Jun 7 01:46:02 2003
+++ Zope3/src/zope/app/publisher/browser/resources.py Mon Sep 8 14:21:45 2003
@@ -21,8 +21,6 @@
from zope.publisher.interfaces.browser import IBrowserPublisher
from zope.component import getService
from zope.app.services.servicenames import Resources as ResourceService
-from zope.app.context import ContextWrapper
-from zope.context import ContextMethod
from zope.exceptions import NotFoundError
from zope.interface import implements
@@ -39,9 +37,10 @@
resource = resource_service.queryResource(wrapped_self, name, request)
if resource is None:
raise NotFoundError(wrapped_self, name)
- return ContextWrapper(resource, resource_service, name=name)
- publishTraverse = ContextMethod(publishTraverse)
+ resource.__parent__ = resource_service
+ resource.__name__ = name
+ return resource
def browserDefault(self, request):
'''See interface IBrowserPublisher'''
@@ -50,7 +49,6 @@
def __getitem__(self, name):
return self.publishTraverse(self.request, name)
- __getitem__ = ContextMethod(__getitem__)
def empty():
return ''
=== Zope3/src/zope/app/publisher/browser/viewmeta.py 1.32 => 1.32.6.1 ===
--- Zope3/src/zope/app/publisher/browser/viewmeta.py:1.32 Sun Aug 17 02:07:32 2003
+++ Zope3/src/zope/app/publisher/browser/viewmeta.py Mon Sep 8 14:21:45 2003
@@ -42,8 +42,6 @@
from zope.app.security.permission import checkPermission
-from zope.context import ContextMethod
-
from zope.app.publisher.browser.globalbrowsermenuservice \
import menuItemDirective, globalBrowserMenuService
@@ -144,9 +142,7 @@
if not hasattr(class_, 'browserDefault'):
cdict = {
'browserDefault':
- ContextMethod(lambda self, request:
- (getattr(self, attribute), ())
- )
+ lambda self, request: (getattr(self, attribute), ())
}
else:
cdict = {}
@@ -319,17 +315,17 @@
raise NotFoundError(self, name, request)
- cdict['publishTraverse'] = ContextMethod(publishTraverse)
+ cdict['publishTraverse'] = publishTraverse
if not hasattr(class_, 'browserDefault'):
if self.default or self.pages:
default = self.default or self.pages[0][0]
- cdict['browserDefault'] = ContextMethod(
+ cdict['browserDefault'] = (
lambda self, request, default=default:
(self, (default, ))
)
elif providesCallable(class_):
- cdict['browserDefault'] = ContextMethod(
+ cdict['browserDefault'] = (
lambda self, request: (self, ())
)
@@ -456,7 +452,6 @@
def publishTraverse(self, request, name):
raise NotFoundError(self, name, request)
- publishTraverse = ContextMethod(publishTraverse)
def __call__(self, *a, **k):
# If a class doesn't provide it's own call, then get the attribute
@@ -468,7 +463,6 @@
meth = getattr(self, attr)
return meth(*a, **k)
- __call__ = ContextMethod(__call__)
def providesCallable(class_):
if hasattr(class_, '__call__'):
More information about the Zope3-Checkins
mailing list