def setUp(self):
     """Create a nested model for testing"""
     helper.TmpPathTestCase.setUp(self)
     self.nested = NestedModel()
     self.nested_observer = ModelObserver(self.nested)
     path = self.test_path('test.data')
     # save & reconstitute
     serializer.save(self.nested, path)
     self.clone = serializer.load(path)
Ejemplo n.º 2
0
 def settings():
     """Returns the SettingsModel singleton"""
     if not SettingsManager._settings:
         if os.path.exists(SettingsManager._rcfile):
             try:
                 SettingsManager._settings = serializer.load(SettingsManager._rcfile)
             except: # bad json
                 SettingsManager._settings = SettingsModel()
         else:
             SettingsManager._settings = SettingsModel()
     return SettingsManager._settings