Commit 4f264a9a authored by 's avatar

Added get_header method so that http headers can be found by

their normal names.
parent 3e471022
...@@ -82,10 +82,10 @@ ...@@ -82,10 +82,10 @@
# file. # file.
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.2 $'[11:-2] __version__='$Revision: 1.3 $'[11:-2]
import regex import regex
from string import atoi, atol, join, split, strip, rfind from string import atoi, atol, join, upper, split, strip, rfind
isCGI_NAME = { isCGI_NAME = {
'SERVER_SOFTWARE' : 1, 'SERVER_SOFTWARE' : 1,
...@@ -279,3 +279,8 @@ class Request: ...@@ -279,3 +279,8 @@ class Request:
def has_key(self,key): def has_key(self,key):
return self.get(key, Request) is not Request return self.get(key, Request) is not Request
def get_header(self, name, default=None):
# Return the named HTTP header, or an optional default
# argument or None if the header is not found.
name=upper(join(split(name,"-"),"_"))
return self.environ.get(name, default)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment