http-header: support __contains__ in Headers
You can now use::
>>> 'expires" in headers
True
--- a/web/http_headers.py Thu Mar 15 17:48:20 2012 +0100
+++ b/web/http_headers.py Thu Mar 15 17:54:40 2012 +0100
@@ -1290,11 +1290,13 @@
self._raw_headers[name] = r
return r
- def hasHeader(self, name):
+ def __contains__(self, name):
"""Does a header with the given name exist?"""
name=name.lower()
return self._raw_headers.has_key(name)
+ hasHeader = __contains__
+
def getRawHeaders(self, name, default=None):
"""Returns a list of headers matching the given name as the raw string given."""