[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - IPublishTraverse.py:1.1.2.1 BaseRequest.py:1.1.2.28.10.2 mapply.py:1.1.2.11.14.1 publisher-meta.zcml:1.1.4.2.10.1 publisher.zcml:1.1.2.1.18.1
Jim Fulton
jim@zope.com
Sun, 2 Jun 2002 10:35:27 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv29793/lib/python/Zope/Publisher
Modified Files:
Tag: Zope3InWonderland-branch
BaseRequest.py mapply.py publisher-meta.zcml publisher.zcml
Added Files:
Tag: Zope3InWonderland-branch
IPublishTraverse.py
Log Message:
- Added template attribute to allow views to be created from a
template source file.
- Added beginnings of a Zope debugger. This required seperating site
and server configuration.
- Added the ability to specify a config file package in the
zopeConfigure directive. Made "config.zcml" a default for the file
attribute in the include directive.
- Fixed mapply to unwrap proxied objects. This was necessary once
views became wrapped in proxies. We need to investigate why they
weren't being wrapped before.
- I updated enough system page templates and zcml directives so that:
- Zope now starts. :)
- The root folder contents listing can be viewed.
Many more templates and zcml files need to be updated to reflect the
way views are now handled.
=== 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.2.1 2002/06/02 14:34:56 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.10.1 => 1.1.2.28.10.2 ===
"""
-from urllib import quote
from cgi import escape
from types import StringType
from BaseResponse import BaseResponse
=== Zope3/lib/python/Zope/Publisher/mapply.py 1.1.2.11 => 1.1.2.11.14.1 ===
"""
+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.2.10.1 ===
>
- <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.1.18.1 ===
xmlns='http://namespaces.zope.org/zope'
>
-
- <include package=".Browser" file="browser.zcml" />
<include package=".HTTP" file="http.zcml" />
</zopeConfigure>