commit-gnue
[Top][All Lists]
Advanced

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

gnue/reports samples/location/zip-by-state.grd ...


From: Jason Cater
Subject: gnue/reports samples/location/zip-by-state.grd ...
Date: Mon, 25 Mar 2002 23:34:07 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/03/25 23:34:07

Modified files:
        reports/samples/location: zip-by-state.grd 
        reports/src    : GRDataMapper.py GREngine.py GRExceptions.py 
                         GRLayout.py GRParameters.py GRParser.py 
                         GRReport.py GRRun.py GRServer.py GRServices.py 
                         GRSortOptions.py GRSources.py __init__.py 

Log message:
        * updated reports to work with namespace-qualified output tags
        * moved some GObject creation logic into gnue-common's phased init 
system
        * reworked DataSource/DataObject usage to reflect current gnue-common
        * misc fixes

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/samples/location/zip-by-state.grd.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRDataMapper.py.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GREngine.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRExceptions.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRLayout.py.diff?cvsroot=OldCVS&tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRParameters.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRParser.py.diff?cvsroot=OldCVS&tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRReport.py.diff?cvsroot=OldCVS&tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRRun.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRServer.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRServices.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRSortOptions.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRSources.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/__init__.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gnue/reports/samples/location/zip-by-state.grd
diff -c gnue/reports/samples/location/zip-by-state.grd:1.8 
gnue/reports/samples/location/zip-by-state.grd:1.9
*** gnue/reports/samples/location/zip-by-state.grd:1.8  Fri Mar 22 13:31:06 2002
--- gnue/reports/samples/location/zip-by-state.grd      Mon Mar 25 23:34:06 2002
***************
*** 2,8 ****
  <report>
  
    <parameters>
!     <parameter id="state_code" type="char" description="State"/>
    </parameters>
  
  
--- 2,8 ----
  <report>
  
    <parameters>
!     <parameter id="state" type="char" description="State"/>
    </parameters>
  
  
***************
*** 25,35 ****
          <soption/>
        </sorting-->
        <conditions>
-        <condition/>
        </conditions>
      </datasource>
      <datasource name="states" database="gnue" table="state"
!        master="zips" detaillink="state" masterlink="state_code"/>
    </sources>
  
  
--- 25,34 ----
          <soption/>
        </sorting-->
        <conditions>
        </conditions>
      </datasource>
      <datasource name="states" database="gnue" table="state"
!        master="zips" detaillink="state" masterlink="state"/>
    </sources>
  
  
***************
*** 48,54 ****
  
          <field source="zips" name="zip"/>
          <section name="statedetail" source="states">
!           <field source="states" name="description"/> (<field source="zips" 
name="state_code"/>)
          </section>
  
        </section></out:group>
--- 47,53 ----
  
          <field source="zips" name="zip"/>
          <section name="statedetail" source="states">
!           <field source="states" name="description"/> (<field source="zips" 
name="state"/>)
          </section>
  
        </section></out:group>
Index: gnue/reports/src/GRDataMapper.py
diff -c gnue/reports/src/GRDataMapper.py:1.7 
gnue/reports/src/GRDataMapper.py:1.8
*** gnue/reports/src/GRDataMapper.py:1.7        Thu Oct 25 01:00:18 2001
--- gnue/reports/src/GRDataMapper.py    Mon Mar 25 23:34:07 2002
***************
*** 16,28 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000, 2001 Free Software Foundation
  #
  # FILE:
  # GRDataMapper.py
  #
  # DESCRIPTION:
! # Helper class for use by GRLayout 
  #
  # NOTES:
  #
--- 16,28 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRDataMapper.py
  #
  # DESCRIPTION:
! # Helper class for use by GRLayout
  #
  # NOTES:
  #
***************
*** 38,45 ****
  # Classes other than GRDataMapper should not
  # even care that this exists...
  #
! class GRDataMapperSection: 
!   def __init__(self, name, source, parent): 
      self.parent = parent
      self.name = name
      self.source = source
--- 38,45 ----
  # Classes other than GRDataMapper should not
  # even care that this exists...
  #
! class GRDataMapperSection:
!   def __init__(self, name, source, parent):
      self.parent = parent
      self.name = name
      self.source = source
***************
*** 49,74 ****
      self._fieldsOld = {}
      self.toplevel = 0 # Is this the first section to use a datasource
      self.initial = 1  # Are we in an initial run in which we have no history?
!     self.changed = 0  # Did this section change w/the last 
      self.grouping = 0 # Is this a "grouping" section?
      self.datasource = None
  
!     if parent != None: 
        parent.addChildSection(self)
  
  
!   # 
!   #  Are we or are any of our descendants 
    #  the specified object
    #
!   def isAncestorOf (self, mapper): 
!     if self == mapper: 
!       return 1 
!     else: 
        rv = 0
!       for section in self.sections: 
          rv = rv or section.isAncestorOf(mapper)
!         if rv: 
            break
        return rv
  
