Skip to content
This repository was archived by the owner on Aug 9, 2019. It is now read-only.

Commit

Permalink
CrawlerIsNotInstanceOfBaseCrawler -> CrawlerIsNotInstanceOfBase
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Martín committed Mar 15, 2013
1 parent 67c0feb commit d086b47
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions datCrawl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datCrawl.exceptions import CrawlerDontHaveUrlsToWatch, \
CrawlerIsNotInstanceOfBaseCrawler, CrawlerForThisURLNotFound, \
NoCrawlerRegistered, CrawlerAlreadyRegistered
CrawlerIsNotInstanceOfBase, CrawlerForThisURLNotFound, \
from datCrawl.crawlers import Crawler
import re

Expand All @@ -24,12 +25,12 @@ def register_crawler(self, crawler):
else:
raise CrawlerDontHaveUrlsToWatch('Crawler %s dont have URLs to watch for.' % class_name)
else:
raise CrawlerIsNotInstanceOfBaseCrawler('Crawler %s is not correctly created. (must be instance of base Crawler class)' % class_name)
raise CrawlerIsNotInstanceOfBase('Crawler %s is not correctly created. (must be instance of base Crawler class)' % class_name)
else:
raise CrawlerAlreadyRegistered("Crawler %s is already registered." % class_name)

def register_url(self, url, action, crawler):
"Registers a certain URL to work with a crawler"
"Registers a certain URL to work with a crawler."
self.urls.append((url, action, crawler))

def autoregister_crawlers():
Expand Down
7 changes: 6 additions & 1 deletion datCrawl/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
class CrawlerIsNotInstanceOfBaseCrawler(Exception):
class CrawlerIsNotInstanceOfBase(Exception):
"Class is not instance of the base crawler."
pass


class DownloaderIsNotInstanceOfBase(Exception):
"Class is not instance of the base downloader."
pass


class CrawlerDontHaveUrlsToWatch(Exception):
"Crawler class have the -urls- parameter empty."
pass
Expand Down
2 changes: 1 addition & 1 deletion test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_register_crawler_without_urls(self):

def test_register_incorrect_crawler(self):
core = datCrawl()
self.assertRaises(CrawlerIsNotInstanceOfBaseCrawler, lambda: core.register_crawler(object))
self.assertRaises(CrawlerIsNotInstanceOfBase, lambda: core.register_crawler(object))

def test_running_without_registered_crawlers(self):
core = datCrawl()
Expand Down

0 comments on commit d086b47

Please sign in to comment.