From 5cae22b665c250935d7a0c3fdd0e583beff08500 Mon Sep 17 00:00:00 2001 From: Shane Evans Date: Fri, 25 Feb 2011 12:55:51 -0200 Subject: [PATCH] add nofollow to Link object --- scrapy/link.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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)