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

def HarvestMan::rules::harvestManRulesChecker::is_under_starting_directory (   self,
  urlObj 
)

Check whether the url in the url object belongs
to the same directory as the starting url for the
project 

Definition at line 450 of file rules.py.

00450                                                  :
        """ Check whether the url in the url object belongs
        to the same directory as the starting url for the
        project """

        directory = urlObj.get_url_directory()
        # Get the tracker queue object
        tq = GetObject('trackerqueue')
        baseUrlObj = tq.get_base_urlobject()
        if not baseUrlObj:
            return True

        bdir = baseUrlObj.get_url_directory()

        # Look for bdir inside dir
        index = directory.find(bdir)

        if index == 0:
            return True

        # Sometimes a simple string match
        # is not good enough. May be both
        # the directories are the same but
        # the server names are slightly different
        # ex: www-106.ibm.com and www.ibm.com
        # for developerworks links.

        # Check if both of them are in the same
        # domain
        if self.__compare_domains(urlObj.get_domain(), baseUrlObj.get_domain()):
            # Get url directory sans domain
            directory = urlObj.get_url_directory_sans_domain()
            bdir = baseUrlObj.get_url_directory_sans_domain()

            # Check again
            if directory.find(bdir) == 0:
                return True

        return False
            


Generated by  Doxygen 1.6.0   Back to index