[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - BaseRequest.py:1.1.2.27 RequestDataProperty.py:1.1.4.4
Philipp von Weitershausen
philikon@gmx.net
Wed, 10 Apr 2002 09:54:05 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv6608/lib/python/Zope/Publisher
Modified Files:
Tag: Zope-3x-branch
BaseRequest.py RequestDataProperty.py
Log Message:
Extended Interface IReadMapping with the has_key() method and
updated the corresponding implementations and tests.
=== Zope3/lib/python/Zope/Publisher/BaseRequest.py 1.1.2.26 => 1.1.2.27 ===
return default
-
+
+ def has_key(self, key):
+ 'See Interface.Common.Mapping.IReadMapping'
+ lookup = self.get(key, self)
+ return lookup is not self
+
#
############################################################
=== Zope3/lib/python/Zope/Publisher/RequestDataProperty.py 1.1.4.3 => 1.1.4.4 ===
"""
+from Interface.Common.Mapping import IReadMapping, IEnumerableMapping
+
class RequestDataGetter(object):
+ __implements__ = IReadMapping
+
def __init__(self, request):
self.__get = getattr(request, self._gettrname)
@@ -27,9 +31,16 @@
def get(self, name, default=None):
return self.__get(name, default)
+
+ def has_key(self, key):
+ lookup = self.get(key, self)
+ return lookup is not self
+
class RequestDataMapper(object):
+ __implements__ = IEnumerableMapping
+
def __init__(self, request):
self.__map = getattr(request, self._mapname)
@@ -38,6 +49,10 @@
def get(self, name, default=None):
return self.__map.get(name, default)
+
+ def has_key(self, key):
+ lookup = self.get(key, self)
+ return lookup is not self
def keys(self): return self.__map.keys()
def items(self): return self.__map.items()