Browse Source

Change so generate is called before set location (since generate will cause reparenting at the OTP level which will invalidate any parenting done in setLocation)

Justin Butler 21 years ago
parent
commit
0e2fd05bae
1 changed files with 10 additions and 10 deletions
  1. 10 10
      direct/src/distributed/ClientRepository.py

+ 10 - 10
direct/src/distributed/ClientRepository.py

@@ -338,9 +338,9 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
             # Just update it.
             # Just update it.
             distObj = self.doId2do[doId]
             distObj = self.doId2do[doId]
             assert(distObj.dclass == dclass)
             assert(distObj.dclass == dclass)
+            distObj.generate()
             if wantOtpServer:
             if wantOtpServer:
                 distObj.setLocation(parentId, zoneId)
                 distObj.setLocation(parentId, zoneId)
-            distObj.generate()
             distObj.updateRequiredFields(dclass, di)
             distObj.updateRequiredFields(dclass, di)
             # updateRequiredFields calls announceGenerate
             # updateRequiredFields calls announceGenerate
         elif self.cache.contains(doId):
         elif self.cache.contains(doId):
@@ -351,9 +351,9 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
             # put it in the dictionary:
             # put it in the dictionary:
             self.doId2do[doId] = distObj
             self.doId2do[doId] = distObj
             # and update it.
             # and update it.
+            distObj.generate()
             if wantOtpServer:
             if wantOtpServer:
                 distObj.setLocation(parentId, zoneId)
                 distObj.setLocation(parentId, zoneId)
-            distObj.generate()
             distObj.updateRequiredFields(dclass, di)
             distObj.updateRequiredFields(dclass, di)
             # updateRequiredFields calls announceGenerate
             # updateRequiredFields calls announceGenerate
         else:
         else:
@@ -369,10 +369,10 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
             # Put the new do in the dictionary
             # Put the new do in the dictionary
             self.doId2do[doId] = distObj
             self.doId2do[doId] = distObj
             # Update the required fields
             # Update the required fields
-            if wantOtpServer:
-                distObj.setLocation(parentId, zoneId)
             distObj.generateInit()  # Only called when constructed
             distObj.generateInit()  # Only called when constructed
             distObj.generate()
             distObj.generate()
+            if wantOtpServer:
+                distObj.setLocation(parentId, zoneId)
             distObj.updateRequiredFields(dclass, di)
             distObj.updateRequiredFields(dclass, di)
             # updateRequiredFields calls announceGenerate
             # updateRequiredFields calls announceGenerate
             if wantOtpServer:
             if wantOtpServer:
@@ -396,13 +396,13 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
         # Put the new do in the dictionary
         # Put the new do in the dictionary
         self.doId2do[doId] = distObj
         self.doId2do[doId] = distObj
         # Update the required fields
         # Update the required fields
+        distObj.generateInit()  # Only called when constructed
+        distObj.generate()
         if wantOtpServer:
         if wantOtpServer:
             # TODO: ROGER: where should we get parentId and zoneId?
             # TODO: ROGER: where should we get parentId and zoneId?
             parentId = None
             parentId = None
             zoneId = None
             zoneId = None
             distObj.setLocation(parentId, zoneId)
             distObj.setLocation(parentId, zoneId)
-        distObj.generateInit()  # Only called when constructed
-        distObj.generate()
         # updateRequiredFields calls announceGenerate
         # updateRequiredFields calls announceGenerate
         return  distObj
         return  distObj
 
 
@@ -412,9 +412,9 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
             # Just update it.
             # Just update it.
             distObj = self.doId2do[doId]
             distObj = self.doId2do[doId]
             assert(distObj.dclass == dclass)
             assert(distObj.dclass == dclass)
+            distObj.generate()
             if wantOtpServer:
             if wantOtpServer:
                 distObj.setLocation(parentId, zoneId)
                 distObj.setLocation(parentId, zoneId)
-            distObj.generate()
             distObj.updateRequiredOtherFields(dclass, di)
             distObj.updateRequiredOtherFields(dclass, di)
             # updateRequiredOtherFields calls announceGenerate
             # updateRequiredOtherFields calls announceGenerate
         elif self.cache.contains(doId):
         elif self.cache.contains(doId):
@@ -425,9 +425,9 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
             # put it in the dictionary:
             # put it in the dictionary:
             self.doId2do[doId] = distObj
             self.doId2do[doId] = distObj
             # and update it.
             # and update it.
+            distObj.generate()
             if wantOtpServer:
             if wantOtpServer:
                 distObj.setLocation(parentId, zoneId)
                 distObj.setLocation(parentId, zoneId)
-            distObj.generate()
             distObj.updateRequiredOtherFields(dclass, di)
             distObj.updateRequiredOtherFields(dclass, di)
             # updateRequiredOtherFields calls announceGenerate
             # updateRequiredOtherFields calls announceGenerate
         else:
         else:
@@ -443,10 +443,10 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
             # Put the new do in the dictionary
             # Put the new do in the dictionary
             self.doId2do[doId] = distObj
             self.doId2do[doId] = distObj
             # Update the required fields
             # Update the required fields
-            if wantOtpServer:
-                distObj.setLocation(parentId, zoneId)
             distObj.generateInit()  # Only called when constructed
             distObj.generateInit()  # Only called when constructed
             distObj.generate()
             distObj.generate()
+            if wantOtpServer:
+                distObj.setLocation(parentId, zoneId)
             distObj.updateRequiredOtherFields(dclass, di)
             distObj.updateRequiredOtherFields(dclass, di)
             # updateRequiredOtherFields calls announceGenerate
             # updateRequiredOtherFields calls announceGenerate
         return distObj
         return distObj