Commit 9bddb771 by Jonathan Piacenti

Textbook equality operator should not crash if compared object isn't a textbook.

parent 51709429
......@@ -136,8 +136,11 @@ class Textbook(object):
return table_of_contents
def __eq__(self, other):
return (self.title == other.title and
self.book_url == other.book_url)
try:
return (self.title == other.title and
self.book_url == other.book_url)
except AttributeError:
return False
def __ne__(self, other):
return not self == other
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment