commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r7289 - in trunk/gnue-appserver/src: . gcd gld language


From: johannes
Subject: [gnue] r7289 - in trunk/gnue-appserver/src: . gcd gld language
Date: Fri, 1 Apr 2005 08:17:54 -0600 (CST)

Author: johannes
Date: 2005-04-01 08:17:52 -0600 (Fri, 01 Apr 2005)
New Revision: 7289

Modified:
   trunk/gnue-appserver/src/data.py
   trunk/gnue-appserver/src/gcd/GCParser.py
   trunk/gnue-appserver/src/gcd/readgcd.py
   trunk/gnue-appserver/src/geasGsdGen.py
   trunk/gnue-appserver/src/geasList.py
   trunk/gnue-appserver/src/geasSession.py
   trunk/gnue-appserver/src/gld/GLParser.py
   trunk/gnue-appserver/src/language/ObjectList.py
Log:
Use new buildCondition (); don't die on inserting data to fish-hook-classes, 
use getParent () and setParent () instead of _parent


Modified: trunk/gnue-appserver/src/data.py
===================================================================
--- trunk/gnue-appserver/src/data.py    2005-04-01 14:16:12 UTC (rev 7288)
+++ trunk/gnue-appserver/src/data.py    2005-04-01 14:17:52 UTC (rev 7289)
@@ -530,7 +530,7 @@
 def _createResultSet (connections, database, content, conditions, order):
 
   datasource = _createDatasource (connections, database, content, order)
-  condition  = _conditionTree (conditions)
+  condition  = GConditions.buildCondition (conditions)
   try:
     return datasource.createResultSet (condition)
 
@@ -541,24 +541,6 @@
       condition.breakReferences ()
 
 
-# -----------------------------------------------------------------------------
-# Create a condition tree of a given condition
-# -----------------------------------------------------------------------------
-
-def _conditionTree (conditions):
-
-  if isinstance (conditions, ListType):
-    cTree = GConditions.buildTreeFromList (conditions)
-
-  elif isinstance (conditions, DictType):
-    cTree = GConditions.buildConditionFromDict (conditions)
-
-  else:
-    cTree = conditions
-
-  return cTree
-
-
 # =============================================================================
 # Session class
 # =============================================================================
@@ -653,7 +635,7 @@
       for fields_element in fields: checktype (fields_element, UnicodeType)
 
     return recordset (self.__cache, self.__connections, self.__database,
-                      content, _conditionTree (conditions), order)
+                      content, GConditions.buildCondition (conditions), order)
 
 
   # ---------------------------------------------------------------------------
@@ -896,7 +878,7 @@
     for (table, deps) in tables.items ():
       if self.__constraints.has_key (table):
         for constraint in self.__constraints [table].keys ():
-          if tables.has_key (constraint):
+          if constraint != table and tables.has_key (constraint):
             deps.append (constraint)
 
     # Now create an ordered sequence taking care of dependencies

Modified: trunk/gnue-appserver/src/gcd/GCParser.py
===================================================================
--- trunk/gnue-appserver/src/gcd/GCParser.py    2005-04-01 14:16:12 UTC (rev 
7288)
+++ trunk/gnue-appserver/src/gcd/GCParser.py    2005-04-01 14:17:52 UTC (rev 
7289)
@@ -358,10 +358,12 @@
   # ---------------------------------------------------------------------------
 
   def _validate (self):
+    parent = self.getParent ()
+
     if not len (self.name):
       raise MissingNameError, u_("Class has no name")
 
-    if not isinstance (self._parent, GCModule):
+    if not isinstance (parent, GCModule):
       raise NoModuleError, self.name
 
     nameParts = self.name.split ('_')
@@ -372,11 +374,11 @@
       (self.module, self.name) = nameParts [:2]
 
     if not hasattr (self, 'module'):
-      self.module = self._parent.name
+      self.module = parent.name
 
     # if this class is not defined by the top level module, this is just a
     # definition for a class extension
-    if self.module != self._parent.name:
+    if self.module != parent.name:
       self.action = 'extend'
 
     self.fullName = repository.createName (self.module, self.name)
@@ -423,7 +425,7 @@
         proc._children = prop._children
 
         for child in proc._children:
-          child._parent = proc
+          child.setParent (proc)
 
         proc._validate ()
 
@@ -431,7 +433,7 @@
 
         # Release references of the no longer needed property instance (for gc)
         del prop._inits [:]
