New submission from Tim Perevezentsev <riffm2...@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.

Usecase:

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 <rep...@bugs.python.org>
<http://bugs.python.org/issue10935>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to