Ticket #156 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

Implement a HTTPException.response(environ) method that returns a WSGIResponse

Reported by: damjan Owned by: ianb
Priority: normal Milestone: 1.3
Component: paste Version: 1.2.1
Severity: normal Keywords:
Cc:

Description

This methot creates a WSGIResponse from an HTTPException

Attachments

paste-httpexceptions.diff Download (1.2 KB) - added by damjan 5 years ago.

Change History

Changed 5 years ago by damjan

Changed 5 years ago by damjan

  • version changed from 1.1.1 to 1.2.1

I have a little concern about the line `resp.headers.update(dict(headers))'.

Although specifically, in this case `headers' will not have duplicate headers ... in genereal that code should probably be done with a for loop like this:

for key, value in headers:
    resp.headers.add(key, value)

Changed 5 years ago by damjan

I feel stupid for replying to myself, but ... The for loop above would make the content-type header appear twice, and nobody likes that (especially Pylons).

So best is probably,

resp.headers = resp.headers.fromlist(headers)

Changed 5 years ago by ianb

  • status changed from new to closed
  • resolution set to fixed

OK, changed to resp.headers = resp.headers.fromlist(headers) in r6283.

Note: See TracTickets for help on using tickets.