-        prop._parent = None
+        prop.setParent (None)
 
 
   # ---------------------------------------------------------------------------
@@ -548,7 +550,7 @@
 
   def _complete (self):
     if not '_' in self.name:
-      self.module   = self._parent.module
+      self.module   = self.getParent ().module
       self.fullName = repository.createName (self.module, self.name)
     else:
       self.module   = repository.splitName (self.name) [0]

Modified: trunk/gnue-appserver/src/gcd/readgcd.py
===================================================================
--- trunk/gnue-appserver/src/gcd/readgcd.py     2005-04-01 14:16:12 UTC (rev 
7288)
+++ trunk/gnue-appserver/src/gcd/readgcd.py     2005-04-01 14:17:52 UTC (rev 
7289)
@@ -633,7 +633,8 @@
     @param item: GCProperty instance to add
     """
 
-    classDef = self.schema [item._parent.fullName.lower ()]
+    parent = item.getParent ()
+    classDef = self.schema [parent.fullName.lower ()]
 
     pDef = {'name'    : item.fullName,
             'type'    : item.datatype,
@@ -651,7 +652,7 @@
         classDef ['constraints'] = []
 
       classDef ['constraints'].append ( \
-          {'name'     : "fk_%s_%s" % (item._parent.fullName, item.fullName),
+          {'name'     : "fk_%s_%s" % (parent.fullName, item.fullName),
            'fields'   : [item.fullName],
            'reftable' : item.type,
            'reffields': ['gnue_id']})
@@ -669,12 +670,13 @@
     @param item: GCProperty instance to add
     """
 
