Exemplo n.º 1
0
 def add(self, obj):
     """ will store the new one in object tree """
     travp = self.context
     # store obj id for nextURL()
     self._newObjectID = obj.objectID
     while IPagelet.providedBy(travp):
         travp = self.context.__parent__
     travp[obj.objectID] = obj
     return obj
Exemplo n.º 2
0
 def add(self, obj):
     """ will store the new one in object tree """
     travp = self.context
     # store obj id for nextURL()
     self._newObjectID = obj.objectID
     while IPagelet.providedBy(travp):
         travp = self.context.__parent__
     travp[obj.objectID] = obj
     if hasattr(obj, "store_refs"):
         obj.store_refs(**self.newdata)
     # workaround for gocept.objectquery
     #import transaction
     #transaction.savepoint()
     return obj
Exemplo n.º 3
0
    def add(self, objList):
        """ will store the new one in object tree """
        print "SnmpScanWizardForm.add(%s)" % True  #objList
        for obj in objList:
            travp = self.context
            # store obj id for nextURL()
            self._newObjectID = obj.objectID
            while IPagelet.providedBy(travp):
                travp = self.context.__parent__
            travp[obj.ikName] = obj
            from org.ict_ok.components.snmpvalue.snmpvalue import SnmpValue
            #from org.ict_ok.components.superclass.interfaces import IBrwsOverview
            #from zope.app.keyreference.interfaces import IKeyReference
            #from zope.interface import directlyProvides
            #newSnmpvalue = zapi.createObject(\
            #u'org.ict_ok.components.snmpvalue.snmpvalue.SnmpValue')
            #notify(ObjectCreatedEvent(newSnmpvalue))
            #newSnmpvalueDc = IZopeDublinCore(newSnmpvalue, None)
            #newSnmpvalueDc.title = u"%s" % "ddd"
            #newSnmpvalueDc.created = datetime.utcnow()
            #oid1 = SnmpOidValid(
            #oid2 = SnmpOidValid(
            #cmd = Choice(
            #inpMultiplier = Float(
            #inptype = Choice(
            #inpUnit = Choice(
            #displayUnitNumerator = Choice(
            #displayUnitDenominator = Choice(
            #checkMax = Bool(
            #checkMaxLevel = Int(
            #checkMaxLevelUnitNumerator = Choice(
            #checkMaxLevelUnitDenominator = Choice(
            #snmpIndexType = Choice(

            #newSnmpvalue.__post_init__()
            #newSnmpvalue = zapi.createObject(\
            #u'org.ict_ok.components.snmpvalue.snmpvalue.SnmpValue')
            ###directlyProvides(newSnmpvalue, IKeyReference)
            #notify(ObjectCreatedEvent(newSnmpvalue))
            data_old = {
                'ikName': u"ddd314",
                'checktype': u"oid",
                'oid1': u"1.3.6.1.2.1.1.1.0",
                'oid2': u"1.3.6.1.2.1.1.1.0",
                'cmd': u"none",
                'inpMultiplier': 1.0,
                'inptype': u"cnt",
                'inpUnit': u"byte",
                'displayUnitNumerator': u"Mbit",
                'displayUnitDenominator': u"1",
                'checkMax': False,
                'checkMaxLevel': 100000,
                'checkMaxLevelUnitNumerator': u"bit",
                'checkMaxLevelUnitDenominator': u"1",
                'snmpIndexType': u"index"
            }
            data = {
                'checktype': u"address",
                'snmpIndexType': u"index",
                'inp_addrs': [u"1"],
                'cmd': u"none",
                'inptype': u"cnt",
                'displayMinMax': True,
                'checkMax': False,
                'inpQuantity': u"8.0 bit",
                'displUnitAbs': u"b",
                'displUnitVelocity': u"",
                'displUnitAcceleration': None,
                'minQuantityAbs': None,
                'minQuantityVelocity': None,
                'minQuantityAcceleration': None,
                'maxQuantityAbs': None,
                'maxQuantityVelocity': None,
                'maxQuantityAcceleration': None,
            }
            #newSnmpvalue = SnmpValue(**data)
            #newSnmpvalueDc = IZopeDublinCore(newSnmpvalue, None)
            #newSnmpvalueDc.title = u"%s" % "ddd"
            #newSnmpvalueDc.created = datetime.utcnow()
            #IBrwsOverview(newSnmpvalue).setTitle(data['ikName'])
            #newSnmpvalue.__post_init__()
            ## -------------------------------
            ##newInterface.__setitem__(u"ddd", newSnmpvalue)
            #obj.__setitem__(u"ddd", newSnmpvalue)
        ###return objList
        ###travp = self.context
        #### store obj id for nextURL()
        ###self._newObjectID = obj.objectID
        ###while IPagelet.providedBy(travp):
        ###travp = self.context.__parent__
        ###travp[obj.objectID] = obj
        return objList