Hmm? Stephan and Paul's approach is essentially the same as mine. Our suggestion conforms with the interface documentation already in interfaces/http.py:
def setStatus(status, reason=None):
"""Sets the HTTP status code of the response
The argument may either be an integer or a string from { OK,
Created, Accepted, NoContent, MovedPermanently, MovedTemporarily, NotModified, BadRequest, Unauthorized,
Forbidden, NotFound, InternalError, NotImplemented,
BadGateway, ServiceUnavailable } that will be converted to the
correct integer value.
"""
The documentation doesn't say that the integer value is restricted. It also forbids passing the string "200"; the fact that it accepts "200" is in fact undocumented behavior.
OTOH, you could reasonably argue that the documentation is in error.
Hmm? Stephan and Paul's approach is essentially the same as mine. Our suggestion conforms with the interface documentation already in interfaces/http.py:
def setStatus(status, reason=None):
"""Sets the HTTP status code of the response
The argument may either be an integer or a string from { OK,
MovedTemporari ly, NotModified, BadRequest, Unauthorized,
Created, Accepted, NoContent, MovedPermanently,
Forbidden, NotFound, InternalError, NotImplemented,
BadGateway, ServiceUnavailable } that will be converted to the
correct integer value.
"""
The documentation doesn't say that the integer value is restricted. It also forbids passing the string "200"; the fact that it accepts "200" is in fact undocumented behavior.
OTOH, you could reasonably argue that the documentation is in error.