Skip to content
Permalink
Browse files
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 6cb97d9ddb7e98fdd00fa4c6011ea5347e25b929
Showing 1 changed file with 8 additions and 2 deletions.
@@ -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):

0 comments on commit 6cb97d9

Please sign in to comment.