Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow comparing TranslatableSettings to other types
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Oct 29, 2015
1 parent fd4ef54 commit 6cb97d9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nikola/utils.py
Expand Up @@ -431,11 +431,17 @@ def __setitem__(self, key, value):

def __eq__(self, other):
"""Test whether two TranslatableSettings are equal."""
return self.values == other.values
try:
return self.values == other.values
except AttributeError:
return self(self.default_lang) == other

def __ne__(self, other):
"""Test whether two TranslatableSettings are inequal."""
return self.values != other.values
try:
return self.values != other.values
except AttributeError:
return self(self.default_lang) == other


class TemplateHookRegistry(object):
Expand Down

0 comments on commit 6cb97d9

Please sign in to comment.