commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue common/etc/sample.gnue.conf common/etc/sam...


From: Jason Cater
Subject: gnue common/etc/sample.gnue.conf common/etc/sam...
Date: Fri, 12 Apr 2002 20:54:21 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/04/12 20:54:21

Modified files:
        common/etc     : sample.gnue.conf sample.report-filters.conf 
        reports/adapters/filters/sablotron: Adapter.py 
        reports/src    : GRFilters.py GROutputAdapter.py 

Log message:
        reports: inplace transformations working now (--filter html  or 
--filter text)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/etc/sample.gnue.conf.diff?cvsroot=OldCVS&tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/etc/sample.report-filters.conf.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/filters/sablotron/Adapter.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRFilters.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GROutputAdapter.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gnue/common/etc/sample.gnue.conf
diff -c gnue/common/etc/sample.gnue.conf:1.26 
gnue/common/etc/sample.gnue.conf:1.27
*** gnue/common/etc/sample.gnue.conf:1.26       Fri Apr 12 18:21:34 2002
--- gnue/common/etc/sample.gnue.conf    Fri Apr 12 20:54:21 2002
***************
*** 209,215 ****
  
  [reports]
  ReportsDir = reports
! FiltersDir = filters
  
  # TempDir = /usr/tmp
  
--- 209,215 ----
  
  [reports]
  ReportsDir = reports
! FiltersDir = shared/filters
  
  # TempDir = /usr/tmp
  
Index: gnue/common/etc/sample.report-filters.conf
diff -c gnue/common/etc/sample.report-filters.conf:1.3 
gnue/common/etc/sample.report-filters.conf:1.4
*** gnue/common/etc/sample.report-filters.conf:1.3      Thu Apr 11 00:19:29 2002
--- gnue/common/etc/sample.report-filters.conf  Fri Apr 12 20:54:21 2002
***************
*** 1,7 ****
  
  [mappings]
  standard = GNUe:Reports:Standard
! testing = GNUe:Reports:UnsupportedSimple
  
  
  [testing:text]
--- 1,7 ----
  
  [mappings]
  standard = GNUe:Reports:Standard
! testing = GNUe:Reports:SimpleTabulation
  
  
  [testing:text]
***************
*** 22,25 ****
  # It is not necessary to define 'raw' drivers
  # GNUe Reports automatically associates a "raw"
  # output for each mapping.
! #
\ No newline at end of file
--- 22,25 ----
  # It is not necessary to define 'raw' drivers
  # GNUe Reports automatically associates a "raw"
  # output for each mapping.
! #
Index: gnue/reports/adapters/filters/sablotron/Adapter.py
diff -c gnue/reports/adapters/filters/sablotron/Adapter.py:1.1 
gnue/reports/adapters/filters/sablotron/Adapter.py:1.2
*** gnue/reports/adapters/filters/sablotron/Adapter.py:1.1      Thu Apr 11 
00:19:30 2002
--- gnue/reports/adapters/filters/sablotron/Adapter.py  Fri Apr 12 20:54:21 2002
***************
*** 53,67 ****
      # Get a file for output from the destination adapter.
      outfile = self.destination.getOutputFile()
  
!     # TODO: get the name of the transform!?!?!?!?
!     xslfile = '~/cvs/gnue/reports/samples/foobulations/html.xsl'
  
      # Let sablotron do its thing
!     PySablot.ProcessFiles(xslfile,infile,outfile)
      P = Sablot.Sablot()
  
      # Let the destination adapter do its thing
      self.destination.close(mimetype="plain/text")
  
      # clean up our temp files
!     self.deleteTempFile(infile)
--- 53,70 ----
      # Get a file for output from the destination adapter.
      outfile = self.destination.getOutputFile()
  
!     # Get the name of the transform script
!     try:
!       xslfile = self.parameters['script']
!     except KeyError:
!       raise "Filter configuration file is missing script="
  
      # Let sablotron do its thing
!     PySablot.ProcessFiles(xslfile,self.infile,outfile)
      P = Sablot.Sablot()
  
      # Let the destination adapter do its thing
      self.destination.close(mimetype="plain/text")
  
      # clean up our temp files
!     self.deleteTempFile(self.infile)
Index: gnue/reports/src/GRFilters.py
diff -c gnue/reports/src/GRFilters.py:1.4 gnue/reports/src/GRFilters.py:1.5
*** gnue/reports/src/GRFilters.py:1.4   Fri Apr 12 18:21:34 2002
--- gnue/reports/src/GRFilters.py       Fri Apr 12 20:54:21 2002
***************
*** 45,58 ****
      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
  
  #
