commit-gnue
[Top][All Lists]
Advanced

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

gnue gnue-common/src/GConditions.py gnue-common...


From: Jason Cater
Subject: gnue gnue-common/src/GConditions.py gnue-common...
Date: Wed, 10 Oct 2001 00:48:02 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/10/10 00:48:02

Modified files:
        gnue-common/src: GConditions.py GDataSource.py GObjects.py 
        gnuef/src      : GFParser.py 
        gnuef/src/GFObjects: GFDataSource.py 
        reports/samples/location: zip-by-state.grd 
        reports/src    : GRParser.py GRReport.py GRSources.py 

Log message:
        Simplified sharing of common GParser tags between clients (i.e., 
datasource,etc); continued much overdue work on conditional support for 
datsources; misc changes

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GConditions.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GDataSource.py.diff?cvsroot=OldCVS&tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GObjects.py.diff?cvsroot=OldCVS&tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFParser.py.diff?cvsroot=OldCVS&tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFObjects/GFDataSource.py.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/samples/location/zip-by-state.grd.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRParser.py.diff?cvsroot=OldCVS&tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRReport.py.diff?cvsroot=OldCVS&tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRSources.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: gnue/gnue-common/src/GConditions.py
diff -u gnue/gnue-common/src/GConditions.py:1.3 
gnue/gnue-common/src/GConditions.py:1.4
--- gnue/gnue-common/src/GConditions.py:1.3     Wed Sep 19 15:32:34 2001
+++ gnue/gnue-common/src/GConditions.py Wed Oct 10 00:48:02 2001
@@ -1,19 +1,19 @@
 #
 # This file is part of GNU Enterprise.
 #
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
 # version 2, or (at your option) any later version.
 #
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
-# License along with program; see the file COPYING. If not, 
-# write to the Free Software Foundation, Inc., 59 Temple Place 
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
 # Copyright 2000, 2001 Free Software Foundation
@@ -22,24 +22,25 @@
 # GConditions.py
 #
 # DESCRIPTION:
-#  
 #
+#
 # NOTES:
 #
 # HISTORY:
 #
 
 from GObjects import GObj
+import GTypecast
 
-class ConditionError (StandardError): 
+class ConditionError (StandardError):
   pass
 
 #
 # Build a condition tree using a dict
-# as a source.  Assumes keys are field 
+# as a source.  Assumes keys are field
 # names and values are constants.
 #
-def buildConditionFromDict (dict, comparison=None): 
+def buildConditionFromDict (dict, comparison=None):
   cond = GCondition()
   lastParent = cond
 
@@ -57,62 +58,66 @@
 # Combine two conditions with an and clause.
 # NOTE: This modifies cond1 (and also returns it)
 #
-def combineConditions (cond1, cond2): 
-  if not len(cond1._children): 
+def combineConditions (cond1, cond2):
+  if not len(cond1._children):
     cond1._children = cond2._children
     return cond1
-  elif len(cond2._children): 
+  elif len(cond2._children):
     children = cond1._children[:]
     cond1._children = []
     _and = GCand(cond1)
     _and._children = children
-    if len(cond2._children) > 1: 
+    if len(cond2._children) > 1:
       _and2 = GCand(cond1)
       _and2._children = cond2._children[:]
-    else: 
+    else:
       cond1._children.append(cond2._children[0])
 
   return cond1
 
-class GCondition(GObj): 
-  def __init__(self, parent=None, type="GCCondition"): 
-    GObj.__init__(self, parent, type=type) 
-
-class GConditionElement (GObj) : 
-  def __init__(self, parent=None, type="GConditionElement"): 
-    GObj.__init__(self, parent, type=type) 
-
-class GCField (GConditionElement): 
-  def __init__(self, parent, name, datatype="char"): 
-    GConditionElement.__init__(self, parent, 'GCField')  
+class GConditions(GObj):
+  def __init__(self, parent=None, type="GCConditions"):
+    GObj.__init__(self, parent, type=type)
+
+class GCondition(GObj):
+  def __init__(self, parent=None, type="GCCondition"):
+    GObj.__init__(self, parent, type=type)
+
+class GConditionElement (GObj) :
+  def __init__(self, parent=None, type="GConditionElement"):
+    GObj.__init__(self, parent, type=type)
+
+class GCField (GConditionElement):
+  def __init__(self, parent, name, datatype="char"):
+    GConditionElement.__init__(self, parent, 'GCField')
     self.type = datatype
     self.name = name
 
-class GCParam (GConditionElement): 
-  def __init__(self, parent, name, datatype="char"): 
-    GConditionElement.__init__(self, parent, 'GCParam')  
+class GCParam (GConditionElement):
+  def __init__(self, parent, name, datatype="char"):
+    GConditionElement.__init__(self, parent, 'GCParam')
     self.type = datatype
     self.name = name
-  
-  def getValue(self): 
+
+  def getValue(self):
     return ""
 
