Beispiel #1
0
    def set(self, val):
        self.validate(self.getValidator(), val)
        b = self.getThreadBinding()
        if b is not None:
            if currentThread() != b.thread:
                raise IllegalStateException("Can't set!: " + str(self.sym) + " from non-binding thread")
            b.val = val
            return self

        raise IllegalStateException("Can't change/establish root binding " "of: %s with set" % str(self.sym))
Beispiel #2
0
    def set(self, val):
        self.validate(self.getValidator(), val)
        b = self.getThreadBinding()
        if b is not None:
            if currentThread() != b.thread:
                raise IllegalStateException("Can't set!: " + str(self.sym) +
                                            " from non-binding thread")
            b.val = val
            return self

        raise IllegalStateException("Can't change/establish root binding "
                                    "of: %s with set" % str(self.sym))
Beispiel #3
0
def pushThreadBindings(bindings):
    f = dvals.get(lambda: Frame())
    bmap = f.bindings
    for v in bindings:
        value = bindings[v]
        if not v.dynamic:
            raise IllegalStateException("Can't dynamically bind non-dynamic "
                                        "var: " + str(v.ns) + "/" + str(v.sym))
        v.validate(v.getValidator(), value)
        v.threadBound = True
        bmap = bmap.assoc(v, TBox(currentThread(), value))
    dvals.set(Frame(bmap, f))
Beispiel #4
0
def pushThreadBindings(bindings):
    f = dvals.get(lambda: Frame())
    bmap = f.bindings
    for v in bindings:
        value = bindings[v]
        if not v.dynamic:
            raise IllegalStateException("Can't dynamically bind non-dynamic "
                                        "var: " + str(v.ns) + "/"
                                        + str(v.sym))
        v.validate(v.getValidator(), value)
        v.threadBound = True
        bmap = bmap.assoc(v, TBox(currentThread(), value))
    dvals.set(Frame(bmap, f))
Beispiel #5
0
def pushThreadBindings(bindings):
    f = dvals.get(lambda: Frame())
    bmap = f.bindings
    bs = bindings.seq()
    while bs is not None:
        e = bs.first()
        v = e.getKey()
        if not v.dynamic:
            raise IllegalStateException("Can't dynamically bind non-dynamic " "var: " + str(v.ns) + "/" + str(v.sym))
        v.validate(v.getValidator(), e.getValue())
        v.threadBound = True
        bmap = bmap.assoc(v, TBox(currentThread(), e.getValue()))
        bs = bs.next()
    dvals.set(Frame(bmap, f))
Beispiel #6
0
def pushThreadBindings(bindings):
    f = dvals.get(lambda: Frame())
    bmap = f.bindings
    bs = bindings.seq()
    while bs is not None:
        e = bs.first()
        v = e.getKey()
        if not v.dynamic:
            raise IllegalStateException("Can't dynamically bind non-dynamic "
                                        "var: " + str(v.ns) + "/"
                                        + str(v.sym))
        v.validate(v.getValidator(), e.getValue())
        v.threadBound = True
        bmap = bmap.assoc(v, TBox(currentThread(), e.getValue()))
        bs = bs.next()
    dvals.set(Frame(bmap, f))