--- 49,74 ----
      self._fieldsOld = {}
      self.toplevel = 0 # Is this the first section to use a datasource
      self.initial = 1  # Are we in an initial run in which we have no history?
!     self.changed = 0  # Did this section change w/the last
      self.grouping = 0 # Is this a "grouping" section?
      self.datasource = None
  
!     if parent != None:
        parent.addChildSection(self)
  
  
!   #
!   #  Are we or are any of our descendants
    #  the specified object
    #
!   def isAncestorOf (self, mapper):
!     if self == mapper:
!       return 1
!     else:
        rv = 0
!       for section in self.sections:
          rv = rv or section.isAncestorOf(mapper)
!         if rv:
            break
        return rv
  
***************
*** 83,124 ****
    #  Add a summary
    #
    def addSummary(self, name, function):
!     if not self.summaries.has_key(name): 
        self.summaries[name] = {function:0}
!     else: 
        self.summaries[name][function] = 0
  
    #
    #  Get a field's current value
    #
!   def getField(self, name, format): 
      return GDataFormatter.applyFormatting(self.fields[name], format)
  
    #
    #  Get a summary's current value
    #
!   def getSummary(self, name, function, format): 
      return self.summaries[name][function]
  
    #
    #  Add a section
    #
!   def addChildSection(self, mapper): 
      self.sections.append(mapper)
  
    #
    #  Set initial states
    #
!   def resetState(self): 
      self.initial = 1
      self.changed = 0
  
    #
    #  Save current values before new query occurs
    #
!   def _loadFields(self, recordset): 
      self.changed = 0
