Exemple #1
0
 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)
    def afterSetUp(self):
        """
        Test ZenPropertyManager subclass that does not acquire a dmd
        attribute.
        """
        super(RelationshipManagerTest, self).afterSetUp()

        self.manager = RelationshipManager('manager')
    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
 def __init__(self, id, title=None, buildRelations=True):
     self.createdTime = DateTime(time.time())
     RelationshipManager.__init__(self, id, title, buildRelations)
Exemple #5
0
 def __init__(self, id, title=None, buildRelations=True):
     self.createdTime = DateTime(time.time())
     RelationshipManager.__init__(self, id, title, buildRelations)