[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/reports/src GREngine.py GRFilters.py GRPar...
From: |
Jason Cater |
Subject: |
gnue/reports/src GREngine.py GRFilters.py GRPar... |
Date: |
Mon, 04 Nov 2002 16:13:19 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/11/04 16:13:19
Modified files:
reports/src : GREngine.py GRFilters.py GRParser.py
GRReport.py GRRun.py
Added files:
reports/src : GRReportInfo.py
Log message:
added support for --list-filters
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRReportInfo.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GREngine.py.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRFilters.py.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRParser.py.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRReport.py.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRRun.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
Patches:
Index: gnue/reports/src/GREngine.py
diff -c gnue/reports/src/GREngine.py:1.18 gnue/reports/src/GREngine.py:1.19
*** gnue/reports/src/GREngine.py:1.18 Mon Nov 4 09:55:51 2002
--- gnue/reports/src/GREngine.py Mon Nov 4 16:13:18 2002
***************
*** 51,56 ****
--- 51,57 ----
#
def processReport(self, reportFile, destination="-", destinationOptions="",
destinationType="file", filter="text",
+ batch=0,
filterOptions="", parameters={},
sortoption=None, includeStructuralComments=0,
omitGNUeXML=0):
Index: gnue/reports/src/GRFilters.py
diff -c gnue/reports/src/GRFilters.py:1.15 gnue/reports/src/GRFilters.py:1.16
*** gnue/reports/src/GRFilters.py:1.15 Tue Sep 24 11:04:28 2002
--- gnue/reports/src/GRFilters.py Mon Nov 4 16:13:18 2002
***************
*** 157,163 ****
def getMappings(self):
return tuple(self.mappings)
- def getFilters(self):
- return []
--- 157,173 ----
def getMappings(self):
return tuple(self.mappings)
+ def getFilters(self, namespace=""):
+
+ filters = []
+
+ if namespace != "":
+ namespace += ':'
+
+ for param in self.filters.keys():
+ if namespace == "" or param[:len(namespace)] == namespace:
+ filters.append((param,self.filters[param]))
+
+ return filters
Index: gnue/reports/src/GRParser.py
diff -c gnue/reports/src/GRParser.py:1.28 gnue/reports/src/GRParser.py:1.29
*** gnue/reports/src/GRParser.py:1.28 Mon Nov 4 15:14:55 2002
--- gnue/reports/src/GRParser.py Mon Nov 4 16:13:19 2002
***************
*** 54,60 ****
# the report is initialized and ready to go.
#######################################################
! def loadFile(buffer, connections, initialize=1):
return GParser.loadXMLObject (buffer, xmlReportHandler, 'GRReport',
'report',
initialize, attributes={"_connections": connections})
--- 54,60 ----
# the report is initialized and ready to go.
#######################################################
! def loadFile(buffer, connections=None, initialize=1):
return GParser.loadXMLObject (buffer, xmlReportHandler, 'GRReport',
'report',
initialize, attributes={"_connections": connections})
Index: gnue/reports/src/GRReport.py
diff -c gnue/reports/src/GRReport.py:1.26 gnue/reports/src/GRReport.py:1.27
*** gnue/reports/src/GRReport.py:1.26 Mon Nov 4 09:55:51 2002
--- gnue/reports/src/GRReport.py Mon Nov 4 16:13:19 2002
***************
*** 97,103 ****
#
! # Raise exceptions if _sources or _parameters is None
#
if sources == None:
raise NoSourcesSection, "No <sources> section has been defined."
--- 97,103 ----
#
! # Raise exceptions if _sources or _layout is None
#
if sources == None:
raise NoSourcesSection, "No <sources> section has been defined."
***************
*** 133,139 ****
#TODO: (?) dest.write ('<!DOCTYPE ... >\n')
dest.write ('<gnue:report-output xmlns:gnue="GNUe:Reports:Base"%s>\n' %
ns)
!
dest.write (" <gnue:report-request>\n")
dest.write ( parameters.getRunOptionsAsXML() )
dest.write ( sortoptions.getRunOptionsAsXML() )
--- 133,139 ----
#TODO: (?) dest.write ('<!DOCTYPE ... >\n')
dest.write ('<gnue:report-output xmlns:gnue="GNUe:Reports:Base"%s>\n' %
ns)
!
dest.write (" <gnue:report-request>\n")
dest.write ( parameters.getRunOptionsAsXML() )
dest.write ( sortoptions.getRunOptionsAsXML() )
Index: gnue/reports/src/GRRun.py
diff -c gnue/reports/src/GRRun.py:1.17 gnue/reports/src/GRRun.py:1.18
*** gnue/reports/src/GRRun.py:1.17 Mon Sep 16 15:22:15 2002
--- gnue/reports/src/GRRun.py Mon Nov 4 16:13:19 2002
***************
*** 34,39 ****
--- 34,40 ----
from GREngine import GREngine
import GRFilters
import GRExceptions
+ from GRReportInfo import GRReportInfo
import string, sys
import tempfile
from gnue.reports.GRConfig import ConfigOptions
***************
*** 82,88 ****
'is the name of the filtering process as defined on the Report '
'Server machine. If not specified, the "raw" filter is used '
'(i.e., no filtering takes place.)'],
! [ 'list_filters', None, 'filter-list', 0, 0, None,
'List the available [predefined] filters available to GNUe
Reports'],
[ 'filter_options', 'F', 'filter-options', 1, '', 'opts',
'Options to pass to the filter process. Available options are '
--- 83,89 ----
'is the name of the filtering process as defined on the Report '
'Server machine. If not specified, the "raw" filter is used '
'(i.e., no filtering takes place.)'],
! [ 'list_filters', None, 'list-filters', 0, 0, None,
'List the available [predefined] filters available to GNUe
Reports'],
[ 'filter_options', 'F', 'filter-options', 1, '', 'opts',
'Options to pass to the filter process. Available options are '
***************
*** 90,95 ****
--- 91,100 ----
'and their options. Example: \'--filter-options "paper=letter
margin=1,1,1,1" \''],
[ 'sortoption', 's', 'sort', 1, '', 'sort',
'Select the "sort-option" used to sort the report. '],
+ [ 'batch', 'b', 'batch', 0, 0, None,
+ 'Run GNUe Reports in batch mode -- i.e., no login information or '
+ 'runtime parameters will be prompted. If required parameters are '
+ 'not provided, then Reports will terminate with an error'],
[ 'quiet', 'q', 'quiet', 0, 0, None,
'Run GNUe Reports in quiet mode -- i.e., display no output. '
'NOTE: if --debug-level is specified, then suppressed text will '
***************
*** 144,161 ****
# Are we doing a simple help-like operation?
#
- # ...list available filters?
- if self.OPTIONS["list_filters"]:
- self.listFilters()
- sys.exit()
-
-
# assign report file from 1st free argument
try:
reportfile = self.ARGUMENTS[0]
except:
self.handleStartupError ("No Report Definition File Specified.")
#
# Get the user supplied parameters
#
--- 149,166 ----
# Are we doing a simple help-like operation?
#
# assign report file from 1st free argument
try:
reportfile = self.ARGUMENTS[0]
except:
self.handleStartupError ("No Report Definition File Specified.")
+ # ...list available filters?
+ if self.OPTIONS["list_filters"]:
+ self.listFilters(reportfile)
+ sys.exit()
+
+
#
# Get the user supplied parameters
#
***************
*** 208,213 ****
--- 213,219 ----
destinationType = self.OPTIONS["destination_type"],
destinationOptions = self.OPTIONS["destination_options"],
filter = self.OPTIONS['filter'],
+ batch = self.OPTIONS['batch'],
filterOptions = self.OPTIONS['filter_options'],
parameters=userParameters,
sortoption=sortoption,
***************
*** 222,237 ****
#
# List filters available on the server
#
! def listFilters(self):
# TODO: um, implement??
self.printVersion()
! print "Available filters:"
! print " raw [default] Do not process the XML with a filter. Emit
raw XML."
print
#
--- 228,277 ----
#
# List filters available on the server
#
! def listFilters(self, location):
# TODO: um, implement??
self.printVersion()
! reportInfo = self.getReportInformation(location)
! namespace = reportInfo.getNamespace()
!
! filters = reportInfo.getFilters()
! filters.sort()
! filters.insert(0,('raw',{'description':'Do not process the XML with a
filter. Emit raw XML.',
! 'engine': 'raw' }))
!
! processed = []
! maxlen = 0
! for filter, properties in filters:
! filter = filter.split(':')[-1]
! maxlen = max(maxlen, len(filter))
! try:
! descr = properties['description']
! if not len(descr):
! raise KeyError
! except KeyError:
! descr = "%s output filter (no description available)" % filter
! processed.append((filter, descr))
!
!
!
!
! print 'Available filters for "%s" reports:' % namespace.split(':')[-1]
print
+ for filter, descr in processed:
+ print " %s %s" % (filter.ljust(maxlen+2), descr)
+ print
+
+ #
+ # Get a report's information
+ #
+ # TODO: This needs to support GNUe Reports Server
+ # TODO: when the time is right.
+ def getReportInformation(self, location):
+ return GRReportInfo(location)
#
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/reports/src GREngine.py GRFilters.py GRPar...,
Jason Cater <=