Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
def keyPathToKeyName(path):
    return NativeJson.Json(('CGSS', JsonPickle.toJson(path)))
Exemplo n.º 4
0
 def keyName(self):
     return NativeJson.Json(('CGSS',JsonPickle.toJson(self.keyPath)))
Exemplo n.º 5
0
def keyPathToKeyName(path):
    return NativeJson.Json(('CGSS', JsonPickle.toJson(path)))
Exemplo n.º 6
0
 def keyName(self):
     return NativeJson.Json(('CGSS', JsonPickle.toJson(self.keyPath)))
Exemplo n.º 7
0
    def assertPicklable(self, something):
        simple = JsonPickle.toJson(something)
        something2 = JsonPickle.fromJson(simple)

        self.assertIdentical(something, something2)
Exemplo n.º 8
0
    def assertPicklable(self, something):
        simple = JsonPickle.toJson(something)
        something2 = JsonPickle.fromJson(simple)

        self.assertIdentical(something, something2)
Exemplo n.º 9
0
 def updateValueInSharedState(self, key, view):
     view[key] = JsonPickle.toJson(self.keyValue)