def __getitem__(self, key, _get_mode=False): # _get_mode is a no-op for this class as there is no index but # used because get() calls it. key = key.upper().replace('-', '_') if key in ('CONTENT_TYPE', 'CONTENT_LENGTH'): return unicodify_header_value(self.environ[key]) return unicodify_header_value(self.environ['HTTP_' + key])
def __iter__(self): for key, value in self.environ.items(): if (key.startswith('HTTP_') and key not in ('HTTP_CONTENT_TYPE', 'HTTP_CONTENT_LENGTH')): yield (key[5:].replace('_', '-').title(), unicodify_header_value(value)) elif key in ('CONTENT_TYPE', 'CONTENT_LENGTH'): yield (key.replace('_', '-').title(), unicodify_header_value(value))
def __iter__(self): for key, value in self.environ.items(): if ( key.startswith('HTTP_') and key not in ('HTTP_CONTENT_TYPE', 'HTTP_CONTENT_LENGTH') ): yield ( key[5:].replace('_', '-').title(), unicodify_header_value(value), ) elif key in ('CONTENT_TYPE', 'CONTENT_LENGTH'): yield ( key.replace('_', '-').title(), unicodify_header_value(value), )