##// END OF EJS Templates
Make traitlets notify check more robust against classes redefining equality and bool...
Jason Grout -
Show More
@@ -372,11 +372,13 b' class TraitType(object):'
372 old_value = self.__get__(obj)
372 old_value = self.__get__(obj)
373 obj._trait_values[self.name] = new_value
373 obj._trait_values[self.name] = new_value
374 try:
374 try:
375 notify = (old_value != new_value)
375 silent = bool(old_value == new_value)
376 except:
376 except:
377 # if there is an error in comparing, default to notify
377 # if there is an error in comparing, default to notify
378 notify = True
378 silent = False
379 if notify:
379 if silent is not True:
380 # we explicitly compare silent to True just in case the equality
381 # comparison above returns something other than True/False
380 obj._notify_trait(self.name, old_value, new_value)
382 obj._notify_trait(self.name, old_value, new_value)
381
383
382 def _validate(self, obj, value):
384 def _validate(self, obj, value):
General Comments 0
You need to be logged in to leave comments. Login now