~vorlon/ubuntu/saucy/gourmet/trunk

« back to all changes in this revision

Viewing changes to src/lib/importers/html_importer.py

  • Committer: Bazaar Package Importer
  • Author(s): Rolf Leggewie
  • Date: 2008-11-24 10:38:57 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081124103857-7ds1eemlqjpxhj2n
Tags: 0.14.2-1
* new upstream release
* add manpage, courtesy of François Wendling.  (Closes: #495796).
* add 06-change-sys-path-append.patch
  sys.path.append('/usr/share') can be dangerous

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
import importer
3
3
import BeautifulSoup
4
4
import socket
5
 
from html_plugins import *
6
5
from gourmet.gdebug import *
7
6
from gettext import gettext as _
8
7
import traceback
370
369
        return bss.scrape_url(url,progress=progress)
371
370
 
372
371
def add_to_fn (fn):
 
372
    '''Add 1 to a filename.'''
373
373
    f,e=os.path.splitext(fn)
374
374
    try:
375
375
        f,n=os.path.splitext(f)
413
413
        ofi.close()
414
414
        return [fn]
415
415
 
416
 
class WebPageImporter (importer.importer):
 
416
class WebPageImporter (importer.Importer):
417
417
    """Import a webpage as a recipe
418
418
 
419
419
    We use our BeautifulSoupScraper class to do the actual scraping.
437
437
        self.url = url
438
438
        self.prog = prog
439
439
        self.interactive = interactive
440
 
        importer.importer.__init__(self,rd,threaded=threaded,total=total,prog=prog,do_markup=True,
 
440
        importer.Importer.__init__(self,rd,threaded=threaded,total=total,prog=prog,do_markup=True,
441
441
                                   conv=conv)
442
442
 
443
443
    def run (self):
564
564
        #print 'COMMITTING RECIPE',self.rec
565
565
        self.commit_rec()
566
566
        if self.prog: self.prog(1,_('Import complete.'))
567