コード例 #1
0
    def VIEW_REBIND(self, varname, rebinding_str):
        """
        Rebind a view.
        """
        try:
            rebindings = self._rebindings(rebinding_str)
            rebound = self.probe_loader.lookup(varname, *rebindings)
            msg = simplejson.dumps(rebound.to_basic())
        except StandardError, exc:
#            reply(failure_reply(str(exc)))
            from simx.act.context import R
            R.reply(failure_reply(exc.message))
コード例 #2
0
    def _rebindings(self, rebinding_str):
        """
        Returns split replacements strings or None.
        """
        pairs = [pok for pok
                 in (p.strip() for p in rebinding_str.split(","))
                 if pok]
        rebindings = [p.split("=") for p in pairs]
        #print "pairs****", pairs
        #print "rebindings****", rebindings
        try:
            # don't actually do anything, but will throw an exception
            # if an invalid assignment occurs
            for (a, b) in rebindings:
                pass
        except:
#            raise ValueError("Invalid replacement: %s" % rebinding_str)
            reply = failure_reply("Invalid replacement: %s" % rebinding_str)
            from simx.act.context import R
            R.reply(reply)
        else:
            return rebindings
コード例 #3
0
 def ATTACH_NODE(self, probe_id, node_id):
     try:
         self.attach_node(probe_id, node_id)
     except StandardError, exc:
         reply(failure_reply(exc.message))