~ubuntu-branches/debian/wheezy/calibre/wheezy

« back to all changes in this revision

Viewing changes to src/calibre/web/fetch/simple.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2010-08-11 11:30:57 UTC
  • mfrom: (1.3.14 upstream)
  • mto: (29.3.2 oneiric)
  • mto: This revision was merged to the branch mainline in revision 31.
  • Revision ID: james.westby@ubuntu.com-20100811113057-2jhbcbavxw7wlt0c
Tags: 0.7.13+dfsg-1
* New upstream version.
* debian/control: Add python-routes recommends. (Closes: #590561)
* Convert to 3.0 (quilt) source format.
* Bump debhelper compat level to 7, and drop now obsolete
  DEB_DH_INSTALL_SOURCEDIR in debian/rules.
* debian/control: Add missing ${misc:Depends}.
* debian/control: Bump Standards-Version to 3.9.1.
* debian/copyright: Replace obsolete reference to
  /usr/share/common-licenses/BSD with their verbatim text from the original
  source.
* debian/rules: Remove invalid hashbang lines from *.recipe, these have no
  __main__.

Show diffs side-by-side

added added

removed removed

Lines of Context:
238
238
        soup = BeautifulSoup(u'<a href="'+url+'" />')
239
239
        self.log.debug('Downloading')
240
240
        res = self.process_links(soup, url, 0, into_dir='')
241
 
        self.log.debug('%s saved to %s'%( url, res))
 
241
        self.log.debug(url, 'saved to', res)
242
242
        return res
243
243
 
244
244
    def is_link_ok(self, url):
281
281
                try:
282
282
                    data = self.fetch_url(iurl)
283
283
                except Exception:
284
 
                    self.log.exception('Could not fetch stylesheet %s'% iurl)
 
284
                    self.log.exception('Could not fetch stylesheet ', iurl)
285
285
                    continue
286
286
                stylepath = os.path.join(diskpath, 'style'+str(c)+'.css')
287
287
                with self.stylemap_lock:
304
304
                        try:
305
305
                            data = self.fetch_url(iurl)
306
306
                        except Exception:
307
 
                            self.log.exception('Could not fetch stylesheet %s'% iurl)
 
307
                            self.log.exception('Could not fetch stylesheet ', iurl)
308
308
                            continue
309
309
                        c += 1
310
310
                        stylepath = os.path.join(diskpath, 'style'+str(c)+'.css')
337
337
                    # Skip empty GIF files as PIL errors on them anyway
338
338
                    continue
339
339
            except Exception:
340
 
                self.log.exception('Could not fetch image %s'% iurl)
 
340
                self.log.exception('Could not fetch image ', iurl)
341
341
                continue
342
342
            c += 1
343
343
            fname = ascii_filename('img'+str(c))
423
423
                    newbaseurl = dsrc.newurl
424
424
                    if len(dsrc) == 0 or \
425
425
                       len(re.compile('<!--.*?-->', re.DOTALL).sub('', dsrc).strip()) == 0:
426
 
                        raise ValueError('No content at URL %s'%iurl)
 
426
                        raise ValueError('No content at URL %r'%iurl)
427
427
                    if callable(self.encoding):
428
428
                        dsrc = self.encoding(dsrc)
429
429
                    elif self.encoding is not None: