Ticket #235 (closed defect: fixed)
paste.fixture.TestResponse.__contains__ Can't Handle Unicode
| Reported by: | brendan | Owned by: | ianb |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.5 |
| Component: | paste | Version: | svn-trunk |
| Severity: | normal | Keywords: | |
| Cc: |
Description
If the body of a response and the string being looked for as the argument to __contains__ both have unicode characters, then the line return (self.body.find(s) != -1 raises a UnicodeDecodeError?. This is a problem with the body containing unicode, not the string. This can be prevented by just turning body into a unicode object rather than a string by changing the line to return (unicode(self.body, 'utf-8').find(s) -1 (or using whatever the desired encoding is).
Change History
Note: See
TracTickets for help on using
tickets.
