[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - IPublishTraverse.py:1.1.4.1 BaseRequest.py:1.1.2.29 IPublicationRequest.py:1.1.2.6 mapply.py:1.1.2.12 publisher-meta.zcml:1.1.4.3 publisher.zcml:1.1.2.2

Jim Fulton jim@zope.com
Fri, 7 Jun 2002 10:41:55 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv12187/lib/python/Zope/Publisher

Modified Files:
      Tag: Zope-3x-branch
	BaseRequest.py IPublicationRequest.py mapply.py 
	publisher-meta.zcml publisher.zcml 
Added Files:
      Tag: Zope-3x-branch
	IPublishTraverse.py 
Log Message:
Merging in Zope3InWonderland-branch, which implemented the following
proposals (see
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/OldProposals): 
- RenameAllowToRequire

- GroupClassRelatedDirectivesInClassDirective

- ViewInterfaceAndSimplification

- ConsistentUseOfSpacesAsDelimitersInZCMLAttributes

- TwoArgumentViewConstructors

- ImplementsInZCML

- SimpleViewCreationInZCML

- RemoveGetView

- ReplaceProtectWithAllow

- ViewMethodsAsViews

- MergeProtectionAndComponentDefinitions

There were also various security fixes resulting of better integration
of security with components.


=== Added File Zope3/lib/python/Zope/Publisher/IPublishTraverse.py ===
##############################################################################
#
# Copyright (c) 2002 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.
# 
##############################################################################
"""

$Id: IPublishTraverse.py,v 1.1.4.1 2002/06/07 14:41:25 jim Exp $
"""

from Interface import Interface

class IPublishTraverse(Interface):

    def publishTraverse(request, name):
        """Lookup a name

        The request argument is the publisher request object.
        """



=== Zope3/lib/python/Zope/Publisher/BaseRequest.py 1.1.2.28 => 1.1.2.29 ===
 """
 
-from urllib import quote
 from cgi import escape
 from types import StringType
 from BaseResponse import BaseResponse
@@ -59,7 +58,7 @@
         '_body_instream',    # input stream
         '_body',             # The request body as a string
         '_publication',      # publication object
-        '_viewskin',         # View skin
+        '_presentation_skin',         # View skin
         )
 
     environment = RequestDataProperty(RequestEnvironment)
@@ -167,18 +166,19 @@
 
     def setViewSkin(self, skin):
         'See Zope.Publisher.IPublicationRequest.IPublicationRequest'
-        self._viewskin = skin
+        self._presentation_skin = skin
 
     ######################################
-    # from: Zope.ComponentArchitecture.IViewService.IViewRequest
+    # from:
+    # Zope.ComponentArchitecture.IPresentationService.IPresentationRequest
 
-    def getViewSkin(self):
-        'See Zope.ComponentArchitecture.IViewService.IViewRequest'
-        return getattr(self, '_viewskin', '')
-
-    def getViewType(self):
-        'See Zope.ComponentArchitecture.IViewService.IViewRequest'
-        return getattr(self, '_viewtype', None)
+    def getPresentationSkin(self):
+        'See Zope.ComponentArchitecture.IViewService.IPresentationRequest'
+        return getattr(self, '_presentation_skin', '')
+
+    def getPresentationType(self):
+        'See Zope.ComponentArchitecture.IViewService.IPresentationRequest'
+        return getattr(self, '_presentation_type', None)
 
     # This is not part of the interface:
     def setViewType(self, viewtype):
@@ -189,7 +189,7 @@
 
         # XXX This will probably go away
 
-        self._viewtype = viewtype
+        self._presentation_type = viewtype
 
 
     ######################################


=== Zope3/lib/python/Zope/Publisher/IPublicationRequest.py 1.1.2.5 => 1.1.2.6 ===
 """
 
-from Zope.ComponentArchitecture.IViewService import IViewRequest
+from Zope.ComponentArchitecture.IPresentationRequest \
+     import IPresentationRequest
 
-class IPublicationRequest(IViewRequest):
+class IPublicationRequest(IPresentationRequest):
     """Interface provided by requests to IPublication objects
     """
 


=== Zope3/lib/python/Zope/Publisher/mapply.py 1.1.2.11 => 1.1.2.12 ===
 """
 
+from Zope.Proxy.ProxyIntrospection import removeAllProxies
+
 _marker = []  # Create a new marker object.
 
 
-def unwrapMethod( object ):
+def unwrapMethod(object):
     """ object -> ( unwrapped, wrapperCount )
 
         Unwrap 'object' until we get to a real function, counting the
@@ -28,20 +30,27 @@
     """
     wrapperCount = 0
     unwrapped = object
-    
     for i in range(10):
-        if hasattr(unwrapped,'__bases__'):
-            # Calling class constructors might be dangerous.
+        bases = getattr(unwrapped, '__bases__', None)
+        if bases is not None:
             raise TypeError, "mapply() can not call class constructors"
-        if hasattr( unwrapped, 'im_func' ):
-            unwrapped = unwrapped.im_func
+
+        im_func = getattr(unwrapped, 'im_func', None)
+        if im_func is not None:
+            unwrapped = im_func
             wrapperCount += 1
-        elif hasattr( unwrapped, 'func_code' ):
+            continue
+
+        func_code = getattr(unwrapped, 'func_code', None)
+        if func_code is not None:
             break
-        elif hasattr( unwrapped, '__call__' ):
+
+        __call__ = getattr(unwrapped, '__call__' , None)
+        if __call__ is not None:
             unwrapped = unwrapped.__call__
         else:
             raise TypeError, "mapply() can not call %s" % `object`
+
     else:
         raise TypeError(
             "couldn't find callable metadata, mapply() error on %s"%`object`
@@ -51,7 +60,12 @@
 
 def mapply(object, positional=(), request={}, call=apply):
     __traceback_info__ = object
-    unwrapped, wrapperCount = unwrapMethod( object )
+
+    # we need deep access for intrspection. Waaa.
+    unwrapped = removeAllProxies(object)
+
+    unwrapped, wrapperCount = unwrapMethod(unwrapped)
+
     code = unwrapped.func_code
     defaults = unwrapped.func_defaults
     names = code.co_varnames[wrapperCount:code.co_argcount]


=== Zope3/lib/python/Zope/Publisher/publisher-meta.zcml 1.1.4.2 => 1.1.4.3 ===
 >
 
-  <include package=".Browser" file="browser-meta.zcml" />
   <include package=".XMLRPC" file="xmlrpc-meta.zcml" />
-  <!--include package=".SOAP" file="soap-meta.zcml" /-->
   <include package=".VFS" file="vfs-meta.zcml" />
 
 </zopeConfigure>


=== Zope3/lib/python/Zope/Publisher/publisher.zcml 1.1.2.1 => 1.1.2.2 ===
    xmlns='http://namespaces.zope.org/zope'
 >
-
-  <include package=".Browser" file="browser.zcml" />
   <include package=".HTTP" file="http.zcml" />
 
 </zopeConfigure>