def setValueSlot(self, newValue): logging.info("Setting %s %s", str(self), newValue) if not self.keyspace.loaded: if SynchronousPropertyAccess.SynchronousPropertyAccess.getCurrent() is not None: self.keyspace.waitLoaded() else: logging.info("raising NotLoadedException for %s", self) raise NotLoadedException(self.keyspace) if newValue is None: SharedStateSynchronizer.getSynchronizer().writeValue( self.keyspace.keyspaceName, self.keyName, None ) else: assert isinstance(newValue, tuple) assert len(newValue) == 1 try: SharedStateSynchronizer.getSynchronizer().writeValue( self.keyspace.keyspaceName, self.keyName, JsonPickle.toJson(newValue[0]) ) except Exception as e: logging.error("%s", traceback.format_exc()) raise self.value_ = newValue
def setValueSlot(self, newValue): logging.info("Setting %s %s", str(self), newValue) if not self.keyspace.loaded: if SynchronousPropertyAccess.SynchronousPropertyAccess.getCurrent( ) is not None: self.keyspace.waitLoaded() else: logging.info("raising NotLoadedException for %s", self) raise NotLoadedException(self.keyspace) if newValue is None: SharedStateSynchronizer.getSynchronizer().writeValue( self.keyspace.keyspaceName, self.keyName, None) else: assert isinstance(newValue, tuple) assert len(newValue) == 1 try: SharedStateSynchronizer.getSynchronizer().writeValue( self.keyspace.keyspaceName, self.keyName, JsonPickle.toJson(newValue[0])) except Exception as e: logging.error("%s", traceback.format_exc()) raise self.value_ = newValue
def keyPathToKeyName(path): return NativeJson.Json(('CGSS', JsonPickle.toJson(path)))
def keyName(self): return NativeJson.Json(('CGSS',JsonPickle.toJson(self.keyPath)))
def keyName(self): return NativeJson.Json(('CGSS', JsonPickle.toJson(self.keyPath)))
def assertPicklable(self, something): simple = JsonPickle.toJson(something) something2 = JsonPickle.fromJson(simple) self.assertIdentical(something, something2)
def updateValueInSharedState(self, key, view): view[key] = JsonPickle.toJson(self.keyValue)