def resources(self): files = [] anchors = self.find_links_in_content(self.markup) for anchor in anchors: resource = Resource(anchor.getText(), anchor.get('href'), self.web, "http://elearning.uni-heidelberg.de/mod/resource/") if resource.url == '' or resource.isOnExternalWebsite(): continue try: if resource.isAPage(): content = resource.load() f = Page(content, self.web).resources() files.append(f) else: files.append(resource) except urllib2.HTTPError as e: debug("Could not retrieve %s." % resource.url) continue return deflate(files)
def test_should_target_external_website(self): name = "A" url = "http://cessor.de" resource = Resource(name, url, None) self.assertTrue(resource.isOnExternalWebsite())