コード例 #1
0
ファイル: ZenModelRM.py プロジェクト: zenoss/zenoss-prodbin
 def changePythonClass(self, newPythonClass, container):
     """change the python class of a persistent object"""
     id = self.id
     nobj = newPythonClass(id)  # make new instance from new class
     nobj = nobj.__of__(container)  # make aq_chain same as self
     nobj.oldid = self.id
     nobj.setPrimaryPath()  # set up the primarypath for the copy
     # move all sub objects to new object
     nrelations = self.ZenSchemaManager.getRelations(nobj).keys()
     for sobj in self.objectValues():
         RelationshipManager._delObject(self, sobj.getId())
         if not hasattr(nobj, sobj.id) and sobj.id in nrelations:
             setObject = RelationshipManager._setObject
             setObject(nobj, sobj.id, sobj)
     nobj.buildRelations()  # build out any missing relations
     # copy properties to new object
     noprop = getattr(nobj, 'zNoPropertiesCopy', [])
     for name in nobj.getPropertyNames():
         if (
             getattr(self, name, None)
             and name not in noprop
             and hasattr(nobj, "_updateProperty")
         ):
             val = getattr(self, name)
             nobj._updateProperty(name, val)
     return aq_base(nobj)
コード例 #2
0
    def afterSetUp(self):
        """
        Test ZenPropertyManager subclass that does not acquire a dmd
        attribute.
        """
        super(RelationshipManagerTest, self).afterSetUp()

        self.manager = RelationshipManager('manager')
コード例 #3
0
    def afterSetUp(self):
        """
        Test getting the transformers dictionary from the well-known dmd
        location.
        """
        super(TransformerDmdTest, self).afterSetUp()

        managerId = 'manager'
        self.dmd._setObject(managerId, RelationshipManager(managerId))
        self.manager = self.dmd.manager
コード例 #4
0
ファイル: ZenModelRM.py プロジェクト: damilare/zenoss-prodbin
 def __init__(self, id, title=None, buildRelations=True):
     self.createdTime = DateTime(time.time())
     RelationshipManager.__init__(self, id, title, buildRelations)
コード例 #5
0
ファイル: ZenModelRM.py プロジェクト: c0ns0le/zenoss-4
 def __init__(self, id, title=None, buildRelations=True):
     self.createdTime = DateTime(time.time())
     RelationshipManager.__init__(self, id, title, buildRelations)