-    fqName = "%s.%s" % (item._parent.fullName, item.fullName)
-    pkey   = "%s.%s_%s" % (self.lpClass.get (item._parent.fullName.lower ()),
+    parent = item.getParent ()
+    fqName = "%s.%s" % (parent.fullName, item.fullName)
+    pkey   = "%s.%s_%s" % (self.lpClass.get (parent.fullName.lower ()),
                          self.lpModule.get (item.module.lower ()), item.name)
 
     pDef = {'gnue_id'   : self.lpProperty.get (pkey.lower ()),
-            'gnue_class': item._parent.fullName,
+            'gnue_class': parent.fullName,
             'gnue_type' : item.datatype}
 
     pDef.update (self.__fetchTags (item,
@@ -701,9 +703,10 @@
     @param item: GCProcedure instance to add
     """
 
-    fqName = "%s.%s" % (item._parent.fullName, item.fullName)
+    parent = item.getParent ()
+    fqName = "%s.%s" % (parent.fullName, item.fullName)
     pDef = {'gnue_id'   : None,
-            'gnue_class': item._parent.fullName,
+            'gnue_class': parent.fullName,
             'gnue_type' : item.datatype,
             'gnue_code' : item.getChildrenAsContent ()}
 
@@ -725,7 +728,8 @@
     @param item: GCParameter instance to add
     """
 
-    pName  = "%s.%s" % (self.__currentClass.fullName, item._parent.fullName)
+    parent = item.getParent ()
+    pName  = "%s.%s" % (self.__currentClass.fullName, parent.fullName)
     fqName = "%s.%s" % (pName, item.name)
 
     par = {'gnue_procedure': pName, 'gnue_type': item.datatype}

Modified: trunk/gnue-appserver/src/geasGsdGen.py
===================================================================
--- trunk/gnue-appserver/src/geasGsdGen.py      2005-04-01 14:16:12 UTC (rev 
7288)
+++ trunk/gnue-appserver/src/geasGsdGen.py      2005-04-01 14:17:52 UTC (rev 
7289)
@@ -787,8 +787,8 @@
           dType  = 'field'
           dValue = "%s.%s" % (alias[repository.classes [dstrel].table], 
dstitem)
 
-        c = GConditions.buildTreeFromList ( \
-            ['eq', ['field', sValue], [dType, dValue]])
+        c = GConditions.buildConditionFromPrefix ( \
+                                    ['eq', ['field', sValue], [dType, dValue]])
 
         if conditions is not None:
           conditions = GConditions.combineConditions (conditions, c)

Modified: trunk/gnue-appserver/src/geasList.py
===================================================================
--- trunk/gnue-appserver/src/geasList.py        2005-04-01 14:16:12 UTC (rev 
7288)
+++ trunk/gnue-appserver/src/geasList.py        2005-04-01 14:17:52 UTC (rev 
7289)
@@ -313,7 +313,7 @@
     # elements later, disturbing the following request.
     if len (caller._children):
       for c in caller._children:
-        new = GConditions.buildTreeFromList (c.prefixNotation ())
+        new = GConditions.buildConditionFromPrefix (c.prefixNotation ())
         new.parent = parent
         parent._children.append (new)
 

Modified: trunk/gnue-appserver/src/geasSession.py
===================================================================
--- trunk/gnue-appserver/src/geasSession.py     2005-04-01 14:16:12 UTC (rev 
7288)
+++ trunk/gnue-appserver/src/geasSession.py     2005-04-01 14:17:52 UTC (rev 
7289)
@@ -55,11 +55,6 @@
     msg = u_ ("Cannot find a list with ID '%s'") % listId
     errors.SystemError.__init__ (self, msg)
 
-class ConditionDataTypeError (errors.ApplicationError):
-  def __init__ (self, condition):
-    msg = u_("Invalid condition data type '%s'") % type (condition)
-    errors.ApplicationError.__init__ (self, msg)
-
 class NoFilterParamError (errors.UserError):
   def __init__ (self, filterName):
     msg = u_("No parameter for the filter %s specified") % filterName
@@ -683,14 +678,7 @@
     if condition is None:
       return (self.__filterCondition (classdef), None)
 
-    if isinstance (condition, ListType):
-      cTree = GConditions.buildTreeFromList (condition)
-    elif isinstance (condition, DictType):
-      cTree = GConditions.buildConditionFromDict (condition)
-    elif isinstance (condition, GConditions.GCondition):
-      cTree = condition
-    else:
-      raise ConditionDataTypeError, condition
+    cTree = GConditions.buildCondition (condition)
   
     if classdef.gnue_filter:
       useFilter  = True
@@ -734,7 +722,7 @@
 
       for tree in dbTrees:
         comb._children.append (tree)
-        tree._parent = comb
+        tree.setParent (comb)
 
     if len (asTrees):
       asCond = GConditions.GCondition ()
@@ -742,7 +730,7 @@
 
       for tree in asTrees:
         comb._children.append (tree)
-        tree._parent = comb
+        tree.setParent (comb)
 
     return (dbCond, asCond)
 

Modified: trunk/gnue-appserver/src/gld/GLParser.py
===================================================================
--- trunk/gnue-appserver/src/gld/GLParser.py    2005-04-01 14:16:12 UTC (rev 
7288)
+++ trunk/gnue-appserver/src/gld/GLParser.py    2005-04-01 14:17:52 UTC (rev 
7289)
@@ -212,7 +212,7 @@
     self.fullName = repository.createName (self.module, self.name)
 
     if not hasattr (self, 'page'):
-      self.page = self._parent.page
+      self.page = self.getParent ().page
 
     if not hasattr (self, 'search'): self.search = None
     if not hasattr (self, 'info'):   self.info   = None
@@ -256,7 +256,7 @@
   # ---------------------------------------------------------------------------
 
   def _validate (self):
-    if not isinstance (self._parent, GLModule):
+    if not isinstance (self.getParent (), GLModule):
       raise NoModuleError, self.name
 
     nameParts = self.name.split ('_')
@@ -267,7 +267,7 @@
       (self.module, self.name) = nameParts [:2]
 
     if not hasattr (self, 'module'):
-      self.module = self._parent.name
+      self.module = self.getParent ().name
 
     self.fullName = repository.createName (self.module, self.name)
 

Modified: trunk/gnue-appserver/src/language/ObjectList.py
===================================================================
--- trunk/gnue-appserver/src/language/ObjectList.py     2005-04-01 14:16:12 UTC 
(rev 7288)
+++ trunk/gnue-appserver/src/language/ObjectList.py     2005-04-01 14:17:52 UTC 
(rev 7289)
@@ -157,15 +157,8 @@
     if conditions is None or not len (conditions):
       return None
 
-    if isinstance (conditions, types.ListType):
-      cTree = GConditions.buildTreeFromList (conditions)
+    cTree = GConditions.buildCondition (conditions)
 
-    elif isinstance (conditions, types.DictType):
-      cTree = GConditions.buildConditionFromDict (conditions)
-
-    else:
-      cTree = conditions
-
     try:
       # Replace all constant values represented by an Object instance with the
       # apropriate gnue_id





reply via email to

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