[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - ViewService.py:1.1.2.3
Andreas Jung
andreas@digicool.com
Thu, 10 Jan 2002 15:57:18 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv5807
Modified Files:
Tag: Zope-3x-branch
ViewService.py
Log Message:
check when None is passed as default to getView
=== Zope3/lib/python/Zope/ComponentArchitecture/ViewService.py 1.1.2.2 => 1.1.2.3 ===
from Exceptions import ComponentLookupError
+_marker = object()
+
class ViewService:
def __init__(self):
@@ -27,7 +29,8 @@
# Implementation methods for interface
# Zope.ComponentArchitecture.IViewService.
- def getView(self, object, name, type, default=None, skin=''):
+
+ def getView(self, object, name, type, default=_marker, skin=''):
'''See interface IViewService'''
for layername in self.__skins.get(skin, ()):
layer = self.__layers.get(layername)
@@ -38,14 +41,13 @@
if c is None: continue
return c(object)
- if default is None:
+ if default is _marker:
raise ComponentLookupError(object, name, type)
return default
- def getRequestView(self, object, name, request, default=None):
+ def getRequestView(self, object, name, request, default=_marker):
'''See interface IViewService'''
-
type = request.getViewType()
skin = request.getViewSkin()