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): ...@@ -136,8 +136,11 @@ class Textbook(object):
return table_of_contents return table_of_contents
def __eq__(self, other): def __eq__(self, other):
try:
return (self.title == other.title and return (self.title == other.title and
self.book_url == other.book_url) self.book_url == other.book_url)
except AttributeError:
return False
def __ne__(self, other): def __ne__(self, other):
return not 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