--- 45,65 ----
      self._config = GRFilterConfig()
  
    def loadFilter(self, namespace, filter, destination, filter_options):
! 
!     try:
!       parameters = self._config.filters[namespace + ":" + filter]
!     except KeyError:
!       raise FilterError, \
!         "Unable to find a filter definition for %s" % (namespace+":"+filter)
! 
!     try:
!       module = dyn_import ('gnue.reports.adapters.filters.%s' % 
parameters['engine'])
!     except ImportError:
!       raise FilterError, "Invalid filter specified: %s" % filter
!     except KeyError:
!       raise FilterError, "Filter configuration file does not contain an 
'engine=' for %s" % filter
! 
!     adapter = module.TransformAdapter(destination, parameters, filter_options)
      return adapter
  
  #
***************
*** 66,83 ****
      self.mappings = {}
      self.filters = {}
  
-     # Get the install prefix
-     if os.environ.has_key('INSTALL_PREFIX'):
-       install_prefix = os.environ['INSTALL_PREFIX']
-     else:
-       install_prefix = '/usr/local/gnue'
- 
  
      # Load the report-filters file
      location = GConfig.get('filters','')
      if location:
        if location[0] != '/':
!         location = install_prefix + location
        self.readConfig(location)
  
  
--- 73,84 ----
      self.mappings = {}
      self.filters = {}
  
  
      # Load the report-filters file
      location = GConfig.get('filters','')
      if location:
        if location[0] != '/':
!         location = install_prefix + "/" + location
        self.readConfig(location)
  
  
***************
*** 112,118 ****
        self.mappings[string.lower(option)] = 
self._parser.get('mappings',option)
  
      # Get the base directory for filters
!     filterBase = GConfig.get('FiltersDir','filters')
      if filterBase[0] != '/':
        filterBase = install_prefix + '/' + filterBase
  
--- 113,119 ----
        self.mappings[string.lower(option)] = 
self._parser.get('mappings',option)
  
      # Get the base directory for filters
!     filterBase = GConfig.get('FiltersDir','shared/filters')
      if filterBase[0] != '/':
        filterBase = install_prefix + '/' + filterBase
  
***************
*** 132,142 ****
  
          # Then pull in the config variables
          for option in self._parser.options(section):
!           if option == 'script' and script[0] != '/':
  
!           self.filters[translated][option] = self._parser.get(section, option)
  
!     print self.filters
  
  
    def getMappings(self):
--- 133,150 ----
  
          # Then pull in the config variables
          for option in self._parser.options(section):
!           val = self._parser.get(section, option)
  
!           # If this is the script name, prepend the path
!           if option == 'script' and val[0] != '/':
!             if translated[:13] == 'GNUe:Reports:':
!               val = "%s/%s/%s" % (filterBase,
!                        string.split(translated,':')[2],
!                        val)
!             else:
!               val = filterBase + val
  
!           self.filters[translated][option] = val
  
  
    def getMappings(self):
***************
*** 144,146 ****
--- 152,162 ----
  
    def getFilters(self):
      return []
+ 
+ 
+ # Get the install prefix
+ if os.environ.has_key('INSTALL_PREFIX'):
+   install_prefix = os.environ['INSTALL_PREFIX']
+ else:
+   install_prefix = '/usr/local/gnue'
+ 
Index: gnue/reports/src/GROutputAdapter.py
diff -c gnue/reports/src/GROutputAdapter.py:1.2 
gnue/reports/src/GROutputAdapter.py:1.3
*** gnue/reports/src/GROutputAdapter.py:1.2     Fri Apr 12 01:59:34 2002
--- gnue/reports/src/GROutputAdapter.py Fri Apr 12 20:54:21 2002
***************
*** 27,32 ****
--- 27,33 ----
  # NOTES:
  #
  
+ from gnue.common import GDebug
  import types
  import tempfile
  import os
***************
*** 63,72 ****
    # 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
  
  
  #
--- 64,74 ----
    # filter_parameters is a string that can be in any
    # format the TransformAdapter defines
    #
!   def __init__(self, destination, parameters = {}, filter_options=""):
      self.destination = destination
      self.output = destination.getOutputHandle()
      self.options= filter_options
+     self.parameters = parameters
  
  
  #



reply via email to

[Prev in Thread] Current Thread [Next in Thread]