!     for field in self.fields.keys(): 
        val = recordset.getField(field)
        GDebug.printMesg(10, 'self=%s,%s'%(self,self.name))
        if ( self.initial or \
--- 83,124 ----
    #  Add a summary
    #
    def addSummary(self, name, function):
!     if not self.summaries.has_key(name):
        self.summaries[name] = {function:0}
!     else:
        self.summaries[name][function] = 0
  
    #
    #  Get a field's current value
    #
!   def getField(self, name, format):
      return GDataFormatter.applyFormatting(self.fields[name], format)
  
    #
    #  Get a summary's current value
    #
!   def getSummary(self, name, function, format):
      return self.summaries[name][function]
  
    #
    #  Add a section
    #
!   def addChildSection(self, mapper):
      self.sections.append(mapper)
  
    #
    #  Set initial states
    #
!   def resetState(self):
      self.initial = 1
      self.changed = 0
  
    #
    #  Save current values before new query occurs
    #
!   def _loadFields(self, recordset):
      self.changed = 0
!     for field in self.fields.keys():
        val = recordset.getField(field)
        GDebug.printMesg(10, 'self=%s,%s'%(self,self.name))
        if ( self.initial or \
***************
*** 165,174 ****
      else:
        parentMapper = self.sectionMap[parentSection]
  
      if self.sourceMap.has_key(source) and \
         not self.sourceMap[source][0].isAncestorOf(parentMapper):
        raise GRExceptions.SourceMappedToSiblingSections, \
!          "Section %s attempts to use source %s but does not descend from %s" \
                 (section, source, self.sourceMap[source][0].name)
  
      mapper = GRDataMapperSection(section, source, parentMapper)
--- 165,178 ----
      else:
        parentMapper = self.sectionMap[parentSection]
  
+     print "parentSection=%s" % parentSection
+     print "parentMapper=%s" % parentMapper
+     print "sourceMap=%s" % self.sourceMap
+ 
      if self.sourceMap.has_key(source) and \
         not self.sourceMap[source][0].isAncestorOf(parentMapper):
        raise GRExceptions.SourceMappedToSiblingSections, \
!          "Section '%s' attempts to use source '%s', but does not descend from 
'%s'" % \
                 (section, source, self.sourceMap[source][0].name)
  
      mapper = GRDataMapperSection(section, source, parentMapper)
***************
*** 228,234 ****
    def getNextRecord(self, source):
  
      GDebug.printMesg (6, 'Getting next record for source %s' % source)
!     if source == None:
        GDebug.printMesg (6, 'No next record to return for source %s' % source)
        return None
  
--- 232,238 ----
    def getNextRecord(self, source):
  
      GDebug.printMesg (6, 'Getting next record for source %s' % source)
!     if  source == None:
        GDebug.printMesg (6, 'No next record to return for source %s' % source)
        return None
  
Index: gnue/reports/src/GREngine.py
diff -c gnue/reports/src/GREngine.py:1.8 gnue/reports/src/GREngine.py:1.9
*** gnue/reports/src/GREngine.py:1.8    Fri Oct 19 15:02:27 2001
--- gnue/reports/src/GREngine.py        Mon Mar 25 23:34:07 2002
***************
*** 16,22 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000, 2001 Free Software Foundation
  #
  # FILE:
  # GREngine.py
--- 16,22 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GREngine.py
***************
*** 66,73 ****
           "Unable to read the requested report definition\n  (%s)\n\n" % 
reportFile \
           + "Additional Information:\n  %s" % msg
  
!     GDebug.printMesg(999, '-'*60)
!     GDebug.printMesg(999, report.dumpXML(1))
!     GDebug.printMesg(999, '-'*60)
  
  
--- 66,73 ----
           "Unable to read the requested report definition\n  (%s)\n\n" % 
reportFile \
           + "Additional Information:\n  %s" % msg
  
! #    GDebug.printMesg(999, '-'*60)
! #    GDebug.printMesg(999, report.dumpXML(1))
! #    GDebug.printMesg(999, '-'*60)
  
  
Index: gnue/reports/src/GRExceptions.py
diff -c gnue/reports/src/GRExceptions.py:1.4 
gnue/reports/src/GRExceptions.py:1.5
*** gnue/reports/src/GRExceptions.py:1.4        Sat Oct 20 03:07:12 2001
--- gnue/reports/src/GRExceptions.py    Mon Mar 25 23:34:07 2002
***************
*** 16,22 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000, 2001 Free Software Foundation
  #
  # FILE:
  # GRExceptions.py
--- 16,22 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRExceptions.py
Index: gnue/reports/src/GRLayout.py
diff -c gnue/reports/src/GRLayout.py:1.12 gnue/reports/src/GRLayout.py:1.13
*** gnue/reports/src/GRLayout.py:1.12   Sat Oct 20 03:07:12 2001
--- gnue/reports/src/GRLayout.py        Mon Mar 25 23:34:07 2002
***************
*** 1,33 ****
  #
  # 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 
  # 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 
  # 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 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000, 2001 Free Software Foundation
  #
  # FILE:
  # GRLayout.py
  #
  # DESCRIPTION:
! # Class
  #
  # NOTES:
  #
- # HISTORY:
- #
  
  
  from gnue.common.GObjects import *
--- 1,31 ----
  #
  # 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
  # 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
  # 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
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRLayout.py
  #
  # DESCRIPTION:
! # Classes related to the Layout section
  #
  # NOTES:
  #
  
  
  from gnue.common.GObjects import *
***************
*** 36,49 ****
  import string
  
  
! 
  # Used to send structural comment
  # Chose not to do  "if COMMENT == 1: dest.write"
  # for performance reasons
! def _structuralComment(dest, text): 
    dest.write(text)
  
! def _noStructuralComment(dest, text): 
    pass
  
  structuralComment = _noStructuralComment
--- 34,49 ----
  import string
  
  
! ############################################################
! #
  # Used to send structural comment
  # Chose not to do  "if COMMENT == 1: dest.write"
  # for performance reasons
! #
! def _structuralComment(dest, text):
    dest.write(text)
  
! def _noStructuralComment(dest, text):
    pass
  
  structuralComment = _noStructuralComment
***************
*** 60,65 ****
--- 60,66 ----
    def _buildObject(self):
      # If there is more than one object attached to a layout
      # object, then create an unbound section to contain them.
+     # This is a convenience for the layout engine code :)
  
      if len(self._children) > 1:
  
***************
*** 89,113 ****
      if isinstance(object, GRLayoutElement):
  
  
!       # TODO: Move to GRLayoutElement's phaseInit system.
! 
!       # If section/field/summary does not have a source,
!       # inherit parent's source (if available)
! 
!       if object.source == None and \
!          isinstance(object._parent, GRLayoutElement):
! 
!         object.source = object._parent.source
! 
!         if object.source == None and isinstance(object, GRField):
!           raise LayoutFieldHasNoSource, \
!              'Field "%s" in section "%s" does not connect to a source' \
!                  % (object.name, object.getParentOfType('GRSection').name)
! 
!         if object.source == None and isinstance(object, GRSumm):
!           raise LayoutSummaryHasNoSource, \
!              'Summary "%s" in section "%s" does not connect to a source' \
!                  % (object.name, object.getParentOfType('GRSection').name)
  
  
  
--- 90,115 ----
      if isinstance(object, GRLayoutElement):
  
  
! ##      # TODO: Move to GRLayoutElement's phaseInit system.
! ##
! ##      # If section/field/summary does not have a source,
! ##      # inherit parent's source (if available)
! ##
! ##      if object._source == None and \
! ##         isinstance(object._parent, GRLayoutElement):
! ##
! ##        print "Setting %s's source to %s" % (object.name, 
object._parent._source)
! ##        object._source = object._parent._source
! ##
! ##        if object._source == None and isinstance(object, GRField):
! ##          raise LayoutFieldHasNoSource, \
! ##             'Field "%s" in section "%s" does not connect to a source' \
! ##                 % (object.name, object.getParentOfType('GRSection').name)
! ##
! ##        if object._source == None and isinstance(object, GRSumm):
! ##          raise LayoutSummaryHasNoSource, \
! ##             'Summary "%s" in section "%s" does not connect to a source' \
! ##                 % (object.name, object.getParentOfType('GRSection').name)
  
  
  
***************
*** 121,141 ****
        # TODO: the various functions to the actual child
        # TODO: object's phaseInits.
  
!       if isinstance(object, GRSection) and object.source != None:
!         if isinstance(object._parent, GRLayout):
!           self._mapper.addSection(object.name, object.source, None)
          else:
!           self._mapper.addSection(object.name, \
!               object.source, object._parent.name)
          object._mymapper = self._mapper.sectionMap[object.name]
          object._mymapper._object = object
  
        elif isinstance(object, GRField):
!         s = object._parent.getAncestorWithSource(object.source)
          if s == None:
            raise SourceOutOfScope, \
                  'Field "%s" in section "%s" uses out-of-scope source "%s"' \
!                      % (object.name, object._parent.name, object.source)
  
          object._section = s.name
          object._mymapper = self._mapper.sectionMap[object._section]
--- 123,146 ----
        # TODO: the various functions to the actual child
        # TODO: object's phaseInits.
  
!       parentSection = object.findParentOfType('GRSection',includeSelf=0)
! 
!       if isinstance(object, GRSection) and object._source != None:
!         if parentSection is None:
!           self._mapper.addSection(object.name, object._source, None)
          else:
!           self._mapper.addSection(object.name,
!                                   object._source,
!                                   parentSection.name)
          object._mymapper = self._mapper.sectionMap[object.name]
          object._mymapper._object = object
  
        elif isinstance(object, GRField):
!         s = parentSection.getAncestorWithSource(object._source)
          if s == None:
            raise SourceOutOfScope, \
                  'Field "%s" in section "%s" uses out-of-scope source "%s"' \
!                      % (object.name, parentSection.name, object._source)
  
          object._section = s.name
          object._mymapper = self._mapper.sectionMap[object._section]
***************
*** 146,163 ****
  
        elif isinstance(object, GRSumm):
          if object.section == None:
!           s = object._parent.getAncestorWithSource(object.source)
            if s == None:
              raise SourceOutOfScope, \
                'Summary "%s" in section "%s" uses out-of-scope source "%s"' \
!                    % (object.name, object._parent.name, object.source)
          else:
            s = self._mapper.sectionMap[object.section].\
!                  getAncestorWithSource(object.source)
            if s == None:
              raise SourceOutOfScope, \
                'Summary "%s" in section "%s" uses out-of-scope source "%s"' \
!                    % (object.name, object._parent.name, object.source)
  
          object._section = s.name
          object._mymapper = self._mapper.sectionMap[object._section]
--- 151,168 ----
  
        elif isinstance(object, GRSumm):
          if object.section == None:
!           s = object._parent.getAncestorWithSource(object._source)
            if s == None:
              raise SourceOutOfScope, \
                'Summary "%s" in section "%s" uses out-of-scope source "%s"' \
!                    % (object.name, object._parent.name, object._source)
          else:
            s = self._mapper.sectionMap[object.section].\
!                  getAncestorWithSource(object._source)
            if s == None:
              raise SourceOutOfScope, \
                'Summary "%s" in section "%s" uses out-of-scope source "%s"' \
!                    % (object.name, object._parent.name, object._source)
  
          object._section = s.name
          object._mymapper = self._mapper.sectionMap[object._section]
***************
*** 201,222 ****
    def __init__(self, parent=None, type='GRLayoutElement'):
      GObj.__init__(self, parent, type=type)
      self.name = None
!     self.source = None
      self._mymapper = None
  
    # Called if section contains data
    def process(self, dest, mapper):
      pass
  
  
  ############################################################
  #
  # <section> tag
  #
! class GRSection (GRLayoutElement):
  
    def __init__(self, parent):
!     GRLayoutElement.__init__(self, parent, 'GRSection')
  
  
    # Retrieve the first row of data, if available.
--- 206,260 ----
    def __init__(self, parent=None, type='GRLayoutElement'):
      GObj.__init__(self, parent, type=type)
      self.name = None
!     self._source = None
      self._mymapper = None
+     self._inits = [self.primaryInit]
  
    # Called if section contains data
    def process(self, dest, mapper):
      pass
  
+   def primaryInit(self):
+     if hasattr(self,'source') and self.source is not None:
+       self._source = self.source
+     else:
+       try:
+         self._source = self._parent._source
+       except AttributeError:
+         self._source = None
+ 
+ 
+ ############################################################
+ #
+ # Any elements contained within a <layout> element
+ # that can themselves be containers
+ #
+ class ContainerElement (GRLayoutElement):
+   def __init__(self, parent=None, type='GRContainerElement'):
+     GRLayoutElement.__init__(self, parent, type=type)
+ 
+ 
+   def processChildren(self, dest, mapper):
+     for child in self._children:
+       if child.getObjectType() == "_content_":
+         dest.write(child.getContent())
+       else:
+         if isinstance(child, GRSection) and child._mymapper.toplevel:
+           GDebug.printMesg(10, "Calling new controlling section")
+           child.processAsController(dest, mapper)
+         else:
+           child.process(dest, mapper)
+ 
+ 
  
  ############################################################
  #
  # <section> tag
  #
! class GRSection (ContainerElement):
  
    def __init__(self, parent):
!     ContainerElement.__init__(self, parent, 'GRSection')
  
  
    # Retrieve the first row of data, if available.
***************
*** 230,242 ****
      GDebug.printMesg(10,
         "Controlling section %s's processAsController() called" % self.name)
  
!     if self.source == None:
        # This is a dataless section...
        # simply process it's children
  
        self.process(dest, mapper)
  
!     elif mapper.getFirstRecord(self.source):
        # This is a data-bound section and there
        # was data returned, so process section
  
--- 268,280 ----
      GDebug.printMesg(10,
         "Controlling section %s's processAsController() called" % self.name)
  
!     if self._source == None:
        # This is a dataless section...
        # simply process it's children
  
        self.process(dest, mapper)
  
!     elif mapper.getFirstRecord(self._source):
        # This is a data-bound section and there
        # was data returned, so process section
  
***************
*** 248,254 ****
  
          # Determine the next section to process our data.
          # (i.e., handle section grouping)
!         goto = mapper.getNextRecord(self.source)
          GDebug.printMesg (10, "Goto is '%s'" % goto)
  
          if goto == None:
--- 286,292 ----
  
          # Determine the next section to process our data.
          # (i.e., handle section grouping)
!         goto = mapper.getNextRecord(self._source)
          GDebug.printMesg (10, "Goto is '%s'" % goto)
  
          if goto == None:
***************
*** 265,297 ****
          if isinstance (c2, GRDefault):
            c2.processDefault(dest, mapper)
  
-           
- 
-   # Generic process() method.  Process the
-   # current record and handle any children.
-   def process(self, dest, mapper):
- 
-     GDebug.printMesg(10,"Repeating Section %s" % self.name)
-     structuralComment(dest,"<!--[section:%s]-->" % self.name)
- 
-     for child in self._children:
-       if child.getObjectType() == "_content_":
-         dest.write(child.getContent())
-       else:
-         if isinstance(child, GRSection) and child._mymapper.toplevel:
-           GDebug.printMesg(10, "Calling new controlling section")
-           child.processAsController(dest, mapper)
-         else:
-           child.process(dest, mapper)
- 
-     GDebug.printMesg(10,"Laving section %s" % self.name)
- 
- 
    #
    #  getAncestorWithSource()
    #
    def getAncestorWithSource(self, source):
!     if self.source == source:
        return self
      elif isinstance(self._parent, GRSection):
        return self._parent.getAncestorWithSource(source)
--- 303,313 ----
          if isinstance (c2, GRDefault):
            c2.processDefault(dest, mapper)
  
    #
    #  getAncestorWithSource()
    #
    def getAncestorWithSource(self, source):
!     if self._source == source:
        return self
      elif isinstance(self._parent, GRSection):
        return self._parent.getAncestorWithSource(source)
***************
*** 299,319 ****
        return None
  
  
  ############################################################
  #
! # <default> tag 
! # Text in this tag is only displayed if datasource  
! # returns no data. Note: this will be the only thing 
  # in the section that will be displayed.
  #
! class GRDefault (GObj): 
    def __init__(self, parent=None, type='GRDefault'):
      GObj.__init__(self, parent, type=type)
      self.name = None
!     self.source = None
      self._mymapper = None
!     
!   def processDefault(self, dest, mapper): 
      structuralComment(dest,"<!--[default]-->")
      for child in self._children:
        if child.getObjectType() == "_content_":
--- 315,346 ----
        return None
  
  
+   # Generic process() method.  Process the
+   # current record and handle any children.
+   def process(self, dest, mapper):
+ 
+     GDebug.printMesg(10,"Repeating Section %s" % self.name)
+     structuralComment(dest,"<!--[section:%s]-->" % self.name)
+     self.processChildren(dest, mapper)
+     structuralComment(dest,"<!--[/section:%s]-->" % self.name)
+     GDebug.printMesg(10,"Leaving section %s" % self.name)
+ 
+ 
  ############################################################
  #
! # <default> tag
! # Text in this tag is only displayed if datasource
! # returns no data. Note: this will be the only thing
  # in the section that will be displayed.
  #
! class GRDefault (GObj):
    def __init__(self, parent=None, type='GRDefault'):
      GObj.__init__(self, parent, type=type)
      self.name = None
!     self._source = None
      self._mymapper = None
! 
!   def processDefault(self, dest, mapper):
      structuralComment(dest,"<!--[default]-->")
      for child in self._children:
        if child.getObjectType() == "_content_":
***************
*** 379,383 ****
--- 406,440 ----
  
  
  
+ 
+ ############################################################
+ #
+ # Any namespaced tags designed to
+ # simply pass thru our layout engine
+ #
+ class GRPassThru(ContainerElement):
+   def __init__(self, parent):
+     ContainerElement.__init__(self, parent, 'GRPassThru')
+ 
+   def process(self, dest, mapper):
+     dest.write('<%s' % self._xmltag)
+     for attr in self._loadedxmlattrs.keys():
+       dest.write(' %s="%s"' % (attr, 
saxutils.escape(str(self._loadedxmlattrs[attr]))))
+ 
+     if len(self._children):
+       dest.write('>')
+       self.processChildren(dest, mapper)
+       dest.write('</%s>' % self._xmltag)
+     else:
+       dest.write('/>')
+ 
+   #
+   #  getAncestorWithSource()
+   #
+   def getAncestorWithSource(self, source):
+     if isinstance(self._parent, GRSection):
+       return self._parent.getAncestorWithSource(source)
+     else:
+       return None
  
  
Index: gnue/reports/src/GRParameters.py
diff -c gnue/reports/src/GRParameters.py:1.4 
gnue/reports/src/GRParameters.py:1.5
*** gnue/reports/src/GRParameters.py:1.4        Tue May 29 22:19:49 2001
--- gnue/reports/src/GRParameters.py    Mon Mar 25 23:34:07 2002
***************
*** 16,22 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000, 2001 Free Software Foundation
  #
  # FILE:
  # GRParameters.py
--- 16,22 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRParameters.py
Index: gnue/reports/src/GRParser.py
diff -c gnue/reports/src/GRParser.py:1.15 gnue/reports/src/GRParser.py:1.16
*** gnue/reports/src/GRParser.py:1.15   Fri Mar 22 02:38:36 2002
--- gnue/reports/src/GRParser.py        Mon Mar 25 23:34:07 2002
***************
*** 11,28 ****
  # 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 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000, 2001 Free Software Foundation
  #
  # FILE:
  # GRParser.py
  #
  # DESCRIPTION:
! # Class that contains a sax based xml processor for GNUE reports
  #
  # NOTES:
  #
--- 11,28 ----
  # 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
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRParser.py
  #
  # DESCRIPTION:
! # Class that contains a sax based xml processor for GNUe Reports
  #
  # NOTES:
  #
***************
*** 144,150 ****
           'BaseClass': GRLayout.GRLayout,
           'Required': 1,
           'SingleInstance': 1,
!          'MixedContent': 1, 
           'Attributes': {
              'format':      {
                 'Typecast': GTypecast.name } },
--- 144,150 ----
           'BaseClass': GRLayout.GRLayout,
           'Required': 1,
           'SingleInstance': 1,
!          'MixedContent': 1,
           'Attributes': {
              'format':      {
                 'Typecast': GTypecast.name } },
***************
*** 232,234 ****
--- 232,244 ----
      GParser.xmlHandler.__init__(self)
  
      self.xmlElements = getXMLelements()
+ 
+     #
+     # Any namespace-qualified tags will be Pass-Thru tags..
+     # The reporting engine actually doesn't care about these.
+     #
+     # TODO: This is a hack and won't work if we proxy
+     # TODO: layout events and create layout engines. ??
+     #
+     self.xmlMasqueradeNamespaceElements = GRLayout.GRPassThru
+ 
Index: gnue/reports/src/GRReport.py
diff -c gnue/reports/src/GRReport.py:1.16 gnue/reports/src/GRReport.py:1.17
*** gnue/reports/src/GRReport.py:1.16   Thu Oct 25 01:00:18 2001
--- gnue/reports/src/GRReport.py        Mon Mar 25 23:34:07 2002
***************
*** 16,22 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000, 2001 Free Software Foundation
  #
  # FILE:
  # GRReport.py
--- 16,22 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRReport.py
***************
*** 49,55 ****
  
    def initialize(self):
      self.walk(self.__buildDataSources)
!     #self.initialize()
  
    # TODO: This is duplicating functionality in GRSources.prepare!!
    def __buildDataSources(self, object):
--- 49,55 ----
  
    def initialize(self):
      self.walk(self.__buildDataSources)
! 
  
    # TODO: This is duplicating functionality in GRSources.prepare!!
    def __buildDataSources(self, object):
***************
*** 60,66 ****
        self._datasourceDictionary[object.name] = object
  
    def dumpXML(self, treeDump=1, gap="  "):
!     return GObj.dumpXML(self, \
          GRParser.getXMLelements(), treeDump, gap)
  
  
--- 60,66 ----
        self._datasourceDictionary[object.name] = object
  
    def dumpXML(self, treeDump=1, gap="  "):
!     return GObj.dumpXML(self, 
          GRParser.getXMLelements(), treeDump, gap)
  
  
Index: gnue/reports/src/GRRun.py
diff -c gnue/reports/src/GRRun.py:1.4 gnue/reports/src/GRRun.py:1.5
*** gnue/reports/src/GRRun.py:1.4       Mon Oct 22 19:01:34 2001
--- gnue/reports/src/GRRun.py   Mon Mar 25 23:34:07 2002
***************
*** 22,28 ****
  # GRRun.py
  #
  # DESCRIPTION:
! # Class that loads and populates a report 
  #
  # NOTES:
  #
--- 22,28 ----
  # GRRun.py
  #
  # DESCRIPTION:
! # Class that loads and populates a report
  #
  # NOTES:
  #
***************
*** 70,77 ****
            '-p specifies the email address.) If <dest> is "-", then output is '
            'sent to stdout -- NOTE: when sending to stdout, also use the -q '
            '[--quiet] option or you may get junk in your output stream. '
!           '\n[NOT YET IMPLEMENTED]'], 
!       [ 'filter', 'f', 'filter', 1, 'raw', 'filt',  
            'Select the filter to be used to process report output.  <filt> '
            'is the name of the filtering process as defined on the Report '
            'Server machine. If not specified, the "raw" filter is used '
--- 70,77 ----
            '-p specifies the email address.) If <dest> is "-", then output is '
            'sent to stdout -- NOTE: when sending to stdout, also use the -q '
            '[--quiet] option or you may get junk in your output stream. '
!           '\n[NOT YET IMPLEMENTED]'],
!       [ 'filter', 'f', 'filter', 1, 'raw', 'filt',
            'Select the filter to be used to process report output.  <filt> '
            'is the name of the filtering process as defined on the Report '
            'Server machine. If not specified, the "raw" filter is used '
***************
*** 120,126 ****
      GClientApp.__init__(self)
      lh = LoginHandler()
  
!     try: 
        if len(self.OPTIONS['user']):
          lh.defaults['_username'] = self.OPTIONS['user']
        if len(self.OPTIONS['password']):
--- 120,126 ----
      GClientApp.__init__(self)
      lh = LoginHandler()
  
!     try:
        if len(self.OPTIONS['user']):
          lh.defaults['_username'] = self.OPTIONS['user']
        if len(self.OPTIONS['password']):
***************
*** 156,164 ****
  
      userParameters = {}
  
!     for param in paramList: 
        psplit = string.split(param,'=',1)
!       if len(psplit) == 1: 
          self.handleStartupError ( \
              'Parameter "%s" specified, but no value supplied.' % psplit[0] )
        userParameters[lower(psplit[0])] = psplit[1]
--- 156,164 ----
  
      userParameters = {}
  
!     for param in paramList:
        psplit = string.split(param,'=',1)
!       if len(psplit) == 1:
          self.handleStartupError ( \
              'Parameter "%s" specified, but no value supplied.' % psplit[0] )
        userParameters[lower(psplit[0])] = psplit[1]
***************
*** 170,177 ****
      #
      # Get the user supplied sortoption
      #
!     if len(self.OPTIONS["sortoption"]): 
!       sortoption = self.OPTIONS["sortoption"] 
      else:
        sortoption = None
  
--- 170,177 ----
      #
      # Get the user supplied sortoption
      #
!     if len(self.OPTIONS["sortoption"]):
!       sortoption = self.OPTIONS["sortoption"]
      else:
        sortoption = None
  
***************
*** 218,256 ****
  #
  from gnue.common import GLoginHandler
  import getpass
! class LoginHandler(GLoginHandler.LoginHandler): 
  
    defaults = {'_username': None, '_password': None}
  
!   def getLogin(self, loginData): 
      try:
        quietprint ( "*"*60 )
!       if len(loginData[1]): 
          quietprint ( 'Attempting to log into "%s" (%s):' % (loginData[1], 
loginData[0]) )
!       else: 
          quietprint ( 'Attempting to log into %s:' % (loginData[0]) )
        quietprint ("")
!       val = {} 
!       for prompt in loginData[2]: 
!          if self.defaults.has_key(prompt[0])  and self.defaults[prompt[0]]: 
             quietprint_nl ( "  %s: " % prompt[1] )
!            if prompt[2]: 
               quietprint ( "***" )
             else:
               quietprint ( self.defaults[prompt[0]] )
             val[prompt[0]] = self.defaults[prompt[0]]
!          else: 
!            if prompt[2]: 
               val[prompt[0]] = getpass.getpass("  %s: " % prompt[1])
!            else: 
               val[prompt[0]] = raw_input("  %s: " % prompt[1])
        quietprint ("")
        quietprint ("*"*60)
        return val
!     except KeyboardInterrupt: 
        raise GLoginHandler.UserCanceledLogin
  
  
  
  if __name__ == '__main__':
    GRRun().run()
--- 218,258 ----
  #
  from gnue.common import GLoginHandler
  import getpass
! class LoginHandler(GLoginHandler.LoginHandler):
  
    defaults = {'_username': None, '_password': None}
  
!   def getLogin(self, loginData, error):
      try:
        quietprint ( "*"*60 )
!       if len(loginData[1]):
          quietprint ( 'Attempting to log into "%s" (%s):' % (loginData[1], 
loginData[0]) )
!       else:
          quietprint ( 'Attempting to log into %s:' % (loginData[0]) )
        quietprint ("")
!       val = {}
!       for prompt in loginData[2]:
!          if self.defaults.has_key(prompt[0])  and self.defaults[prompt[0]]:
             quietprint_nl ( "  %s: " % prompt[1] )
!            if prompt[2]:
               quietprint ( "***" )
             else:
               quietprint ( self.defaults[prompt[0]] )
             val[prompt[0]] = self.defaults[prompt[0]]
!          else:
!            if prompt[2]:
               val[prompt[0]] = getpass.getpass("  %s: " % prompt[1])
!            else:
               val[prompt[0]] = raw_input("  %s: " % prompt[1])
        quietprint ("")
        quietprint ("*"*60)
        return val
!     except KeyboardInterrupt:
        raise GLoginHandler.UserCanceledLogin
  
  
+   def destroyLoginDialog(self):
+     pass
  
  if __name__ == '__main__':
    GRRun().run()
Index: gnue/reports/src/GRServer.py
diff -c gnue/reports/src/GRServer.py:1.3 gnue/reports/src/GRServer.py:1.4
*** gnue/reports/src/GRServer.py:1.3    Thu Oct 25 01:00:18 2001
--- gnue/reports/src/GRServer.py        Mon Mar 25 23:34:07 2002
***************
*** 16,22 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2001 Free Software Foundation
  #
  # FILE:
  # GRServer.py
--- 16,22 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRServer.py
Index: gnue/reports/src/GRServices.py
diff -c gnue/reports/src/GRServices.py:1.3 gnue/reports/src/GRServices.py:1.4
*** gnue/reports/src/GRServices.py:1.3  Tue Oct 30 01:13:21 2001
--- gnue/reports/src/GRServices.py      Mon Mar 25 23:34:07 2002
***************
*** 16,22 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2001 Free Software Foundation
  #
  # FILE:
  # GRServices.py
--- 16,22 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRServices.py
Index: gnue/reports/src/GRSortOptions.py
diff -c gnue/reports/src/GRSortOptions.py:1.4 
gnue/reports/src/GRSortOptions.py:1.5
*** gnue/reports/src/GRSortOptions.py:1.4       Mon Oct  8 08:38:14 2001
--- gnue/reports/src/GRSortOptions.py   Mon Mar 25 23:34:07 2002
***************
*** 16,22 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000, 2001 Free Software Foundation
  #
  # FILE:
  # GRSortOptions.py
--- 16,22 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRSortOptions.py
Index: gnue/reports/src/GRSources.py
diff -c gnue/reports/src/GRSources.py:1.8 gnue/reports/src/GRSources.py:1.9
*** gnue/reports/src/GRSources.py:1.8   Mon Feb 11 22:03:50 2002
--- gnue/reports/src/GRSources.py       Mon Mar 25 23:34:07 2002
***************
*** 16,22 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2001 Free Software Foundation
  #
  # FILE:
  # GRSources.py
--- 16,22 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GRSources.py
***************
*** 26,33 ****
  #
  # NOTES:
  #
- # HISTORY:
- #
  
  
  from gnue.common.GObjects import *
--- 26,31 ----
***************
*** 94,105 ****
    def __init__(self, parent):
      GDataSource.GDataSource.__init__(self, parent, 'GRDataSource')
      self._toplevelParent = 'GRReport'
! #    self.master = None
  
  #    self._inits =[self.primaryInit, self.secondaryInit]
      # self._currentResultSet = None
      # self._resultSetListeners = []
!         
  
    #  Used in GRSources.__connectMasterDetail to link detail datasource to
    #  master source.  Called by GDataObjects.ResultSet when master changed
--- 92,103 ----
    def __init__(self, parent):
      GDataSource.GDataSource.__init__(self, parent, 'GRDataSource')
      self._toplevelParent = 'GRReport'
!     self.master = None
  
  #    self._inits =[self.primaryInit, self.secondaryInit]
      # self._currentResultSet = None
      # self._resultSetListeners = []
! 
  
    #  Used in GRSources.__connectMasterDetail to link detail datasource to
    #  master source.  Called by GDataObjects.ResultSet when master changed
Index: gnue/reports/src/__init__.py
diff -c gnue/reports/src/__init__.py:1.3 gnue/reports/src/__init__.py:1.4
*** gnue/reports/src/__init__.py:1.3    Fri Jan 11 02:35:56 2002
--- gnue/reports/src/__init__.py        Mon Mar 25 23:34:07 2002
***************
*** 1,6 ****
  #
- # Copyright 2001 Free Software Foundation
- #
  # This file is part of GNU Enterprise.
  #
  # GNU Enterprise is free software; you can redistribute it
--- 1,4 ----
***************
*** 12,17 ****
--- 10,17 ----
  # 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.
+ #
+ # Copyright 2000-2002 Free Software Foundation
  #
  # You should have received a copy of the GNU General Public
  # License along with program; see the file COPYING. If not,



reply via email to

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