add nofollow to Link object

This commit is contained in:
Shane Evans 2011-02-25 12:55:51 -02:00
parent cfd11df539
commit 5cae22b665
1 changed files with 7 additions and 6 deletions

View File

@ -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)