Beispiel #1
0
    def __init__(self, links, host):
        """Initialization.

        links: set of available local files
        host: full path to remote host"""
        MyParser.__init__(self)
        self.local_links = links
        self.remote_host = host
        self.reset()
Beispiel #2
0
    def __init__(self, links, host):
        """Initialization.

        links: set of available local files
        host: full path to remote host"""
        MyParser.__init__(self)
        self.local_links = links
        self.remote_host = host
        self.reset()
Beispiel #3
0
    def handle_starttag(self, tag, attrs):
        """Overidden - Parse links and convert them.

        <a> and <img> tags are looked for links."""
        # Special case 1: links
        if tag == 'a':
            for index, attr in enumerate(attrs):
                if attr[0] == 'href':
                    attrs[index] = attr[0], self.__fix_link__(attr[1])
                    break
        # Special case 2: images
        elif tag == 'img':
            for index, attr in enumerate(attrs):
                if attr[0] == 'src':
                    attrs[index] = attr[0], self.__fix_link__(attr[1])
                    break

        MyParser.handle_starttag(self, tag, attrs)
Beispiel #4
0
    def handle_starttag(self, tag, attrs):
        """Overidden - Parse links and convert them.

        <a> and <img> tags are looked for links."""
        # Special case 1: links
        if tag == 'a':
            for index, attr in enumerate(attrs):
                if attr[0] == 'href':
                    attrs[index] = attr[0], self.__fix_link__(attr[1])
                    break
        # Special case 2: images
        elif tag == 'img':
            for index, attr in enumerate(attrs):
                if attr[0] == 'src':
                    attrs[index] = attr[0], self.__fix_link__(attr[1])
                    break

        MyParser.handle_starttag(self, tag, attrs)
Beispiel #5
0
 def reset(self):
     MyParser.reset(self)
     self.local_set = set()      # Set of local links
     self.remote_set = set()     # Set of remote links
Beispiel #6
0
 def reset(self):
     MyParser.reset(self)
     self.local_set = set()  # Set of local links
     self.remote_set = set()  # Set of remote links