Fix #1867 (Time magazine download failure)

This commit is contained in:
Kovid Goyal 2009-02-17 15:45:42 -08:00
parent da33e04397
commit a8d514092f

View File

@ -493,6 +493,16 @@ class Parser(PreProcessor, LoggingInterface):
self.root.insert(0, head)
self.head = head
try:
self.body = self.root.body
except:
import traceback
err = traceback.format_exc()
self.root = fromstring(u'<html><head/><body><p>This page was too '
'severely malformed for calibre to handle. '
'It has been replaced by this error message.'
'</p><pre>%s</pre></body></html>'%err)
self.head = self.root.xpath('./head')[0]
self.body = self.root.body
for a in self.root.xpath('//a[@name]'):
a.set('id', a.get('name'))