-class GCConst (GConditionElement): 
-  def __init__(self, parent, value, datatype="char"): 
-    GConditionElement.__init__(self, parent, 'GCConst')  
+class GCConst (GConditionElement):
+  def __init__(self, parent, value, datatype="char"):
+    GConditionElement.__init__(self, parent, 'GCConst')
     self.type = datatype
     self.value = value
 
 class GCand(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GCand')
 
 class GCor(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GCor')
 
 class GCnot(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GCnot')
 
 class GCnegate(GConditionElement):
@@ -124,7 +129,7 @@
     GConditionElement.__init__(self, parent, 'GCeq')
 
 class GCne(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GCne')
 
 class GCgt(GConditionElement):
@@ -132,60 +137,119 @@
     GConditionElement.__init__(self, parent, 'GCgt')
 
 class GCge(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GCge')
 
 class GClt(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GClt')
 
 class GCle(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GCle')
 
 class GClike(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GClike')
 
 class GCnotlike(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GCnotlike')
 
 class GCbetween(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GCbetween')
 
 class GCnotbetween(GConditionElement):
-  def __init__(self, parent): 
+  def __init__(self, parent):
     GConditionElement.__init__(self, parent, 'GCnotbetween')
 
 
 
-# Note that this is missing GCParam... If client implements parameters, 
-# it must add it's own param class (a subclass of GCParam) to the 
-# parser's xmlElement's class
-from GParser import char, bool
-xmlElements = {
-      'condition':      (GCondition, {                                  },1),
-      'field':          (GCField,  { 'name':        (1, 1, char, None), 
-                                     'type':        (0, 1, char, "char") },1),
-      'const':          (GCConst,  { 'value':       (1, 1, char, None), 
-                                     'type':        (0, 1, char, "char") },1),
-      'and':           (GCand,    {                                     },1),
-      'or':            (GCor,     {                                     },1),
-      'not':           (GCnot,    {                                     },1),
-      'negate':                (GCnegate, {                                    
 },1),
-      'eq':            (GCeq,     {                                     },1),
-      'ne':            (GCne,     {                                     },1),
-      'gt':            (GCgt,     {                                     },1),
-      'ge':            (GCge,     {                                     },1),
-      'lt':            (GClt,     {                                     },1),
-      'le':            (GCle,     {                                     },1),
-      'like':          (GClike,   {                                     },1),
-      'notlike':       (GCnotlike,{                                     },1),
-      'between':       (GCbetween,{                                     },1),
-      'notbetween':    (GCnotbetween,{                                  },1) }
+def getXMLelements(updates={}):
+  xmlElements = {
+      'conditions':       {
+         'BaseClass': GConditions,
+         'SingleInstance': 1,
+         'ParentTags':  None },
+      'condition':       {
+         'BaseClass': GCondition,
+         'ParentTags':  ('conditions','and','or','not','negate') },
+      'cfield':       {
+         'BaseClass': GCField,
+         'Attributes': {
+            'field':        {
+               'Required': 1,
+               'Typecast': GTypecast.name } },
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'cparam':       {
+         'BaseClass': GCParam,
+         'Attributes': {
+            'name':        {
+               'Required': 1,
+               'Unique':   1,
+               'Typecast': GTypecast.name } },
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'cconst':       {
+         'BaseClass': GCConst,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'and':       {
+         'BaseClass': GCand,
+         'ParentTags':  ('condition','and','or','not','negate') },
+      'or':       {
+         'BaseClass': GCor,
+         'ParentTags':  ('condition','and','or','not','negate') },
+      'not':       {
+         'BaseClass': GCnot,
+         'ParentTags':  ('condition','and','or','not','negate') },
+      'negate':       {
+         'BaseClass': GCnegate,
+         'ParentTags':  ('condition','and','or','not','negate') },
+      'eq':       {
+         'BaseClass': GCeq,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'ne':       {
+         'BaseClass': GCne,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'gt':       {
+         'BaseClass': GCgt,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'ge':       {
+         'BaseClass': GCge,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'lt':       {
+         'BaseClass': GClt,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'le':       {
+         'BaseClass': GCle,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'like':       {
+         'BaseClass': GClike,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'notlike':       {
+         'BaseClass': GCnotlike,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'between':       {
+         'BaseClass': GCbetween,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') },
+      'notbetween':       {
+         'BaseClass': GCnotbetween,
+         'ParentTags':  ('eq','ne','lt','le','gt','ge',
+                         'like','notlike','between','notbetween') } }
 
+  for alteration in updates.keys():
+    xmlElements[alteration].update(updates[alteration])
 
-if __name__ == '__main__': 
-  buildConditionFromDict( {'field1':'value1', 'field2':'value2', 
'field3':'value3'} ).showTree()
+  return xmlElements
Index: gnue/gnue-common/src/GDataSource.py
diff -u gnue/gnue-common/src/GDataSource.py:1.18 
gnue/gnue-common/src/GDataSource.py:1.19
--- gnue/gnue-common/src/GDataSource.py:1.18    Thu Sep 20 02:08:36 2001
+++ gnue/gnue-common/src/GDataSource.py Wed Oct 10 00:48:02 2001
@@ -19,7 +19,7 @@
 # Copyright 2000, 2001 Free Software Foundation
 #
 # FILE:
-# GDataObjects.py
+# GDataSource.py
 #
 # DESCRIPTION:
 # Class that implements a provider-independent DataSource object
@@ -35,6 +35,7 @@
 import sys, string
 import GConnections
 import GTypecast
+import GConditions
 
 
 ########################################################################
@@ -89,6 +90,7 @@
 
 
     # Copy all attributes from XML to the dataObject
+    tagAttributes = getXMLelements()['datasource']['Attributes']
     for attribute in tagAttributes.keys():
       if hasattr(self, attribute):
         self._dataObject.__dict__[attribute] = self.__dict__[attribute]
@@ -105,11 +107,6 @@
   def referenceField(self, field, defaultValue=None):
     GDebug.printMesg(7,'Field %s implicitly referenced' % field)
     self._fieldReferences[field] = 1
-# TODO: These aren't really necessary as we are setting
-# TODO: self._dataObject._fieldReferences to be our _fieldReferences
-# TODO: (i.e., we are not setting it to a copy, but to a "reference"
-#    if self._dataObject != None:
-#      self._dataObject._fieldReferences[field] = 1
 
     if defaultValue != None:
       self._defaultValues[field] = defaultValue
@@ -117,8 +114,6 @@
   def referenceUnboundField(self, field, defaultValue=None):
     GDebug.printMesg(7,'Field %s implicitly referenced' % field)
     self._unboundFieldReferences[field] = 1
-#    if self._dataObject != None:
-#      self._dataObject._unboundFieldReferences[field] = 1
 
     if defaultValue != None:
       self._defaultValues[field] = defaultValue
@@ -141,48 +136,69 @@
       return self._dataObject.createEmptyResultSet(readOnly)
 
 ######
-# 
-# 
 #
+#
+#
 ######
-class GSql(GObjects.GObj): 
-  def __init__(self, parent=None): 
-     GObjects.GObj(self, parent, type="GDSql") 
+class GSql(GObjects.GObj):
+  def __init__(self, parent=None):
+     GObjects.GObj(self, parent, type="GDSql")
 
 ######
-# 
-# Used by client DataSources to automatically pull supported xml tags
+#
+# Used by client GParsers to automatically pull supported xml tags
 #
 ######
-from GParser import char, bool
-tagAttributes = { 
+
+#
+# Return any XML elements associated with
+# GDataSources.  Bases is a dictionary of tags
+# whose values are update dictionaries.
+# For example: bases={'datasource': {'BaseClass':myDataSource}}
+# sets xmlElements['datasource']['BaseClass'] = myDataSource
+#
+def getXMLelements(updates={}):
+
+  xmlElements = {
+      'datasource': {
+         'BaseClass': GDataSource,
+         'Attributes': {
             'name':        {
-               'Required': 1, 
-               'Unique':   1, 
-               'Typecast': GTypecast.name }, 
+               'Required': 1,
+               'Unique':   1,
+               'Typecast': GTypecast.name },
             'type':        {
-               'Typecast': GTypecast.name, 
-               'Default':  "object" }, 
+               'Typecast': GTypecast.name,
+               'Default':  "object" },
             'database':    {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'table':       {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'cache':       {
                'Typecast': GTypecast.whole },
             'prequery':    {
-               'Typecast': bool, 
+               'Typecast': GTypecast.boolean,
                'Default':  0 },
             'order_by':    {
-               'Typecast': GTypecast.text }, 
+               'Typecast': GTypecast.text },
             'master':      {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'masterlink':  {
-               'Typecast': GTypecast.text }, 
+               'Typecast': GTypecast.text },
             'detaillink':  {
-               'Typecast': GTypecast.text } }
+               'Typecast': GTypecast.text } },
+         'ParentTags': None },
+  }
+
+  # Add conditional elements
+  xmlElements.update(
+      GConditions.getXMLelements(
+          {'conditions':{'ParentTags':('datasource',) } } ))
 
+  for alteration in updates.keys():
+    xmlElements[alteration].update(updates[alteration])
 
+  return xmlElements
 
-xmlElements = {}
 
 
Index: gnue/gnue-common/src/GObjects.py
diff -u gnue/gnue-common/src/GObjects.py:1.20 
gnue/gnue-common/src/GObjects.py:1.21
--- gnue/gnue-common/src/GObjects.py:1.20       Mon Oct  8 08:38:13 2001
+++ gnue/gnue-common/src/GObjects.py    Wed Oct 10 00:48:02 2001
@@ -11,8 +11,8 @@
 # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
-# License along with program; see the file COPYING. If not, 
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
@@ -161,7 +161,7 @@
     xmlEntity = string.lower(string.replace(self._type[2:],'_','-'))
     xmlString = "%s<%s" % (gap[:-2],xmlEntity)
 
-    indent = len(xmlString) 
+    indent = len(xmlString)
     pos = indent
     for attribute in self.__dict__.keys():
       # skip keys beginning with _
@@ -169,10 +169,10 @@
         continue
       val = self.__dict__[attribute]
       if lookupDict[xmlEntity].has_key('Attributes') and \
-         lookupDict[xmlEntity]['Attributes'].has_key(attribute): 
+         lookupDict[xmlEntity]['Attributes'].has_key(attribute):
         if val != None and \
            (not 
lookupDict[xmlEntity]['Attributes'][attribute].has_key('Default') or \
-            (lookupDict[xmlEntity]['Attributes'][attribute]['Default']) != 
(val)): 
+            (lookupDict[xmlEntity]['Attributes'][attribute]['Default']) != 
(val)):
           typecast = lookupDict[xmlEntity]['Attributes'][attribute]['Typecast']
           if typecast == GTypecast.boolean \
              and val == 1:
@@ -180,34 +180,34 @@
           elif typecast == GTypecast.names:
             addl = ' %s="%s"' % \
                 (attribute, string.join(val,','))
-          else: 
+          else:
             addl = ' %s="%s"' % (attribute, saxutils.escape('%s' % val))
-          if len(addl) + pos > 78: 
+          if len(addl) + pos > 78:
             xmlString = xmlString + "\n" + " " * indent + addl
             pos = indent
-          else: 
+          else:
             xmlString = xmlString + addl
             pos = pos + len(addl)
 
-    if len(self._children): 
-      hasContent = 0 
-      for child in self._children: 
+    if len(self._children):
+      hasContent = 0
+      for child in self._children:
         hasContent = hasContent or isinstance(child,GContent)
-      if hasContent: 
+      if hasContent:
         xmlString = xmlString + ">"
-      else: 
+      else:
         xmlString = xmlString + ">\n"
-       
+
       if treeDump:
         for child in self._children:
           xmlString = xmlString + child.dumpXML(lookupDict, 1,gap+"  ")
 
-      if hasContent: 
+      if hasContent:
         xmlString = xmlString + "</%s>\n" % (xmlEntity)
-      else: 
+      else:
         xmlString = xmlString + "%s</%s>\n" % (gap[:-2], xmlEntity)
-    else: 
-      xmlString = xmlString + "/>\n"      
+    else:
+      xmlString = xmlString + "/>\n"
     return xmlString
 
 
@@ -215,7 +215,7 @@
     function(self)
     if self._children:
       for child in self._children:
-        if isinstance(child, GObj): 
+        if isinstance(child, GObj):
           child.walk(function)
 
   #
Index: gnue/gnuef/src/GFObjects/GFDataSource.py
diff -u gnue/gnuef/src/GFObjects/GFDataSource.py:1.9 
gnue/gnuef/src/GFObjects/GFDataSource.py:1.10
--- gnue/gnuef/src/GFObjects/GFDataSource.py:1.9        Mon Oct  8 08:38:14 2001
+++ gnue/gnuef/src/GFObjects/GFDataSource.py    Wed Oct 10 00:48:02 2001
@@ -8,10 +8,10 @@
 #
 # GNU Enterprise is distributed in the hope that it will be
 # useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
+# You should have received a copy of the GNU General Public
 # License along with program; see the file COPYING. If not,
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
@@ -30,7 +30,7 @@
 # HISTORY:
 #
 
-from gnue.common.GObjects import * 
+from gnue.common.GObjects import *
 from gnue.common.dbdrivers.factory import factory
 
 from gnue.common import GDebug
Index: gnue/gnuef/src/GFParser.py
diff -u gnue/gnuef/src/GFParser.py:1.55 gnue/gnuef/src/GFParser.py:1.56
--- gnue/gnuef/src/GFParser.py:1.55     Mon Oct  8 08:38:13 2001
+++ gnue/gnuef/src/GFParser.py  Wed Oct 10 00:48:02 2001
@@ -30,6 +30,7 @@
 #
 
 from gnue.common import GDataSource, GParser
+
 import copy, types
 from gnue.common import GTypecast
 
@@ -48,8 +49,8 @@
 
 
 #######################################################
-# This method loads a form from an XML file and returns 
-# a GFForm object.  If initialize is 1 (default), then 
+# This method loads a form from an XML file and returns
+# a GFForm object.  If initialize is 1 (default), then
 # the form is initialized and ready to go. 
 #
 # (initialize=0 is currently not used -- will probably 
@@ -60,20 +61,20 @@
 def loadForm(URL, app, initialize=1):
   return GParser.loadXMLObject (URL, xmlFormsHandler, 'GFForm', 'form', 
            initialize, attributes={"_app": app, 
-                               "_connections": app.connections })  
+                               "_connections": app.connections })
 
 
 xmlElements = None
 
 
-def getXMLelements(): 
+def getXMLelements():
 
   global xmlElements
 
     #
     # xmlElements=
     # {tagName: (baseClass, attributesHash, normalizeWhitespace?, parents) }
-    #      
+    #
     # attributesHash=
     # {attrName: (required?, uniqueID?, typecast, defaultValue) }
     #
@@ -83,24 +84,24 @@
   if xmlElements == None:
     from gnue.forms import GFObjects, GFLibrary, GFTrigger, GFForm
 
-    xmlElements = { 
-      'form': { 
+    xmlElements = {
+      'form': {
          'BaseClass': GFForm.GFForm,
          'Required': 1,
-         'SingleInstance': 1, 
-         'Attributes': { 
+         'SingleInstance': 1,
+         'Attributes': {
             'title': {
-               'Typecast': GTypecast.text, 
+               'Typecast': GTypecast.text,
                'Default': 'Untitled Form' },
             'readonly': {
                'Typecast': GTypecast.boolean,
                'Default': 0 },
             'tabbed': {
-               'Typecast': GTypecast.name, 
-               'ValueSet': { 
-                  'left': {}, 
-                  'right': {}, 
-                  'bottom': {}, 
+               'Typecast': GTypecast.name,
+               'ValueSet': {
+                  'left': {},
+                  'right': {},
+                  'bottom': {},
                   'top': {} },
                'Default': "" },
             'width': {
@@ -153,47 +154,43 @@
          'Deprecated': 'Use the external connections file format.',
          'ParentTags': ('form',) },
 
-      'datasource': { 
-         'BaseClass': GFObjects.GFDataSource,  
-         'Attributes': GDataSource.tagAttributes, 
-         'ParentTags': ('form',) },
-      'page': { 
+      'page': {
          'BaseClass': GFObjects.GFPage,
          'Required': 1,
-         'Attributes': { 
+         'Attributes': {
             'name': {
-               'Unique': 1, 
-               'Typecast': GTypecast.name } }, 
+               'Unique': 1,
+               'Typecast': GTypecast.name } },
          'ParentTags': ('form',) },
 
-      'block': { 
-         'BaseClass': GFObjects.GFBlock,      
-         'Attributes': { 
+      'block': {
+         'BaseClass': GFObjects.GFBlock,
+         'Attributes': {
             'name': {
-               'Required': 1, 
-               'Unique': 1, 
+               'Required': 1,
+               'Unique': 1,
                'Typecast': GTypecast.name },
             'master': {
-               'References': (('datasource','name'),), 
-               'Typecast': GTypecast.name }, 
+               'References': (('datasource','name'),),
+               'Typecast': GTypecast.name },
             'detail': {
-               'References': (('datasource','name'),), 
-               'Typecast': GTypecast.name }, 
+               'References': (('datasource','name'),),
+               'Typecast': GTypecast.name },
             'rows': {
-               'Typecast': GTypecast.whole}, 
+               'Typecast': GTypecast.whole},
             'rowSpacer': {
                'Typecast': GTypecast.whole },
             'transparentBlock':{
-               'Typecast': GTypecast.boolean, 
+               'Typecast': GTypecast.boolean,
                'Default': 0 },
             'datasource': {
-               'References': (('datasource','name'),), 
-               'Typecast': GTypecast.name } }, 
+               'References': (('datasource','name'),),
+               'Typecast': GTypecast.name } },
          'ParentTags': ('page',) },
 
-      'label': { 
-         'BaseClass': GFObjects.GFLabel, 
-         'Attributes': { 
+      'label': {
+         'BaseClass': GFObjects.GFLabel,
+         'Attributes': {
             'name': {
                'Unique': 1, 
                'Typecast': GTypecast.name }, 
@@ -217,7 +214,7 @@
                'Required': 1, 
                'Typecast': GTypecast.whole }, 
             'y': {
-               'Required': 1, 
+               'Required': 1,
                'Typecast': GTypecast.whole } }, 
          'ParentTags': ('page','block',) },
 
@@ -255,19 +252,19 @@
                'Typecast': GTypecast.boolean, 
                'Default': 0   }, 
             'uppercase': {
-               'Deprecated': 'Use case="upper" instead.', 
-               'Typecast': GTypecast.boolean, 
-               'Default': 0   }, 
+               'Deprecated': 'Use case="upper" instead.',
+               'Typecast': GTypecast.boolean,
+               'Default': 0   },
             'lowercase': {
-               'Deprecated': 'Use case="lower" instead.', 
-               'Typecast': GTypecast.boolean, 
-               'Default': 0   }, 
+               'Deprecated': 'Use case="lower" instead.',
+               'Typecast': GTypecast.boolean,
+               'Default': 0   },
             'numeric': {
-               'Deprecated': 'Use typecast="number" instead', 
-               'Typecast': GTypecast.boolean, 
-               'Default': 0   }, 
+               'Deprecated': 'Use typecast="number" instead',
+               'Typecast': GTypecast.boolean,
+               'Default': 0   },
             'hidden': {
-               'Typecast': GTypecast.boolean, 
+               'Typecast': GTypecast.boolean,
                'Default': 0   }, 
             'style': {
                'Typecast': GTypecast.name, 
@@ -282,16 +279,16 @@
                   'mixed': {}, 
                   'upper': {}, 
                   'lower': {} }, 
-               'Default': 'mixed'}, 
+               'Default': 'mixed'},
             'typecast': {
                'Typecast': GTypecast.name, 
-               'ValueSet': { 
+               'ValueSet': {
                   'text': {}, 
                   'number': {}, 
                   'date': {} }, 
-               'Default': 'text'}, 
+               'Default': 'text'},
             'value': {
-               'Typecast': GTypecast.text }, 
+               'Typecast': GTypecast.text },
             'foreign_key': {
                'Typecast': GTypecast.name }, 
             'default': {
@@ -306,48 +303,48 @@
                'Typecast': GTypecast.boolean, 
                'Default': 0 }, 
             'editOnNull': {
-               'Description': 'Only allow this object to be edited if it ' 
+               'Description': 'Only allow this object to be edited if it '
                               'is currently empty.',
-               'Typecast': GTypecast.boolean, 
-               'Default': 0 }, 
+               'Typecast': GTypecast.boolean,
+               'Default': 0 },
             'no_ltrim': {
                'Description': 'Suppress trimming of extraneous space at '
                               'beginning of user input.',
-               'Typecast': GTypecast.boolean, 
-               'Default': 0 }, 
+               'Typecast': GTypecast.boolean,
+               'Default': 0 },
             'no_rtrim': {
                'Description': 'Suppress trimming of extraneous space at end '
                               'of user input.',
-               'Typecast': GTypecast.boolean, 
-               'Default': 0 }, 
+               'Typecast': GTypecast.boolean,
+               'Default': 0 },
             'x': {
-               'Required': 1, 
-               'Typecast': GTypecast.whole }, 
+               'Required': 1,
+               'Typecast': GTypecast.whole },
             'y': {
-               'Required': 1, 
-               'Typecast': GTypecast.whole } }, 
+               'Required': 1,
+               'Typecast': GTypecast.whole } },
          'ParentTags': ('block',) },
 
-      'scrollbar': { 
-         'BaseClass': GFObjects.GFScrollBar,  
-         'Attributes': { 
+      'scrollbar': {
+         'BaseClass': GFObjects.GFScrollBar,
+         'Attributes': {
             'width': {
-               'Required': 1, 
-               'Typecast': GTypecast.whole }, 
+               'Required': 1,
+               'Typecast': GTypecast.whole },
             'height': {
-               'Required': 1, 
-               'Typecast': GTypecast.whole }, 
+               'Required': 1,
+               'Typecast': GTypecast.whole },
             'x': {
-               'Required': 1, 
-               'Typecast': GTypecast.whole }, 
+               'Required': 1,
+               'Typecast': GTypecast.whole },
             'y': {
-               'Required': 1, 
-               'Typecast': GTypecast.whole } }, 
+               'Required': 1,
+               'Typecast': GTypecast.whole } },
          'ParentTags': ('page','block',) },
 
-      'box': { 
+      'box': {
          'BaseClass': GFObjects.GFBox,
-         'Attributes': { 
+         'Attributes': {
             'name': {
                'Unique': 1, 
                'Typecast': GTypecast.name }, 
@@ -357,111 +354,111 @@
                'Required': 1, 
                'Typecast': GTypecast.whole }, 
             'height': {
-               'Required': 1, 
+               'Required': 1,
                'Typecast': GTypecast.whole }, 
             'x': {
-               'Required': 1, 
+               'Required': 1,
                'Typecast': GTypecast.whole }, 
             'y': {
                'Required': 1, 
                'Typecast': GTypecast.whole } }, 
          'ParentTags': ('page','block',) },
 
-      'button': { 
-         'BaseClass': GFObjects.GFButton,     
-         'Attributes': { 
+      'button': {
+         'BaseClass': GFObjects.GFButton,
+         'Attributes': {
             'name': {
-               'Unique': 1, 
-               'Typecast': GTypecast.name }, 
+               'Unique': 1,
+               'Typecast': GTypecast.name },
             'trigger': {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'label': {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'width': {
                'Required': 1, 
                'Typecast': GTypecast.whole }, 
             'height': {
-               'Required': 1, 
-               'Typecast': GTypecast.whole }, 
+               'Required': 1,
+               'Typecast': GTypecast.whole },
             'x': {
                'Required': 1, 
-               'Typecast': GTypecast.whole }, 
+               'Typecast': GTypecast.whole },
             'y': {
                'Required': 1, 
                'Typecast': GTypecast.whole } },  
          'ParentTags': ('page','block',) },
 
-      'trigger': { 
-         'BaseClass': GFTrigger.GFTrigger, 
-         'Attributes': { 
+      'trigger': {
+         'BaseClass': GFTrigger.GFTrigger,
+         'Attributes': {
             'name': {
-               'Unique': 1, 
-               'Typecast': GTypecast.name }, 
+               'Unique': 1,
+               'Typecast': GTypecast.name },
             'id': {
                'Deprecated': 'Use name instead.',   # DEPRECATED: Use name 
instead
                'Typecast': GTypecast.name },
             'type': {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'src': {
-               'References': (('trigger','name'),), 
-               'Typecast': GTypecast.name }, 
+               'References': (('trigger','name'),),
+               'Typecast': GTypecast.name },
             'language': {
                'Typecast': GTypecast.name,
-               'ValueSet': { 
-                   'python': {} }, 
-               'Default': 'python' } }, 
-         'MixedContent': 1, 
-         'KeepWhitespace': 1, 
-         'UsableBySiblings': 1, 
+               'ValueSet': {
+                   'python': {} },
+               'Default': 'python' } },
+         'MixedContent': 1,
+         'KeepWhitespace': 1,
+         'UsableBySiblings': 1,
          'ParentTags': ('form',) },
 
-      'options': { 
-         'BaseClass': GFObjects.GFOptions,    
-         'SingleInstance': 1, 
-         'UsableBySiblings': 1, 
+      'options': {
+         'BaseClass': GFObjects.GFOptions,
+         'SingleInstance': 1,
+         'UsableBySiblings': 1,
          'ParentTags': ('form',) },
 
-      'option': { 
+      'option': {
          'BaseClass': GFObjects.GFOption,
-         'Attributes': { 
+         'Attributes': {
             'name': {
-               'Required': 1, 
+               'Required': 1,
                'Typecast': GTypecast.name },
             'value': {
-               'Typecast': GTypecast.text } }, 
-         'MixedContent': 1, 
+               'Typecast': GTypecast.text } },
+         'MixedContent': 1,
          'ParentTags': ('options',) },
 
-      'title': { 
+      'title': {
          'BaseClass': GFObjects.GFOption,
-         'Attributes': { 
+         'Attributes': {
             'name': {
-               'Typecast': GTypecast.name, 
+               'Typecast': GTypecast.name,
                'ValueSet': {
-                   'title': {} }, 
+                   'title': {} },
                'Default': 'title' },
             'value': {
-               'Typecast': GTypecast.text } }, 
-         'MixedContent': 1, 
-         'SingleInstance': 1, 
-         'Deprecated': 'Use the <form> attribute "title" instead.', 
+               'Typecast': GTypecast.text } },
+         'MixedContent': 1,
+         'SingleInstance': 1,
+         'Deprecated': 'Use the <form> attribute "title" instead.',
          'ParentTags': ('options',) },
 
       'name': { 
          'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': GTypecast.name, 
+               'Typecast': GTypecast.name,
                'ValueSet': {
                    'name': {} }, 
                'Default': 'name' },
             'value': {
                'Typecast': GTypecast.text } },
-         'MixedContent': 1, 
+         'MixedContent': 1,
          'SingleInstance': 1, 
          'ParentTags': ('options',) },
 
-      'height': { 
+      'height': {
          'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
@@ -476,33 +473,33 @@
          'Deprecated': 'Use the <form> attribute "height" instead.', 
          'ParentTags': None },
 
-      'width': { 
+      'width': {
          'BaseClass': GFObjects.GFOption,
-         'Attributes': { 
+         'Attributes': {
             'name': {
-               'Typecast': GTypecast.name, 
+               'Typecast': GTypecast.name,
                'ValueSet': {
                    'width': {} },
                'Default': 'width' },
             'value': {
                'Typecast': GTypecast.text } },
-         'MixedContent': 1, 
-         'SingleInstance': 1, 
-         'Deprecated': 'Use the <form> attribute "width" instead.', 
+         'MixedContent': 1,
+         'SingleInstance': 1,
+         'Deprecated': 'Use the <form> attribute "width" instead.',
          'ParentTags': ('options',) },
 
-      'author': { 
+      'author': {
          'BaseClass': GFObjects.GFOption,
-         'Attributes': { 
+         'Attributes': {
             'name': {
-               'Typecast': GTypecast.name, 
+               'Typecast': GTypecast.name,
                'ValueSet': {
                    'author': {} },
                'Default': 'author' },
             'value': {
                'Typecast': GTypecast.text } },
-         'MixedContent': 1, 
-         'SingleInstance': 1, 
+         'MixedContent': 1,
+         'SingleInstance': 1,
          'ParentTags': ('options',) },
 
       'description':{ 
@@ -516,20 +513,20 @@
             'value': {
                'Typecast': GTypecast.text } },
          'MixedContent': 1, 
-         'SingleInstance': 1, 
+         'SingleInstance': 1,
          'ParentTags': ('options',) },
 
-      'version': { 
+      'version': {
          'BaseClass': GFObjects.GFOption,
-         'Attributes': { 
+         'Attributes': {
             'name': {
-               'Typecast': GTypecast.name, 
+               'Typecast': GTypecast.name,
                'ValueSet': {
                    'version': {} },
                'Default': 'version' },
             'value': {
                'Typecast': GTypecast.text } },
-         'MixedContent': 1, 
+         'MixedContent': 1,
          'SingleInstance': 1, 
          'ParentTags': ('options',) },
 
@@ -537,27 +534,38 @@
          'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': GTypecast.name, 
+               'Typecast': GTypecast.name,
                'ValueSet': {
                    'tip': {} },
                'Default': 'tip' },
             'value': {
                'Typecast': GTypecast.text } },
-         'MixedContent': 1, 
-         'SingleInstance': 1, 
-         'ParentTags': ('options',) }, 
+         'MixedContent': 1,
+         'SingleInstance': 1,
+         'ParentTags': ('options',) },
     }
-    
-      
+
+
+    #
+    # Add DataSource elements
     #
+    xmlElements.update(
+      GDataSource.getXMLelements(
+        updates={'datasource': {
+                   'BaseClass': GFObjects.GFDataSource,
+                   'ParentTags': ('form',) },
+                 }))
+
+
+    #
     # Add importable elements
-    # If an object needs to be importable, 
+    # If an object needs to be importable,
     # simply add its tag name to the tuple below
-    # and make sure it has a "name" attribute 
-    # (otherwise we don't know how to reference 
-    # it in the imported file).  
+    # and make sure it has a "name" attribute
+    # (otherwise we don't know how to reference
+    # it in the imported file).
     #
-    for key in ('datasource','page','block','trigger','button','entry'): 
+    for key in ('datasource','page','block','trigger','button','entry'):
       name = "import-%s" % key
       copy._deepcopy_dispatch[types.FunctionType] = copy._deepcopy_atomic
       copy._deepcopy_dispatch[types.ClassType] = copy._deepcopy_atomic
@@ -565,26 +573,23 @@
 
       p = copy.deepcopy(xmlElements[key])
       p['BaseClass'] = GFLibrary.GFImportItem
-      p['Attributes']['library'] = { 
-         'Required': 1, 
+      p['Attributes']['library'] = {
+         'Required': 1,
          'Typecast': GTypecast.name }
       p['MixedContent'] = 0
       p['Required'] = 0
-    
+
       xmlElements[name] = p
-     
-    #
-    # Add DataSource elements
-    #
-    xmlElements.update(GDataSource.xmlElements)
-    
-  return xmlElements  
+
+  print xmlElements
+
+  return xmlElements
 
 #
 # Different Types of Entries
 #
-entryStyles = {'text': 'Text Field', 
-               'dropdown': 'Drop Down Box', 
+entryStyles = {'text': 'Text Field',
+               'dropdown': 'Drop Down Box',
                'checkbox': 'Check Box' }
 
 #######################################################
@@ -592,14 +597,14 @@
 # xmlFormsHandler
 #
 # This class is called by the XML parser to
-# process the xml file. 
+# process the xml file.
 #
 #######################################################
 
-class xmlFormsHandler (GParser.xmlHandler): 
-  def __init__(self): 
+class xmlFormsHandler (GParser.xmlHandler):
+  def __init__(self):
 
-    GParser.xmlHandler.__init__(self) 
+    GParser.xmlHandler.__init__(self)
 
     self.xmlElements = getXMLelements()
 
Index: gnue/reports/samples/location/zip-by-state.grd
diff -u gnue/reports/samples/location/zip-by-state.grd:1.6 
gnue/reports/samples/location/zip-by-state.grd:1.7
--- gnue/reports/samples/location/zip-by-state.grd:1.6  Mon Oct  8 08:38:14 2001
+++ gnue/reports/samples/location/zip-by-state.grd      Wed Oct 10 00:48:02 2001
@@ -1,26 +1,34 @@
 <?xml version="1.0"?>
 <report>
 
-  <parameters> 
-    <parameter id="state_code" type="char" description="State"/> 
-  </parameters>        
+  <parameters>
+    <parameter id="state_code" type="char" description="State"/>
+  </parameters>
 
 
-  <sortoptions> 
-    <sortoption id="byZip" default="" description="By Zip Code, City Name">
-      <sortcolumn name="zip"/>
-      <sortcolumn name="city"/>
+  <!--sortoptions>
+    <sortoption name="byZip" default="" description="By Zip Code, City Name">
+      <sofield field="zip"/>
+      <sofield field="city"/>
     </sortoption>
-    <sortoption id="byCity" description="By City Name, Zip Code">
-      <sortcolumn name="city"/>
-      <sortcolumn name="zip"/>
+    <sortoption name="byCity" description="By City Name, Zip Code">
+      <sofield field="zip"/>
+      <sofield field="city"/>
     </sortoption>
-  </sortoptions>
+  </sortoptions-->
 
 
-  <sources> 
-    <datasource name="zips" database="gnue" table="zipcode"/>
-    <datasource name="states" database="gnue" table="state" 
+  <sources>
+    <datasource name="zips" database="gnue" table="zipcode">
+      <!--sorting>
+        <sfield field="zip"/>
+        <soption/>
+      </sorting-->
+      <conditions>
+       <condition/>
+      </conditions>
+    </datasource>
+    <datasource name="states" database="gnue" table="state"
        master="zips" detaillink="state" masterlink="state_code"/>
   </sources>
 
@@ -35,7 +43,7 @@
           <field source="states" name="description"/> (<field source="zips" 
name="state_code"/>)
         </section>
       </section>
-      <default> 
+      <default>
      (No results to display)
      </default>
     </section>
Index: gnue/reports/src/GRParser.py
diff -u gnue/reports/src/GRParser.py:1.11 gnue/reports/src/GRParser.py:1.12
--- gnue/reports/src/GRParser.py:1.11   Sun Aug 12 15:55:27 2001
+++ gnue/reports/src/GRParser.py        Wed Oct 10 00:48:02 2001
@@ -1,14 +1,14 @@
 #
 # This file is part of GNU Enterprise.
 #
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
 # version 2, or (at your option) any later version.
 #
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 # PURPOSE. See the GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public 
@@ -29,13 +29,8 @@
 # HISTORY:
 #
 
-from gnue.common.GParser import *
-import GRReport
-from GRSources import *
-from GRParameters import * 
-from GRSortOptions import *
-from GRLayout import *
-from gnue.common import GDataSource, GTypecast
+import GRReport, GRSources, GRParameters, GRSortOptions, GRLayout
+from gnue.common import GDataSource, GTypecast, GParser
 import copy, types
 
 
@@ -54,168 +49,169 @@
 
 
 #######################################################
-# This method loads a report from an XML file and returns 
-# a GRReport object.  If initialize is 1 (default), then 
-# the report is initialized and ready to go. 
+# This method loads a report from an XML file and returns
+# a GRReport object.  If initialize is 1 (default), then
+# the report is initialized and ready to go.
 #######################################################
 
 def loadReport(URL, connections, initialize=1):
-  return loadXMLObject (URL, xmlReportHandler, 'GRReport', 'report', 
-           initialize, attributes={"_connections": connections})  
+  return GParser.loadXMLObject (URL, xmlReportHandler, 'GRReport', 'report',
+           initialize, attributes={"_connections": connections})
 
 
 
 xmlElements = None
 
 
-def getXMLelements(): 
+def getXMLelements():
 
+#  print "I'm trying"
   global xmlElements
 
   if xmlElements == None:
 
     #
     #
-    xmlElements = { 
+    xmlElements = {
       'report':       {
-         'BaseClass': GRReport.GRReport, 
+         'BaseClass': GRReport.GRReport,
          'Required': 1,
-         'SingleInstance': 1, 
-         'Attributes':  { 
+         'SingleInstance': 1,
+         'Attributes':  {
             'title':       {
                'Typecast': GTypecast.name } } ,
          'ParentTags':  None },
 
       'parameters':   {
-         'BaseClass': GRParameters , 
-         'SingleInstance': 1, 
-         'ParentTags':  ('form',)}, 
+         'BaseClass': GRParameters.GRParameters ,
+         'SingleInstance': 1,
+         'ParentTags':  ('form',)},
 
       'parameter':    {
-         'BaseClass': GRParameter, 
-         'Attributes': { 
+         'BaseClass': GRParameters.GRParameter,
+         'Attributes': {
             'id':          {
-               'Required': 1, 
-               'Unique': 1, 
+               'Required': 1,
+               'Unique': 1,
                'Typecast': GTypecast.name },
             'required':    {
-               'Typecast': GTypecast.boolean, 
+               'Typecast': GTypecast.boolean,
                'Default': 0 },
             'limited':     {
-               'Typecast': GTypecast.boolean, 
+               'Typecast': GTypecast.boolean,
                'Default': 0 },
             'default':     {
                'Typecast': GTypecast.name },
             'description': {
-               'Required': 1, 
+               'Required': 1,
                'Typecast': GTypecast.name },
             'source':      {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'type':        {
-               'Typecast': GTypecast.name, 
-               'Default': "char" } }, 
-         'ParentTags':  ('parameters',) }, 
+               'Typecast': GTypecast.name,
+               'Default': "char" } },
+         'ParentTags':  ('parameters',) },
 
       'sortoptions':  {
-         'BaseClass': GRSortOptions, 
-         'SingleInstance': 1, 
-         'ParentTags':  ('form',) }, 
+         'BaseClass': GRSortOptions.GRSortOptions,
+         'SingleInstance': 1,
+         'ParentTags':  ('form',) },
 
       'sortoption':   {
-         'BaseClass': GRSortOption,
-         'Attributes': { 
+         'BaseClass': GRSortOptions.GRSortOption,
+         'Attributes': {
             'id':          {
-               'Required': 1, 
-               'Unique': 1, 
-               'Typecast': GTypecast.name }, 
+               'Required': 1,
+               'Unique': 1,
+               'Typecast': GTypecast.name },
             'description': {
-               'Required': 1, 
+               'Required': 1,
                'Typecast': GTypecast.name },
             'default':     {
-               'Typecast': GTypecast.boolean, 
-               'Default': 0 } }, 
+               'Typecast': GTypecast.boolean,
+               'Default': 0 } },
          'ParentTags':  ('sortoptions',) },
 
       'sortcolumn':   {
-         'BaseClass': GRSortColumn,
-         'Attributes': { 
+         'BaseClass': GRSortOptions.GRSortColumn,
+         'Attributes': {
             'name':        {
-               'Required': 1, 
-               'Typecast': GTypecast.name } }, 
-         'ParentTags':  ('sortoption',) }, 
+               'Required': 1,
+               'Typecast': GTypecast.name } },
+         'ParentTags':  ('sortoption',) },
 
       'layout':       {
-         'BaseClass': GRLayout,    
+         'BaseClass': GRLayout.GRLayout,
          'Required': 1,
-         'SingleInstance': 1, 
-         'Attributes': { 
+         'SingleInstance': 1,
+         'Attributes': {
             'format':      {
-               'Typecast': GTypecast.name } }, 
-         'ParentTags':  ('form',) }, 
+               'Typecast': GTypecast.name } },
+         'ParentTags':  ('form',) },
 
       'section':      {
-         'BaseClass': GRSection,   
+         'BaseClass': GRLayout.GRSection,
          'Required': 1,
-         'MixedContent': 1, 
-         'KeepWhitespace': 1, 
-         'Attributes': { 
+         'MixedContent': 1,
+         'KeepWhitespace': 1,
+         'Attributes': {
             'name':        {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'source':      {
-               'Typecast': GTypecast.name } }, 
-         'ParentTags':  ('layout',) }, 
+               'Typecast': GTypecast.name } },
+         'ParentTags':  ('layout',) },
 
       'default':      {
-         'BaseClass': GRDefault, 
-         'MixedContent': 1, 
-         'KeepWhitespace': 1, 
+         'BaseClass': GRLayout.GRDefault,
+         'MixedContent': 1,
+         'KeepWhitespace': 1,
          'ParentTags':  ('layout',) },
 
       'field':        {
-         'BaseClass': GRField,     
-         'Attributes': { 
+         'BaseClass': GRLayout.GRField,
+         'Attributes': {
             'name':        {
-               'Required': 1, 
-               'Typecast': GTypecast.name }, 
+               'Required': 1,
+               'Typecast': GTypecast.name },
             'source':      {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'format':      {
-               'Typecast': GTypecast.name } }, 
-         'ParentTags':  ('layout',) }, 
+               'Typecast': GTypecast.name } },
+         'ParentTags':  ('layout',) },
 
       'summ':         {
-         'BaseClass': GRField,     
-         'Attributes': { 
+         'BaseClass': GRLayout.GRSumm,
+         'Attributes': {
             'name':        {
-               'Required': 1, 
-               'Typecast': GTypecast.name }, 
+               'Required': 1,
+               'Typecast': GTypecast.name },
             'function':    {
-               'Typecast': GTypecast.name, 
-               'Default': "count"}, 
+               'Typecast': GTypecast.name,
+               'Default': "count"},
             'source':      {
-               'Typecast': GTypecast.name, 
-               'Default': None}, 
+               'Typecast': GTypecast.name,
+               'Default': None},
             'section':     {
-               'Typecast': GTypecast.name }, 
+               'Typecast': GTypecast.name },
             'format':      {
-               'Typecast': GTypecast.name } }, 
-         'ParentTags':  ('layout',) }, 
+               'Typecast': GTypecast.name } },
+         'ParentTags':  ('layout',) },
 
       'sources':      {
-         'BaseClass': GRSources, 
-         'SingleInstance': 1, 
-         'ParentTags':  ('form',) }, 
-
-      'datasource':   {
-         'BaseClass': GRDataSource,  
-         'Attributes': GDataSource.tagAttributes, 
-         'ParentTags':  ('sources',) } 
-    } 
+         'BaseClass': GRSources.GRSources,
+         'SingleInstance': 1,
+         'ParentTags':  ('form',) },
+    }
 
     #
     # Add DataSource elements
     #
