diff --git a/scrapy/link.py b/scrapy/link.py index 371a987cb..e4a25784a 100644 --- a/scrapy/link.py +++ b/scrapy/link.py @@ -10,18 +10,19 @@ class Link(object): At the moment, it contains just the url and link text. """ - __slots__ = ['url', 'text'] + __slots__ = ['url', 'text', 'nofollow'] - def __init__(self, url, text=''): + def __init__(self, url, text='', nofollow=False): self.url = url self.text = text + self.nofollow = nofollow def __eq__(self, other): - return self.url == other.url and self.text == other.text - + return self.url == other.url and self.text == other.text and self.nofollow == other.nofollow + def __hash__(self): - return hash(self.url) ^ hash(self.text) + return hash(self.url) ^ hash(self.text) ^ hash(self.nofollow) def __repr__(self): - return '' % (self.url, self.text) + return 'Link(url=%r, text=%r, nofollow=%r)' % (self.url, self.text, self.nofollow)