##// END OF EJS Templates
Add explicit default to getattr
Matthias Bussonnier -
Show More
@@ -655,7 +655,7 b' class JSON(DisplayObject):'
655 @data.setter
655 @data.setter
656 def data(self, data):
656 def data(self, data):
657 if isinstance(data, str):
657 if isinstance(data, str):
658 if getattr(self, 'filename') is None:
658 if getattr(self, 'filename', None) is None:
659 warnings.warn("JSON expects JSONable dict or list, not JSON strings")
659 warnings.warn("JSON expects JSONable dict or list, not JSON strings")
660 data = json.loads(data)
660 data = json.loads(data)
661 self._data = data
661 self._data = data
@@ -690,7 +690,7 b' class GeoJSON(JSON):'
690 @data.setter
690 @data.setter
691 def data(self, data):
691 def data(self, data):
692 if isinstance(data, str):
692 if isinstance(data, str):
693 if getattr(self, 'filename') is None:
693 if getattr(self, 'filename', None) is None:
694 warnings.warn("GeoJSON expects JSONable dict or list, not JSON strings")
694 warnings.warn("GeoJSON expects JSONable dict or list, not JSON strings")
695 data = json.loads(data)
695 data = json.loads(data)
696 self._data = data
696 self._data = data
General Comments 0
You need to be logged in to leave comments. Login now