-    xmlElements.update(GDataSource.xmlElements)
+    xmlElements.update(
+       GDataSource.getXMLelements(
+          {'datasource':   {
+               'BaseClass': GRSources.GRDataSource,
+               'ParentTags':  ('sources',) }
+          }))
 
 
   return xmlElements
@@ -226,12 +222,12 @@
 # xmlReportHandler
 #
 # This class is called by the XML parser to
-# process the xml file. 
+# process the xml file.
 #
 #######################################################
 
-class xmlReportHandler (xmlHandler): 
-  def __init__(self): 
-    xmlHandler.__init__(self) 
+class xmlReportHandler (GParser.xmlHandler):
+  def __init__(self):
+    GParser.xmlHandler.__init__(self)
 
     self.xmlElements = getXMLelements()
Index: gnue/reports/src/GRReport.py
diff -u gnue/reports/src/GRReport.py:1.11 gnue/reports/src/GRReport.py:1.12
--- gnue/reports/src/GRReport.py:1.11   Mon Oct  8 08:38:14 2001
+++ gnue/reports/src/GRReport.py        Wed Oct 10 00:48:02 2001
@@ -13,7 +13,7 @@
 #
 # You should have received a copy of the GNU General Public 
 # License along with program; see the file COPYING. If not, 
-# write to the Free Software Foundation, Inc., 59 Temple Place 
+# write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
 # Copyright 2000, 2001 Free Software Foundation
