mirror of https://github.com/scrapy/scrapy.git
add nofollow to Link object
This commit is contained in:
parent
cfd11df539
commit
5cae22b665
|
|
@ -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 '<Link url=%r text=%r >' % (self.url, self.text)
|
||||
return 'Link(url=%r, text=%r, nofollow=%r)' % (self.url, self.text, self.nofollow)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue