Пример #1
0
    def writeTest(self, varBind, **context):
        name, val = varBind

        # Besides common checks, request row creation on no-instance
        try:
            # First try the instance
            MibScalar.writeTest(self, varBind, **context)

        # ...otherwise proceed with creating new column
        except (error.NoSuchInstanceError, error.RowCreationWanted):
            excValue = sys.exc_info()[1]
            if isinstance(excValue, error.RowCreationWanted):
                self.__rowOpWanted[name] = excValue
            else:
                self.__rowOpWanted[name] = error.RowCreationWanted()
            self.createTest(varBind, **context)

        except error.RowDestructionWanted:
            self.__rowOpWanted[name] = error.RowDestructionWanted()
            self.destroyTest(varBind, **context)

        if name in self.__rowOpWanted:
            debug.logger & debug.flagIns and debug.logger(
                '%s flagged by %s=%r, exception %s' % (self.__rowOpWanted[name], name, val, sys.exc_info()[1]))
            raise self.__rowOpWanted[name]
Пример #2
0
 def writeTest(self, name, val, idx, acInfo):
     # Besides common checks, request row creation on no-instance
     try:
         # First try the instance
         MibScalar.writeTest(self, name, val, idx, acInfo)
     # ...otherwise proceed with creating new column
     except (error.NoSuchInstanceError, error.RowCreationWanted):
         self.__rowOpWanted[name] = error.RowCreationWanted()
         self.createTest(name, val, idx, acInfo)
     except error.RowDestructionWanted:
         self.__rowOpWanted[name] = error.RowDestructionWanted()
         self.destroyTest(name, val, idx, acInfo)
     if name in self.__rowOpWanted:
         debug.logger & debug.flagIns and debug.logger(
             '%s flagged by %s=%r' % (self.__rowOpWanted[name], name, val))
         raise self.__rowOpWanted[name]
Пример #3
0
        # Set back column instance
        if self.__destroyedInstances.has_key(name):
            self._vars[name] = self.__destroyedInstances[name]
            self._vars[name].destroyUndo(name, val, idx, (acFun, acCtx))
            del self.__destroyedInstances[name]

    # Set/modify column

    def writeTest(self, name, val, idx, (acFun, acCtx)):
        # Besides common checks, request row creation on no-instance
        try:
            # First try the instance
            MibScalar.writeTest(self, name, val, idx, (acFun, acCtx))
        # ...otherwise proceed with creating new column
        except (error.NoSuchObjectError, error.RowCreationWanted):
            self.__rowOpWanted[name] = error.RowCreationWanted()
            self.createTest(name, val, idx, (acFun, acCtx))
        except error.RowDestructionWanted:
            self.__rowOpWanted[name] = error.RowDestructionWanted()
            self.destroyTest(name, val, idx, (acFun, acCtx))
        if self.__rowOpWanted.has_key(name):
            debug.logger & debug.flagIns and debug.logger(
                '%s flagged by %s=%s' % (self.__rowOpWanted[name], name, val))
            raise self.__rowOpWanted[name]

    def __delegateWrite(self, subAction, name, val, idx, (acFun, acCtx)):
        if not self.__rowOpWanted.has_key(name):
            getattr(MibScalar, 'write' + subAction)(self, name, val, idx,
                                                    (acFun, acCtx))
            return
        if isinstance(self.__rowOpWanted[name], error.RowCreationWanted):