@@ -59,9 +59,9 @@
       object.setConnectionManager(self._connections)
       self._datasourceDictionary[object.name] = object
 
-  def dumpXML(self, treeDump=None, gap="  "):
+  def dumpXML(self, treeDump=1, gap="  "):
     return GObj.dumpXML(self, \
-        GRParser.xmlReportHandler().xmlElements, treeDump, gap)
+        GRParser.getXMLelements(), treeDump, gap)
 
 
   #
Index: gnue/reports/src/GRSources.py
diff -u gnue/reports/src/GRSources.py:1.5 gnue/reports/src/GRSources.py:1.6
--- gnue/reports/src/GRSources.py:1.5   Mon Oct  8 08:38:14 2001
+++ gnue/reports/src/GRSources.py       Wed Oct 10 00:48:02 2001
@@ -1,18 +1,18 @@
 #
 # This file is part of GNU Enterprise.
 #
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
 # version 2, or (at your option) any later version.
 #
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
-# License along with program; see the file COPYING. If not, 
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
@@ -22,7 +22,7 @@
 # GRSources.py
 #
 # DESCRIPTION:
-# Class 
+# Class
 #
 # NOTES:
 #
@@ -31,29 +31,29 @@
 
 
 from gnue.common.GObjects import *
-from gnue.common.GDataSource import GDataSource
+from gnue.common import GDataSource
 from gnue.common.GConditions import GCondition
 from gnue.common import GDebug
 import GRExceptions
 
