Changeset 1808:7dc0284d871a
- Timestamp:
- 10/21/09 13:57:06 (11 months ago)
- Author:
- Daniel Grana <dangra@…>
- Branch:
- default
- Message:
-
fix get_meta_refresh bug raised for TextResponses? without encoding
- Location:
- scrapy
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1804
|
r1808
|
|
| 94 | 94 | self.assertEqual(get_meta_refresh(response), (3, 'http://example.com/thisTHAT')) |
| 95 | 95 | |
| | 96 | # responses without refresh tag should return None None |
| | 97 | response = Response(url='http://example.org') |
| | 98 | self.assertEqual(get_meta_refresh(response), (None, None)) |
| | 99 | response = TextResponse(url='http://example.org') |
| | 100 | self.assertEqual(get_meta_refresh(response), (None, None)) |
| | 101 | |
| 96 | 102 | def test_response_httprepr(self): |
| 97 | 103 | r1 = Response("http://www.example.com") |
-
|
r1804
|
r1808
|
|
| 48 | 48 | """ |
| 49 | 49 | if response not in _metaref_cache: |
| 50 | | encoding = getattr(response, 'encoding', 'utf-8') |
| | 50 | encoding = getattr(response, 'encoding', None) or 'utf-8' |
| 51 | 51 | body_chunk = remove_entities(unicode(response.body[0:4096], encoding, \ |
| 52 | 52 | errors='ignore')) |