[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/reports samples/foobulations/monthly.grd s...
From: |
Jason Cater |
Subject: |
gnue/reports samples/foobulations/monthly.grd s... |
Date: |
Thu, 04 Apr 2002 18:38:21 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/04/04 18:38:21
Modified files:
reports/samples/foobulations: monthly.grd
reports/src : GRDataMapper.py GRLayout.py GRParameters.py
GRParser.py GRReport.py
Log message:
more work on user-set parameters; added firstRow and notFirstRow logic
to <section>s; misc bug fixes [synching machines]
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/samples/foobulations/monthly.grd.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRDataMapper.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRLayout.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRParameters.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRParser.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRReport.py.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
Patches:
Index: gnue/reports/samples/foobulations/monthly.grd
diff -c gnue/reports/samples/foobulations/monthly.grd:1.1
gnue/reports/samples/foobulations/monthly.grd:1.2
*** gnue/reports/samples/foobulations/monthly.grd:1.1 Wed Apr 3 18:52:54 2002
--- gnue/reports/samples/foobulations/monthly.grd Thu Apr 4 18:38:20 2002
***************
*** 1,10 ****
<report>
<sources>
<datasource name="dtsFoo" table="foobulations"/>
</sources>
! <layout xmlns:out="GNUe:Reports:SimpleTabulation:0.0.1">
<out:reportTitle>Monthly Accounting Foobulation Report</out:reportTitle>
--- 1,16 ----
+ <?xml version="1.0"?>
<report>
+ <parameters>
+ <parameter name="subtitle" description="Report Subtitle"
+ default="Subtitle Not Provided"/>
+ </parameters>
+
<sources>
<datasource name="dtsFoo" table="foobulations"/>
</sources>
! <layout xmlns:out="GNUe:Reports:UnsupportedSimple:0.0.1">
<out:reportTitle>Monthly Accounting Foobulation Report</out:reportTitle>
***************
*** 23,29 ****
<notFirstRow><out:col/></notFirstRow>
<out:col><field name="foodate"/></out:col>
<out:col><field name="foobs"/></out:col>
! <section>
<default>
<out:col>(No results to display)</out:col>
<out:col/>
--- 29,35 ----
<notFirstRow><out:col/></notFirstRow>
<out:col><field name="foodate"/></out:col>
<out:col><field name="foobs"/></out:col>
! </section>
<default>
<out:col>(No results to display)</out:col>
<out:col/>
***************
*** 35,38 ****
</out:section>
</layout>
! </report>
\ No newline at end of file
--- 41,44 ----
</out:section>
</layout>
! </report>
Index: gnue/reports/src/GRDataMapper.py
diff -c gnue/reports/src/GRDataMapper.py:1.8
gnue/reports/src/GRDataMapper.py:1.9
*** gnue/reports/src/GRDataMapper.py:1.8 Mon Mar 25 23:34:07 2002
--- gnue/reports/src/GRDataMapper.py Thu Apr 4 18:38:20 2002
***************
*** 47,56 ****
self.fields = {}
self.summaries = {}
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:
--- 47,56 ----
self.fields = {}
self.summaries = {}
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:
Index: gnue/reports/src/GRLayout.py
diff -c gnue/reports/src/GRLayout.py:1.14 gnue/reports/src/GRLayout.py:1.15
*** gnue/reports/src/GRLayout.py:1.14 Thu Apr 4 00:55:37 2002
--- gnue/reports/src/GRLayout.py Thu Apr 4 18:38:20 2002
***************
*** 90,119 ****
def __prepare(self, object):
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)
-
-
-
# This all looks confusing, but basically it simply figures out
# what section a field or summary actually pulls from and also
# makes sure a section, field, or summary isn't trying to use
--- 90,95 ----
***************
*** 212,218 ****
self._inits = [self.primaryInit]
# Called if section contains data
! def process(self, dest, mapper):
pass
def primaryInit(self):
--- 188,194 ----
self._inits = [self.primaryInit]
# Called if section contains data
! def process(self, dest, mapper, isfirst=0):
pass
def primaryInit(self):
***************
*** 235,241 ****
GRLayoutElement.__init__(self, parent, type=type)
! def processChildren(self, dest, mapper):
for child in self._children:
if child.getObjectType() == "_content_":
dest.write(child.getContent())
--- 211,217 ----
GRLayoutElement.__init__(self, parent, type=type)
! def processChildren(self, dest, mapper, isfirst=0):
for child in self._children:
if child.getObjectType() == "_content_":
dest.write(child.getContent())
***************
*** 244,250 ****
GDebug.printMesg(10, "Calling new controlling section")
child.processAsController(dest, mapper)
else:
! child.process(dest, mapper)
--- 220,235 ----
GDebug.printMesg(10, "Calling new controlling section")
child.processAsController(dest, mapper)
else:
! child.process(dest, mapper, isfirst)
!
! #
! # getAncestorWithSource()
! #
! def getAncestorWithSource(self, source):
! if isinstance(self._parent, GRSection):
! return self._parent.getAncestorWithSource(source)
! else:
! return None
***************
*** 273,289 ****
# 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
section = self
while section:
# Process the current data row starting at correct section
! section.process(dest, mapper)
# Determine the next section to process our data.
# (i.e., handle section grouping)
--- 258,276 ----
# This is a dataless section...
# simply process it's children
! self.process(dest, mapper, 1)
elif mapper.getFirstRecord(self._source):
# This is a data-bound section and there
# was data returned, so process section
+ oldSection = None
section = self
+
while section:
# Process the current data row starting at correct section
! section.process(dest, mapper, isfirst=(oldSection == section))
# Determine the next section to process our data.
# (i.e., handle section grouping)
***************
*** 293,298 ****
--- 280,286 ----
if goto == None:
section = None
else:
+ oldSection = section
section = mapper.sectionMap[goto]._object
else:
***************
*** 318,328 ****
# 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)
--- 306,316 ----
# Generic process() method. Process the
# current record and handle any children.
! def process(self, dest, mapper, isfirst=0):
GDebug.printMesg(10,"Repeating Section %s" % self.name)
structuralComment(dest,"<!--[section:%s]-->" % self.name)
! self.processChildren(dest, mapper, isfirst)
structuralComment(dest,"<!--[/section:%s]-->" % self.name)
GDebug.printMesg(10,"Leaving section %s" % self.name)
***************
*** 348,354 ****
dest.write(child.getContent())
structuralComment(dest,"<!--[/default]-->")
! def process(self, dest, mapper):
pass
--- 336,342 ----
dest.write(child.getContent())
structuralComment(dest,"<!--[/default]-->")
! def process(self, dest, mapper, isfirst=0):
pass
***************
*** 362,368 ****
self._section = None
self.format = None
! def process(self, dest, mapper):
structuralComment(dest,"<!--[field:%s]-->" % self.name)
dest.write (self._mymapper.getField(self.name, self.format))
structuralComment(dest,"<!--[/field:%s]-->" % self.name)
--- 350,356 ----
self._section = None
self.format = None
! def process(self, dest, mapper, isfirst=0):
structuralComment(dest,"<!--[field:%s]-->" % self.name)
dest.write (self._mymapper.getField(self.name, self.format))
structuralComment(dest,"<!--[/field:%s]-->" % self.name)
***************
*** 382,388 ****
self.name = ""
self._value = ""
! def process(self, dest, mapper):
structuralComment(dest,"<!--[param:%s]-->" % self.name)
if self._value != None:
dest.write ("%s" % self._value)
--- 370,376 ----
self.name = ""
self._value = ""
! def process(self, dest, mapper, isfirst=0):
structuralComment(dest,"<!--[param:%s]-->" % self.name)
if self._value != None:
dest.write ("%s" % self._value)
***************
*** 400,406 ****
self.function = "count"
self.format = None
! def process(self, dest, mapper):
structuralComment(dest,"<!--[summ:%s]-->" % self.name)
dest.write (self._mymapper.getSummary(self.name, self.function,
self.format))
structuralComment(dest,"<!--[/summ:%s]-->" % self.name)
--- 388,394 ----
self.function = "count"
self.format = None
! def process(self, dest, mapper, isfirst=0):
structuralComment(dest,"<!--[summ:%s]-->" % self.name)
dest.write (self._mymapper.getSummary(self.name, self.function,
self.format))
structuralComment(dest,"<!--[/summ:%s]-->" % self.name)
***************
*** 415,423 ****
_typestub = 'GRParam'
def __init__(self, parent):
! GRLayoutElement.__init__(self, *args, **parms)
! GRStubParam.__init__(self, *args, **parms)
############################################################
--- 403,443 ----
_typestub = 'GRParam'
def __init__(self, parent):
! GRLayoutElement.__init__(self, parent)
! GRStubParam.__init__(self, parent)
!
!
!
! ############################################################
! #
! # Logic support within sections
! #
!
! class GRFirstRow(ContainerElement):
! def __init__(self, parent):
! ContainerElement.__init__(self, parent, 'GRFirstRow')
!
! def process(self, dest, mapper, isfirst=0):
! if isfirst:
! self.processChildren(dest, mapper, isfirst)
!
!
! class GRNotFirstRow(ContainerElement):
! def __init__(self, parent):
! ContainerElement.__init__(self, parent, 'GRNotFirstRow')
!
! def process(self, dest, mapper, isfirst=0):
! if not isfirst:
! self.processChildren(dest, mapper, isfirst)
+ #
+ #class GRLastRow(LogicStub):
+ # _typestub = 'GRLastRow'
+ #
+ #
+ #class GRLastRow(LogicStub):
+ # _typestub = 'GRNotLastRow'
+ #
############################################################
***************
*** 429,453 ****
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
--- 449,464 ----
def __init__(self, parent):
ContainerElement.__init__(self, parent, 'GRPassThru')
! def process(self, dest, mapper, isfirst=0):
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, isfirst)
dest.write('</%s>' % self._xmltag)
else:
dest.write('/>')
Index: gnue/reports/src/GRParameters.py
diff -c gnue/reports/src/GRParameters.py:1.6
gnue/reports/src/GRParameters.py:1.7
*** gnue/reports/src/GRParameters.py:1.6 Thu Apr 4 00:55:37 2002
--- gnue/reports/src/GRParameters.py Thu Apr 4 18:38:20 2002
***************
*** 38,43 ****
--- 38,47 ----
def __init__ (self, parent):
GObj.__init__(self, parent, type='GRParameters')
self._parameters = {}
+ self._inits = [self.initialize]
+
+ def initialize(self):
+ self.findParentOfType('GRReport')._parameters = self
#
# Set the parameters actually supplied by the user
***************
*** 98,118 ****
self.default = None
def _buildObject(self):
! self._name = string.lower(self.id)
return GObj._buildObject(self)
- def __init__(self, parent, type):
- GObj.__init(self, parent, type='GRStubParam')
-
#
#
#
class GRStubParam(GConditions.GCParam):
! def __init__(self, *args, **parms):
! GConditions.GCParam.__init__(self, *args, **parms)
self._inits.append(self.initialize)
self._type = self._typestub
--- 102,119 ----
self.default = None
def _buildObject(self):
! self._name = string.lower(self.name)
return GObj._buildObject(self)
#
#
#
class GRStubParam(GConditions.GCParam):
! def __init__(self, parent=None):
! GConditions.GCParam.__init__(self, parent)
self._inits.append(self.initialize)
self._type = self._typestub
***************
*** 123,129 ****
val = self._parameters.getParameter(self.name)
if val is None:
return ""
! elif self.type = 'number':
return float(val)
else:
return "%s" % val
--- 124,130 ----
val = self._parameters.getParameter(self.name)
if val is None:
return ""
! elif self.type == 'number':
return float(val)
else:
return "%s" % val
Index: gnue/reports/src/GRParser.py
diff -c gnue/reports/src/GRParser.py:1.19 gnue/reports/src/GRParser.py:1.20
*** gnue/reports/src/GRParser.py:1.19 Thu Apr 4 00:55:37 2002
--- gnue/reports/src/GRParser.py Thu Apr 4 18:38:20 2002
***************
*** 169,180 ****
'KeepWhitespace': 1,
'ParentTags': ('section',) },
! 'default': {
! 'BaseClass': GRLayout.GRDefault,
'MixedContent': 1,
'KeepWhitespace': 1,
'ParentTags': ('section',) },
'field': {
'BaseClass': GRLayout.GRField,
'Attributes': {
--- 169,201 ----
'KeepWhitespace': 1,
'ParentTags': ('section',) },
! 'firstRow': {
! 'BaseClass': GRLayout.GRFirstRow,
'MixedContent': 1,
'KeepWhitespace': 1,
'ParentTags': ('section',) },
+ 'notFirstRow': {
+ 'BaseClass': GRLayout.GRNotFirstRow,
+ 'MixedContent': 1,
+ 'KeepWhitespace': 1,
+ 'ParentTags': ('section',) },
+
+ # TODO: These introduce a level of complexity I don't want
+ # TODO: to think about! Are they actually necessary?
+ #
+ # 'lastRow': {
+ # 'BaseClass': GRLayout.GRLastRow,
+ # 'MixedContent': 1,
+ # 'KeepWhitespace': 1,
+ # 'ParentTags': ('section',) },
+ #
+ # 'notLastRow': {
+ # 'BaseClass': GRLayout.GRNotLastRow,
+ # 'MixedContent': 1,
+ # 'KeepWhitespace': 1,
+ # 'ParentTags': ('section',) },
+
'field': {
'BaseClass': GRLayout.GRField,
'Attributes': {
***************
*** 182,187 ****
--- 203,210 ----
'Required': 1,
'Typecast': GTypecast.name },
'source': {
+ 'Typecast': GTypecast.name },
+ 'section': {
'Typecast': GTypecast.name },
'format': {
'Typecast': GTypecast.name } },
Index: gnue/reports/src/GRReport.py
diff -c gnue/reports/src/GRReport.py:1.18 gnue/reports/src/GRReport.py:1.19
*** gnue/reports/src/GRReport.py:1.18 Thu Apr 4 00:55:37 2002
--- gnue/reports/src/GRReport.py Thu Apr 4 18:38:20 2002
***************
*** 44,66 ****
def __init__(self, parent=None):
GObj.__init__(self, parent, type='GRReport')
self._connections = None # This will be set by GRParser.loadReport
! self._inits = (self.initialize,)
self._datasourceDictionary = {}
def initialize(self):
! self.walk(self.__buildDataSources)
# TODO: This is duplicating functionality in GRSources.prepare!!
! def __buildDataSources(self, object):
if object.getObjectType() == "GRDataSource":
GDebug.printMesg(3,"Attaching DataSource '%s' to '%s'" \
% (object.name, self._connections) )
object.setConnectionManager(self._connections)
self._datasourceDictionary[object.name] = object
def dumpXML(self, treeDump=1, gap=" "):
! return GObj.dumpXML(self,
GRParser.getXMLelements(), treeDump, gap)
--- 44,72 ----
def __init__(self, parent=None):
GObj.__init__(self, parent, type='GRReport')
self._connections = None # This will be set by GRParser.loadReport
! self._inits = (self.initialize,self.postInit)
self._datasourceDictionary = {}
+ self._parameters = None
def initialize(self):
! self.walk(self.__initElements)
!
! def postInit(self):
! if not self._parameters:
! self._parameters = GRParameters.GRParameters(self)
# TODO: This is duplicating functionality in GRSources.prepare!!
! def __initElements(self, object):
if object.getObjectType() == "GRDataSource":
GDebug.printMesg(3,"Attaching DataSource '%s' to '%s'" \
% (object.name, self._connections) )
object.setConnectionManager(self._connections)
self._datasourceDictionary[object.name] = object
+
def dumpXML(self, treeDump=1, gap=" "):
! return GObj.dumpXML(self,
GRParser.getXMLelements(), treeDump, gap)
***************
*** 76,90 ****
# Connect to databases
GDebug.printMesg(3,"Initializing DataSource Connections")
! parameters = self.getChildOfType('GRParameters') or \
! GRParameters.GRParameters(self)
sortoptions = self.getChildOfType('GRSortOptions') or \
GRSortOptions.GRSortOptions(self)
sources = self.getChildOfType('GRSources')
layout = self.getChildOfType('GRLayout')
- # For use by the child parameter types
- self._parameters = parameters
#
# Raise exceptions if _sources or _parameters is None
--- 82,94 ----
# Connect to databases
GDebug.printMesg(3,"Initializing DataSource Connections")
! parameters = self._parameters
!
sortoptions = self.getChildOfType('GRSortOptions') or \
GRSortOptions.GRSortOptions(self)
sources = self.getChildOfType('GRSources')
layout = self.getChildOfType('GRLayout')
#
# Raise exceptions if _sources or _parameters is None
- gnue/reports samples/foobulations/monthly.grd s...,
Jason Cater <=
- gnue/reports samples/foobulations/monthly.grd s..., Jason Cater, 2002/04/05
- gnue/reports samples/foobulations/monthly.grd s..., Jason Cater, 2002/04/06
- gnue/reports samples/foobulations/monthly.grd s..., Jason Cater, 2002/04/08
- gnue/reports samples/foobulations/monthly.grd s..., Jason Cater, 2002/04/08
- gnue/reports samples/foobulations/monthly.grd s..., Jason Cater, 2002/04/08
- gnue/reports samples/foobulations/monthly.grd s..., Jason Cater, 2002/04/09
- gnue/reports samples/foobulations/monthly.grd s..., Jason Cater, 2002/04/26