Logo Search packages:      
Sourcecode: harvestman version File versions  Download package

def HarvestMan::urlparser::HarvestManUrlParser::manage_content_type (   self,
  content_type 
)

This function gets called from connector modules
connect method, after retrieving information about
a url. This function can manage the content type of
the url object if there are any differences between
the assumed type and the returned type 

Definition at line 972 of file urlparser.py.

00972                                                :
        """ This function gets called from connector modules
        connect method, after retrieving information about
        a url. This function can manage the content type of
        the url object if there are any differences between
        the assumed type and the returned type """

        # Guess extension of type
        extn = mimetypes.guess_extension(content_type)
        if extn:
            if extn in self.webpage_extns:
                self.typ = 'webpage'
            elif extn in self.image_extns:
                self.typ = 'image'
            elif extn in self.stylesheet_extns:
                self.typ = 'stylesheet'
            else:
                self.typ = 'file'
        else:
            # Do some generic tests
            klass, typ = content_type.split('/')
            if klass == 'image':
                self.typ = 'image'
            elif typ == 'html':
                self.typ = 'webpage'

    # ============ End - Set Methods =========== #


Generated by  Doxygen 1.6.0   Back to index