[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue common/etc/sample.gnue.conf reports/adapte...
From: |
Jason Cater |
Subject: |
gnue common/etc/sample.gnue.conf reports/adapte... |
Date: |
Fri, 12 Apr 2002 01:59:36 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/04/12 01:59:35
Modified files:
common/etc : sample.gnue.conf
reports/adapters/destinations/file: stdout.py text.py
reports/src : GRFilters.py GROutputAdapter.py GRRun.py
Added files:
reports/adapters/destinations: __init__.py
reports/adapters/filters: __init__.py
Log message:
more work on modularization of output destinations/filters in reports
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/etc/sample.gnue.conf.diff?cvsroot=OldCVS&tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/destinations/__init__.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/destinations/file/stdout.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/destinations/file/text.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/filters/__init__.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRFilters.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GROutputAdapter.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRRun.py.diff?cvsroot=OldCVS&tr1=1.10&tr2=1.11&r1=text&r2=text
Patches:
Index: gnue/common/etc/sample.gnue.conf
diff -c gnue/common/etc/sample.gnue.conf:1.24
gnue/common/etc/sample.gnue.conf:1.25
*** gnue/common/etc/sample.gnue.conf:1.24 Thu Apr 11 00:19:29 2002
--- gnue/common/etc/sample.gnue.conf Fri Apr 12 01:59:32 2002
***************
*** 223,229 ****
# DestinationType Adapters
PrinterAdapter = bsdlpr
EmailAdapter = sendmail
! FileAdapter = file
FaxAdapter = hylafax
# DestinationType options
--- 223,229 ----
# DestinationType Adapters
PrinterAdapter = bsdlpr
EmailAdapter = sendmail
! FileAdapter = text
FaxAdapter = hylafax
# DestinationType options
Index: gnue/reports/adapters/destinations/file/stdout.py
diff -c gnue/reports/adapters/destinations/file/stdout.py:1.1
gnue/reports/adapters/destinations/file/stdout.py:1.2
*** gnue/reports/adapters/destinations/file/stdout.py:1.1 Thu Apr 11
00:19:30 2002
--- gnue/reports/adapters/destinations/file/stdout.py Fri Apr 12 01:59:34 2002
***************
*** 31,37 ****
from gnue.reports.GROutputAdapter import DestinationAdapter as Base
! class DestinationAdapter(_BaseAdapter):
#
# Typically, a transform adapter will call EITHER
--- 31,37 ----
from gnue.reports.GROutputAdapter import DestinationAdapter as Base
! class DestinationAdapter(Base):
#
# Typically, a transform adapter will call EITHER
***************
*** 67,74 ****
#
if self.tempfile:
input = open(self.tempfile)
! while (in = input.readline())
! print in
input.close()
self.deleteTempFile(self.tempfile)
--- 67,73 ----
#
if self.tempfile:
input = open(self.tempfile)
! self.input.write(input.read())
input.close()
self.deleteTempFile(self.tempfile)
Index: gnue/reports/adapters/destinations/file/text.py
diff -c gnue/reports/adapters/destinations/file/text.py:1.2
gnue/reports/adapters/destinations/file/text.py:1.3
*** gnue/reports/adapters/destinations/file/text.py:1.2 Thu Apr 11 00:19:30 2002
--- gnue/reports/adapters/destinations/file/text.py Fri Apr 12 01:59:34 2002
***************
*** 30,36 ****
from gnue.reports.GROutputAdapter import DestinationAdapter as Base
! class DestinationAdapter(_BaseAdapter):
#
# Typically, a transform adapter will call EITHER
--- 30,36 ----
from gnue.reports.GROutputAdapter import DestinationAdapter as Base
! class DestinationAdapter(Base):
#
# Typically, a transform adapter will call EITHER
***************
*** 40,46 ****
# the transform adapter
#
def getOutputHandle(self):
! self.output = open(destination,'w')
return self.output
#
--- 40,46 ----
# the transform adapter
#
def getOutputHandle(self):
! self.output = open(self.destination,'w')
return self.output
#
Index: gnue/reports/src/GRFilters.py
diff -c gnue/reports/src/GRFilters.py:1.2 gnue/reports/src/GRFilters.py:1.3
*** gnue/reports/src/GRFilters.py:1.2 Thu Apr 11 19:37:27 2002
--- gnue/reports/src/GRFilters.py Fri Apr 12 01:59:34 2002
***************
*** 27,43 ****
# NOTES:
#
! from gnue.common import GConfig
from ConfigParser import *
import os, sys, string
- from gnue.common import openResource
- import GDebug
class GRFilters:
def __init__(self):
self._config = GRFilterConfig()
#
# Handles the processing of the
--- 27,59 ----
# NOTES:
#
! from gnue.common import GConfig, GDebug, openResource, dyn_import
from ConfigParser import *
import os, sys, string
+
+ class FilterError(StandardError):
+ pass
+
+
+ #
+ #
+ #
class GRFilters:
def __init__(self):
self._config = GRFilterConfig()
+ def loadFilter(self, namespace, filter, destination, filter_options):
+ #
+ # TODO: figure out what to load from namespace and filter.
+ #
+ if filter == 'raw':
+ module = dyn_import ('gnue.reports.adapters.filters.raw')
+ else:
+ module = dyn_import ('gnue.reports.adapters.filters.sablotron')
+ adapter = module.TransformAdapter(destination, filter_options)
+ return adapter
#
# Handles the processing of the
***************
*** 46,52 ****
class GRFilterConfig:
def __init__(self):
! self.mappings = []
location = GConfig.get('filters','')
if location:
if location[0] != '/':
--- 62,68 ----
class GRFilterConfig:
def __init__(self):
! self.mappings = {}
location = GConfig.get('filters','')
if location:
if location[0] != '/':
***************
*** 57,64 ****
-
-
def readConfig(self,location):
self._parser = ConfigParser()
--- 73,78 ----
***************
*** 87,89 ****
--- 101,106 ----
self.mappings[string.lower(option)] =
self._parser.get('mappings',option)
+
+ def getFilters(self):
+ return []
\ No newline at end of file
Index: gnue/reports/src/GROutputAdapter.py
diff -c gnue/reports/src/GROutputAdapter.py:1.1
gnue/reports/src/GROutputAdapter.py:1.2
*** gnue/reports/src/GROutputAdapter.py:1.1 Thu Apr 11 00:19:30 2002
--- gnue/reports/src/GROutputAdapter.py Fri Apr 12 01:59:34 2002
***************
*** 28,34 ****
#
import types
! import tempname
import os
--- 28,34 ----
#
import types
! import tempfile
import os
***************
*** 48,54 ****
outputHandle = open(tmpname, 'w')
return (outputHandle, tmpname)
! def deleteTempFile(self, name)
os.remove(name)
--- 48,54 ----
outputHandle = open(tmpname, 'w')
return (outputHandle, tmpname)
! def deleteTempFile(self, name):
os.remove(name)
***************
*** 63,71 ****
# filter_parameters is a string that can be in any
# format the TransformAdapter defines
#
! def __init__(self, destination, filter_options="")
self.destination = destination
! self.output = destination.getOutputHandle(self)
self.options= filter_options
--- 63,71 ----
# filter_parameters is a string that can be in any
# format the TransformAdapter defines
#
! def __init__(self, destination, filter_options=""):
self.destination = destination
! self.output = destination.getOutputHandle()
self.options= filter_options
***************
*** 75,81 ****
class DestinationAdapter(_BaseAdapter):
# destination is an instance of a DestinationAdapter
! def __init__(self, destination, destination_parameters=None)
self.destination = destination
self.options= destination_options
--- 75,81 ----
class DestinationAdapter(_BaseAdapter):
# destination is an instance of a DestinationAdapter
! def __init__(self, destination, destination_options=None):
self.destination = destination
self.options= destination_options
Index: gnue/reports/src/GRRun.py
diff -c gnue/reports/src/GRRun.py:1.10 gnue/reports/src/GRRun.py:1.11
*** gnue/reports/src/GRRun.py:1.10 Thu Apr 11 01:56:50 2002
--- gnue/reports/src/GRRun.py Fri Apr 12 01:59:34 2002
***************
*** 32,37 ****
--- 32,38 ----
from gnue.common import GDebug, GConfig, dyn_import
from gnue.common.GClientApp import GClientApp
from GREngine import GREngine
+ import GRFilters
import GRExceptions
import string, sys
import tempfile
***************
*** 123,129 ****
# Initialize the class
#
def __init__(self):
! GClientApp.__init__(self)
lh = LoginHandler()
try:
--- 124,130 ----
# Initialize the class
#
def __init__(self):
! GClientApp.__init__(self, application='reports')
lh = LoginHandler()
try:
***************
*** 139,144 ****
--- 140,147 ----
def run(self):
+ self.filters = GRFilters.GRFilters()
+
#
# Are we doing a simple help-like operation?
#
***************
*** 198,232 ****
tempname = None
filter = self.OPTIONS["filter"]
desname = self.OPTIONS["destination"]
destype = string.lower(self.OPTIONS["destination_type"])
- if destype not in ('printer','email','fax','file'):
- self.handleStartupError ("Destination type must be one of " \
- + "'printer','email','fax', or 'file'.")
if destype == 'file' and desname == '-':
! outputHandle = sys.stdout
! sys.stdout = sys.stderr
!
! #
! # TODO: replace with handlers
! #
! elif destype == 'file' and filter == 'raw':
! try:
! outputHandle = open(desname, 'w')
! except IOError:
! self.handleStartupError ("Unable to open '%s' for output." % desname)
else:
! tmpdir = GConfig.get('TempDir','')
! if tmpdir:
! tempfile.tmpdir = tmpdir
! tmpname = tempfile.mktemp('-grrun.raw')
! GDebug.printMesg(2,'Using temporary file %s for raw output' % tmpname)
! try:
! outputHandle = open(tmpname, 'w')
! except IOError:
! self.handleStartupError ("Unable to open '%s' for output." % tmpname)
#
--- 201,232 ----
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)
#
***************
*** 240,246 ****
#
try:
GREngine(self.getConnectionManager()).processReport(reportfile,
! outputHandle = outputHandle,
parameters=userParameters, sortoption=sortoption,
includeStructuralComments=self.OPTIONS["comment"],
omitGNUeXML=self.OPTIONS["exclude_xml"])
--- 240,246 ----
#
try:
GREngine(self.getConnectionManager()).processReport(reportfile,
! outputHandle = filtAdapter.open(),
parameters=userParameters, sortoption=sortoption,
includeStructuralComments=self.OPTIONS["comment"],
omitGNUeXML=self.OPTIONS["exclude_xml"])
***************
*** 250,258 ****
self.handleStartupError (msg)
# Cleanup
! outputHandle.close()
! if tempname:
! os.remove(tempname)
#
# List filters available on the server
--- 250,256 ----
self.handleStartupError (msg)
# Cleanup
! filtAdapter.close()
#
# List filters available on the server
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue common/etc/sample.gnue.conf reports/adapte...,
Jason Cater <=