-class GRSources (GObj): 
+class GRSources (GObj):
   def __init__(self, parent):
     GObj.__init__(self, parent, type='GRSources')
 
 
   #
   # Prepare for running
-  # 
-  def prepare(self, parameters, sortoptions): 
+  #
+  def prepare(self, parameters, sortoptions):
 
     self._parameters = parameters
-    self._sortoptions = sortoptions 
+    self._sortoptions = sortoptions
 
-    # Connect to databases    
+    # Connect to databases
     self._datasourceDictionary = {}
     self.walk(self.__initConnections)
     self.walk(self.__connectMasterDetail)
-    self.walk(self.__setUserOptions) 
+    self.walk(self.__setUserOptions)
 
 
   # Used internally by self.prepare()
@@ -90,9 +90,9 @@
     return self._datasourceDictionary[source]
 
 
-class GRDataSource (GDataSource):
+class GRDataSource (GDataSource.GDataSource):
   def __init__(self, parent):
-    GDataSource.__init__(self, parent, 'GRDataSource')
+    GDataSource.GDataSource.__init__(self, parent, 'GRDataSource')
     self.master = None
 
     self._inits =[self.primaryInit, self.secondaryInit]
@@ -136,8 +136,8 @@
   def masterResultSetChanged(self, masterResultSet, detailResultSet):
     pass
 
+
 class GRConditions(GCondition):
   def __init__(self, parent):
-    GCondition.__init__(self, parent, 'GRCondition')
-
+    GCondition.__init__(self, parent, 'GRConditions')
 



reply via email to

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