[New-bugs-announce] [issue10935] wsgiref.handlers.BaseHandler and subclasses of str

Tim Perevezentsev report at bugs.python.org
Tue Jan 18 18:29:24 CET 2011

New submission from Tim Perevezentsev <riffm2005 at gmail.com>:

This code:

    assert type(val) is StringType,"Header values must be strings"

(from here http://svn.python.org/view/python/tags/r271/Lib/wsgiref/handlers.py?revision=86833&view=markup)

from "start_response" method, is not allowing to use str subclasses objects as header value.


I made class URL which subclasses str and has additional methods to manipulate query string. It is very handy. But when I need to set header
"Location" with URL object as value I get assertion error.

Can't we do this instead:

    assert isinstance(val, str),"Header values must be strings"

components: Library (Lib)
messages: 126471
nosy: riffm
priority: normal
severity: normal
status: open
title: wsgiref.handlers.BaseHandler and subclasses of str
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list