[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/reports/src GREngine.py GRLayout.py GRRun.py
From: |
Jason Cater |
Subject: |
gnue/reports/src GREngine.py GRLayout.py GRRun.py |
Date: |
Mon, 15 Apr 2002 00:36:31 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/04/15 00:36:31
Modified files:
reports/src : GREngine.py GRLayout.py GRRun.py
Log message:
moved output logic from GRRun into GREngine; misc cleanup
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GREngine.py.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRLayout.py.diff?cvsroot=OldCVS&tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRRun.py.diff?cvsroot=OldCVS&tr1=1.11&tr2=1.12&r1=text&r2=text
Patches:
Index: gnue/reports/src/GREngine.py
diff -c gnue/reports/src/GREngine.py:1.9 gnue/reports/src/GREngine.py:1.10
*** gnue/reports/src/GREngine.py:1.9 Mon Mar 25 23:34:07 2002
--- gnue/reports/src/GREngine.py Mon Apr 15 00:36:31 2002
***************
*** 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
# 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
--- 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
# 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
***************
*** 22,28 ****
# GREngine.py
#
# DESCRIPTION:
! # Class that loads and populates a report
#
# NOTES:
#
--- 22,28 ----
# GREngine.py
#
# DESCRIPTION:
! # Class that loads and populates a report
#
# NOTES:
#
***************
*** 34,70 ****
import GRReport
import GRParser
import GRExceptions
! from gnue.common import openResource, GDebug
! class GREngine:
! def __init__(self, connectionManager):
self._connectionManager = connectionManager
GDebug.printMesg(1,'GREngine instance started: %s' %
self._connectionManager)
#
! # Run the report (reportFile) and generate the XML output.
# Write the XML output to the outputHandle IOStream
#
! def processReport(self, reportFile, outputHandle=sys.stdout, parameters={},
! sortoption=None, includeStructuralComments=0,
! omitGNUeXML=0):
! try:
fileHandle = openResource(reportFile)
report = GRParser.loadReport(fileHandle, self._connectionManager)
! report.process(outputHandle, parameters, sortoption, \
! includeStructuralComments=includeStructuralComments,
! omitGNUeXML=omitGNUeXML)
!
! except IOError, msg:
raise GRExceptions.ReportUnreadable, \
"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))
--- 34,103 ----
import GRReport
import GRParser
import GRExceptions
! import GRFilters
! from gnue.common import openResource, GDebug, GConfig, dyn_import
! class GREngine:
! def __init__(self, connectionManager):
self._connectionManager = connectionManager
GDebug.printMesg(1,'GREngine instance started: %s' %
self._connectionManager)
#
! # Run the report (reportFile) and generate the XML output.
# Write the XML output to the outputHandle IOStream
#
! def processReport(self, reportFile, destination="-", destinationOptions="",
! destinationType="file", filter="text",
! filterOptions="", parameters={},
! sortoption=None, includeStructuralComments=0,
! omitGNUeXML=0):
+ self.filters = GRFilters.GRFilters()
! try:
fileHandle = openResource(reportFile)
report = GRParser.loadReport(fileHandle, self._connectionManager)
! except IOError, msg:
raise GRExceptions.ReportUnreadable, \
"Unable to read the requested report definition\n (%s)\n\n" %
reportFile \
+ "Additional Information:\n %s" % msg
+
+
+ #
+ # Where are we destined for?
+ #
+
+ tempname = None
+
+ if destinationType == 'file' and destination == '-':
+ # Handle the special case of stdout
+ destAdapter =
dyn_import('gnue.reports.adapters.destinations.file.stdout')
+ else:
+ # Load a destination adapter
+ destAdapter = dyn_import('gnue.reports.adapters.destinations.%s.%s' % \
+ (destinationType, GConfig.get('%sAdapter' %
destinationType)))
+
+ dest = destAdapter.DestinationAdapter(destination, destinationOptions)
+
+ # TODO: !!!!
+ namespace = "GNUe:Reports:SimpleTabulation"
+
+ filtAdapter = self.filters.loadFilter(namespace,
+ filter,
+ dest,
+ filterOptions)
+
+ report.process(filtAdapter.open(), parameters, sortoption, \
+ includeStructuralComments=includeStructuralComments,
+ omitGNUeXML=omitGNUeXML)
+
+ # Cleanup
+ filtAdapter.close()
+
# GDebug.printMesg(999, '-'*60)
# GDebug.printMesg(999, report.dumpXML(1))
Index: gnue/reports/src/GRLayout.py
diff -c gnue/reports/src/GRLayout.py:1.28 gnue/reports/src/GRLayout.py:1.29
*** gnue/reports/src/GRLayout.py:1.28 Fri Apr 12 16:56:53 2002
--- gnue/reports/src/GRLayout.py Mon Apr 15 00:36:31 2002
***************
*** 39,45 ****
#
# Used to send structural comment
# Chose not to do "if COMMENT == 1: dest.write"
! # for performance reasons
#
def _structuralComment(dest, text):
dest.write(text)
--- 39,45 ----
#
# Used to send structural comment
# Chose not to do "if COMMENT == 1: dest.write"
! # for performance reasons # TODO: Was this a good decision?
#
def _structuralComment(dest, text):
dest.write(text)
Index: gnue/reports/src/GRRun.py
diff -c gnue/reports/src/GRRun.py:1.11 gnue/reports/src/GRRun.py:1.12
*** gnue/reports/src/GRRun.py:1.11 Fri Apr 12 01:59:34 2002
--- gnue/reports/src/GRRun.py Mon Apr 15 00:36:31 2002
***************
*** 29,35 ****
from gnue.reports import VERSION
! from gnue.common import GDebug, GConfig, dyn_import
from gnue.common.GClientApp import GClientApp
from GREngine import GREngine
import GRFilters
--- 29,35 ----
from gnue.reports import VERSION
! from gnue.common import GDebug, GConfig
from gnue.common.GClientApp import GClientApp
from GREngine import GREngine
import GRFilters
***************
*** 140,147 ****
def run(self):
- self.filters = GRFilters.GRFilters()
-
#
# Are we doing a simple help-like operation?
#
--- 140,145 ----
***************
*** 196,235 ****
#
- # Where are we destined for?
- #
-
- tempname = None
- filter = self.OPTIONS["filter"]
- filterparam = self.OPTIONS["filter_options"]
- desname = self.OPTIONS["destination"]
- destype = string.lower(self.OPTIONS["destination_type"])
- destparam = self.OPTIONS["destination_options"]
-
-
- if destype == 'file' and desname == '-':
- # Handle the special case of stdout
- destAdapter =
dyn_import('gnue.reports.adapters.destinations.file.stdout')
- else:
- # Load a destination adapter
- destAdapter = dyn_import('gnue.reports.adapters.destinations.%s.%s' % \
- (destype, GConfig.get('%sAdapter' % destype)))
-
- destination = destAdapter.DestinationAdapter(desname, destparam)
-
- # TODO: !!!!
- namespace = "GNUe:Reports:SimpleTabulation"
-
- try:
- filtAdapter = self.filters.loadFilter(namespace,
- filter,
- destination,
- filterparam)
- except GRFilters.FilterError, mesg:
- self.handleStartupError(mesg)
-
-
- #
# Now, run an engine instance
#
# TODO: Once reports is server-ized, this call
--- 194,199 ----
***************
*** 240,247 ****
#
try:
GREngine(self.getConnectionManager()).processReport(reportfile,
! outputHandle = filtAdapter.open(),
! parameters=userParameters, sortoption=sortoption,
includeStructuralComments=self.OPTIONS["comment"],
omitGNUeXML=self.OPTIONS["exclude_xml"])
except GRExceptions.ReportMarkupException, msg:
--- 204,216 ----
#
try:
GREngine(self.getConnectionManager()).processReport(reportfile,
! destination = self.OPTIONS["destination"],
! destinationType = self.OPTIONS["destination_type"],
! destinationOptions = self.OPTIONS["destination_options"],
! filter = self.OPTIONS['filter'],
! filterOptions = self.OPTIONS['filter_options'],
! parameters=userParameters,
! sortoption=sortoption,
includeStructuralComments=self.OPTIONS["comment"],
omitGNUeXML=self.OPTIONS["exclude_xml"])
except GRExceptions.ReportMarkupException, msg:
***************
*** 249,256 ****
except GRExceptions.ReportUnreadable, msg:
self.handleStartupError (msg)
- # Cleanup
- filtAdapter.close()
#
# List filters available on the server
--- 218,223 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/reports/src GREngine.py GRLayout.py GRRun.py,
Jason Cater <=