[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue gnuef/src/GFObjects/GFEntry.py reports/src...
From: |
Jason Cater |
Subject: |
gnue gnuef/src/GFObjects/GFEntry.py reports/src... |
Date: |
Mon, 15 Oct 2001 00:15:51 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 01/10/15 00:15:51
Modified files:
gnuef/src/GFObjects: GFEntry.py
reports/src : GRDataMapper.py GRLayout.py GRReport.py
GRSources.py
Added files:
reports/samples/dcl: README personnel-summary.grd
Log message:
synching machines
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFObjects/GFEntry.py.diff?cvsroot=OldCVS&tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/samples/dcl/README?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/samples/dcl/personnel-summary.grd?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRDataMapper.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRLayout.py.diff?cvsroot=OldCVS&tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRReport.py.diff?cvsroot=OldCVS&tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRSources.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: gnue/gnuef/src/GFObjects/GFEntry.py
diff -u gnue/gnuef/src/GFObjects/GFEntry.py:1.24
gnue/gnuef/src/GFObjects/GFEntry.py:1.25
--- gnue/gnuef/src/GFObjects/GFEntry.py:1.24 Fri Oct 12 20:06:18 2001
+++ gnue/gnuef/src/GFObjects/GFEntry.py Mon Oct 15 00:15:51 2001
@@ -3,7 +3,7 @@
#
# 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
+# 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
@@ -242,7 +242,7 @@
return value
#
# findClosestValue
- #
+ #
def findClosestValue(self, value):
newvalue=None
if hasattr(self,'foreign_key'):
@@ -263,7 +263,7 @@
# allowedValues
#
def allowedValues(self):
- if not self._allowedValues and hasattr(self,'datasource'):
+ if not self._allowedValues and hasattr(self,'datasource'):
rs = self.datasource.createResultSet()
more = rs.firstRecord()
self._allowedValues = {"":""}
Index: gnue/reports/src/GRDataMapper.py
diff -u gnue/reports/src/GRDataMapper.py:1.5
gnue/reports/src/GRDataMapper.py:1.6
--- gnue/reports/src/GRDataMapper.py:1.5 Sun Oct 7 02:28:35 2001
+++ gnue/reports/src/GRDataMapper.py Mon Oct 15 00:15:51 2001
@@ -157,7 +157,7 @@
if source == None:
return
if self.sectionMap.has_key (section):
- raise GRException.SectionHasDuplicateName, \
+ raise GRExceptions.SectionHasDuplicateName, \
"Section %s is defined multiple times" % section
if parentSection == None or not self.sectionMap.has_key(parentSection):
Index: gnue/reports/src/GRLayout.py
diff -u gnue/reports/src/GRLayout.py:1.10 gnue/reports/src/GRLayout.py:1.11
--- gnue/reports/src/GRLayout.py:1.10 Fri Oct 12 13:43:55 2001
+++ gnue/reports/src/GRLayout.py Mon Oct 15 00:15:51 2001
@@ -2,7 +2,7 @@
# 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
+# 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.
#
@@ -52,7 +52,7 @@
############################################################
#
#
-class GRLayout (GObj):
+class GRLayout (GObj):
def __init__(self, parent):
GObj.__init__(self, parent, type='GRLayout')
@@ -61,14 +61,15 @@
# If there is more than one object attached to a layout
# object, then create an unattached section to contain them.
if len(self._children) > 1:
+
temp = self._children
self._children = []
section = GRSection(self)
section._children = temp
section._buildObject()
elif len(self._children) == 0:
- raise GRException.NoLayoutDefined, \
- "The layout section does not contain anything"
+ raise GRExceptions.NoLayoutDefined, \
+ "The layout section does not contain any instructions. What do I do?"
return GObj._buildObject(self)
@@ -83,72 +84,76 @@
self.walk(self.__prepare)
# Used by prepare()
- def __prepare(self, object):
+ def __prepare(self, object):
+ if isinstance(object, GRLayoutElement):
+
- if isinstance(object, GRLayoutElement):
+ # TODO: Move to GRLayoutElement's phaseInit system.
-
- # If section/field/summary does not have a source,
+ # If section/field/summary does not have a source,
# inherit parent's source (if available)
if object.source == None and \
- isinstance(object._parent, GRLayoutElement):
+ isinstance(object._parent, GRLayoutElement):
object.source = object._parent.source
- if object.source == None and isinstance(object, GRField):
+ 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):
+ 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
+ # what section a field or summary actually pulls from and also
# makes sure a section, field, or summary isn't trying to use
- # a source outside of the source's scope. After it's satisfied
+ # a source outside of the source's scope. After it's satisfied
# with the results, it adds the element to the mapper object.
- if isinstance(object, GRSection) and object.source != None:
- if isinstance(object._parent, GRLayout):
+ # TODO: This can probably be simplified by moving
+ # 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:
+ 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):
+ elif isinstance(object, GRField):
s = object._parent.getAncestorWithSource(object.source)
- if s == None:
+ 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._section = s.name
object._mymapper = self._mapper.sectionMap[object._section]
GDebug.printMesg(6,'Mapping field %s to section %s' \
% (object.name, object._section))
self._mapper.addFieldToSection(object._section, object.name)
- elif isinstance(object, GRSumm):
- if object.section == None:
+ elif isinstance(object, GRSumm):
+ if object.section == None:
s = object._parent.getAncestorWithSource(object.source)
- if s == None:
+ 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:
+ if s == None:
raise SourceOutOfScope, \
"Summary %s in section %s uses out-of-scope source %s" \
% (object.name, object._parent.name, object.source)
@@ -162,44 +167,44 @@
object.function)
- #
+ #
# Pull value for parameters
#
- if object.getObjectType() == 'GRParam':
- object._value = self._parameters.getParameter(object.name)
+ if object.getObjectType() == 'GRParam':
+ object._value = self._parameters.getParameter(object.name)
#
# Process layout and dump output.
# self.prepare *must* have been called.
- #
- def process(self, dest, includeStructuralComments=0):
+ #
+ def process(self, dest, includeStructuralComments=0):
global structuralComment
- if includeStructuralComments:
+ if includeStructuralComments:
structuralComment = _structuralComment
for child in self._children:
structuralComment(dest, '<!--[layout]-->')
child.processAsController(dest, self._mapper)
structuralComment(dest, '<!--[/layout]-->\n')
-
+
############################################################
#
-# Any elements contained within a <layout> element
+# Any elements contained within a <layout> element
# inherit GRLayoutElement
#
-class GRLayoutElement (GObj):
+class GRLayoutElement (GObj):
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):
+
+ # Called if section contains data
+ def process(self, dest, mapper):
pass
@@ -207,28 +212,36 @@
#
# <section> tag
#
-class GRSection (GRLayoutElement):
+class GRSection (GRLayoutElement):
def __init__(self, parent):
GRLayoutElement.__init__(self, parent, 'GRSection')
- # Retrieve the first row of data, if available.
+ # Retrieve the first row of data, if available.
# Handle default data if no rows retrieved.
#
# TODO: What if the top section isn't bound to a source?
- # TODO: Does this work?
+ # TODO: Does this work? [ Hmmm... Answer: NO! ]
#
- def processAsController(self, dest, mapper):
+ def processAsController(self, dest, mapper):
+
+ GDebug.printMesg(10,
+ "Controlling section %s's processAsController() called" % self.name)
- 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
- if mapper.getFirstRecord(self.source):
- # There was data returned, so process section
+ self.process(dest, mapper)
- section = self
- while section:
+ 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)
@@ -239,45 +252,49 @@
if goto == None:
section = None
- else:
+ else:
section = mapper.sectionMap[goto]._object
+
+ else:
+ # This is a data-bound section and there
+ # was no data returned, so generate default
+ # text (if any)
- else:
- # There was no data returned, so generate default text (if any)
- for c2 in self._children:
- if isinstance (c2, GRDefault):
+ for c2 in self._children:
+ if isinstance (c2, GRDefault):
c2.processDefault(dest, mapper)
+
- # Generic process() method. Process the
+ # Generic process() method. Process the
# current record and handle any children.
- def process(self, dest, mapper):
+ 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_":
+ if child.getObjectType() == "_content_":
dest.write(child.getContent())
- else:
- if isinstance(child, GRSection) and child._mymapper.toplevel:
+ 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,"Left section %s" % self.name)
+ GDebug.printMesg(10,"Laving section %s" % self.name)
#
# getAncestorWithSource()
#
- def getAncestorWithSource(self, source):
- if self.source == source:
+ def getAncestorWithSource(self, source):
+ if self.source == source:
return self
- elif isinstance(self._parent, GRSection):
+ elif isinstance(self._parent, GRSection):
return self._parent.getAncestorWithSource(source)
- else:
+ else:
return None
Index: gnue/reports/src/GRReport.py
diff -u gnue/reports/src/GRReport.py:1.12 gnue/reports/src/GRReport.py:1.13
--- gnue/reports/src/GRReport.py:1.12 Wed Oct 10 00:48:02 2001
+++ gnue/reports/src/GRReport.py Mon Oct 15 00:15:51 2001
@@ -11,7 +11,7 @@
# 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.
@@ -51,7 +51,7 @@
self.walk(self.__buildDataSources)
#self.initialize()
- # TODO: Move into the datasource phaseInit
+ # TODO: This is duplicating functionality in GRSources.prepare!!
def __buildDataSources(self, object):
if object.getObjectType() == "GRDataSource":
GDebug.printMesg(3,"Attaching DataSource %s to %s" \
Index: gnue/reports/src/GRSources.py
diff -u gnue/reports/src/GRSources.py:1.6 gnue/reports/src/GRSources.py:1.7
--- gnue/reports/src/GRSources.py:1.6 Wed Oct 10 00:48:02 2001
+++ gnue/reports/src/GRSources.py Mon Oct 15 00:15:51 2001
@@ -16,7 +16,7 @@
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
-# Copyright 2000, 2001 Free Software Foundation
+# Copyright 2001 Free Software Foundation
#
# FILE:
# GRSources.py
@@ -60,7 +60,7 @@
# Connects to databases
def __initConnections(self, object):
if object.getObjectType() == "GRDataSource":
- GDebug.printMesg(3,"Connecting DataSource %s to %s" \
+ GDebug.printMesg(3,"Connecting DataSource '%s' to connection '%s'" \
% (object.name, object.database) )
object.connect()
self._datasourceDictionary[object.name] = object
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue gnuef/src/GFObjects/GFEntry.py reports/src...,
Jason Cater <=