commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7287 - in trunk/gnue-common/src: definitions logic schema schema


From: johannes
Subject: [gnue] r7287 - in trunk/gnue-common/src: definitions logic schema schema/scripter
Date: Fri, 1 Apr 2005 08:15:16 -0600 (CST)

Author: johannes
Date: 2005-04-01 08:15:15 -0600 (Fri, 01 Apr 2005)
New Revision: 7287

Modified:
   trunk/gnue-common/src/definitions/GObjects.py
   trunk/gnue-common/src/definitions/GParserHelpers.py
   trunk/gnue-common/src/logic/GFormula.py
   trunk/gnue-common/src/logic/GTrigger.py
   trunk/gnue-common/src/logic/NamespaceCore.py
   trunk/gnue-common/src/schema/Objects.py
   trunk/gnue-common/src/schema/scripter/Scripter.py
Log:
Replaced direct access to _parent by getParent () and setParent ()


Modified: trunk/gnue-common/src/definitions/GObjects.py
===================================================================
--- trunk/gnue-common/src/definitions/GObjects.py       2005-04-01 14:14:34 UTC 
(rev 7286)
+++ trunk/gnue-common/src/definitions/GObjects.py       2005-04-01 14:15:15 UTC 
(rev 7287)
@@ -71,15 +71,7 @@
     """
     self.phaseInit(self.buildObject(**params))
 
-  def getParent(self):
-    """
-    Returns the immediate parent of an object instance in a GObj tree.
 
-    @return: The parent of the object in the GObj tree.
-    @rtype: any
-    """
-    return self._parent
-
   #
   # phaseInit
   #

Modified: trunk/gnue-common/src/definitions/GParserHelpers.py
===================================================================
--- trunk/gnue-common/src/definitions/GParserHelpers.py 2005-04-01 14:14:34 UTC 
(rev 7286)
+++ trunk/gnue-common/src/definitions/GParserHelpers.py 2005-04-01 14:15:15 UTC 
(rev 7287)
@@ -71,6 +71,35 @@
     del self._inits [:]
 
 
+  # ---------------------------------------------------------------------------
+  # Return the parent instance of an object in a GObj tree
+  # ---------------------------------------------------------------------------
+
+  def getParent (self):
+    """
+    Returns the immediate parent of an object instance in a GObj tree.
+
+    @return: The parent of the object in the GObj tree.
+    @rtype: any
+    """
+
+    return self._parent
+
+
+  # ---------------------------------------------------------------------------
+  # Set the parent of an object in a GObj tree
+  # ---------------------------------------------------------------------------
+
+  def setParent (self, newParent):
+    """
+    Set the immediate parent of an object instance in a GObj tree
+
+    @param newParent: instance to be set as parent
+    """
+
+    self._parent = newParent
+
+
 #
 # Class GContent
 #

Modified: trunk/gnue-common/src/logic/GFormula.py
===================================================================
--- trunk/gnue-common/src/logic/GFormula.py     2005-04-01 14:14:34 UTC (rev 
7286)
+++ trunk/gnue-common/src/logic/GFormula.py     2005-04-01 14:15:15 UTC (rev 
7287)
@@ -104,9 +104,9 @@
     self.__call__ = self.dummyFunction
 
     if self.type != "NAMED":
-      if self._parent:
-        self._parent.associateTrigger( self.type, self )
-        self._triggerns.update(self._parent._localTriggerNamespace)
+      if self.getParent ():
+        self.getParent ().associateTrigger (self.type, self)
+        self._triggerns.update(self.getParent ()._localTriggerNamespace)
     else:
       self._root._triggerDictionary[self.name] = self
       self._triggerns.update(self._root._localTriggerNamespace)

Modified: trunk/gnue-common/src/logic/GTrigger.py
===================================================================
--- trunk/gnue-common/src/logic/GTrigger.py     2005-04-01 14:14:34 UTC (rev 
7286)
+++ trunk/gnue-common/src/logic/GTrigger.py     2005-04-01 14:15:15 UTC (rev 
7287)
@@ -103,9 +103,9 @@
     self.__call__ = self.dummyFunction
 
     if self.type != "NAMED":
-      if self._parent:
-        self._parent.associateTrigger( self.type, self )
-        self._triggerns.update(self._parent._localTriggerNamespace)
+      if self.getParent ():
+        self.getParent ().associateTrigger (self.type, self)
+        self._triggerns.update (self.getParent ()._localTriggerNamespace)
     else:
       self._root._triggerDictionary[self.name] = self
       self._triggerns.update(self._root._localTriggerNamespace)
@@ -165,7 +165,7 @@
       if p._triggerGlobal == 1:
         p=None
       else:
-        p=p._parent
+        p=p.getParent ()
 
     method = cx.buildFunction (path, self._text)
     self.__call__ = method

Modified: trunk/gnue-common/src/logic/NamespaceCore.py
===================================================================
--- trunk/gnue-common/src/logic/NamespaceCore.py        2005-04-01 14:14:34 UTC 
(rev 7286)
+++ trunk/gnue-common/src/logic/NamespaceCore.py        2005-04-01 14:15:15 UTC 
(rev 7287)
@@ -142,6 +142,8 @@
 class NamespaceElement(GObj):
   def __init__(self, parent):
     GObj.__init__(self,parent)
+    # TODO: Check wether this _parent attribute is really needed, since it
+    # should be a weak reference (or replaced by getParent ())
     self.__dict__['_parent'] = parent
     self._triggerProperties = NamespaceElementProperties()
     self._triggerSet = None

Modified: trunk/gnue-common/src/schema/Objects.py
===================================================================
--- trunk/gnue-common/src/schema/Objects.py     2005-04-01 14:14:34 UTC (rev 
7286)
+++ trunk/gnue-common/src/schema/Objects.py     2005-04-01 14:15:15 UTC (rev 
7287)
@@ -349,9 +349,10 @@
     """
     This function get's the objects index in it's parents child-collection
     """
-    if self._parent is not None:
-      for index in range (0, len (self._parent._children)):
-        if self._parent._children [index] == self:
+    parent = self.getParent ()
+    if parent is not None:
+      for index in range (0, len (parent._children)):
+        if parent._children [index] == self:
           return index
 
     raise errors.ApplicationError, \
@@ -431,9 +432,9 @@
 
 def setErrorFlag (aObject):
   """
-  This function sets the property 'foundErrors' in a object and all its
+  This function sets the property 'foundErrors' in an object and all its
   parents.
   """
   if aObject is not None:
     aObject.foundErrors = True
-    setErrorFlag (aObject._parent)
+    setErrorFlag (aObject.getParent ())

Modified: trunk/gnue-common/src/schema/scripter/Scripter.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/Scripter.py   2005-04-01 14:14:34 UTC 
(rev 7286)
+++ trunk/gnue-common/src/schema/scripter/Scripter.py   2005-04-01 14:15:15 UTC 
(rev 7287)
@@ -777,8 +777,8 @@
     source = GDataSource.DataSourceWrapper (connections = self.connections,
         attributes = {'name'    : "dts_%s" % table ['name'],
                       'database': self.OPTIONS ['connection'],
-                      'table'   : table ['name'],
-                      'primarykey': ",".join (keyFields)},
+                      'table'   : table ['name']},
+                      #'primarykey': ",".join (keyFields)},
         fields      = fieldList,
         unicodeMode = True)
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]