[Top][All Lists]
[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: |
Thu, 11 Apr 2002 00:19:31 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/04/11 00:19:30
Modified files:
common/etc : sample.gnue.conf sample.report-filters.conf
reports/adapters/email: smtp.py
reports/adapters/fax: hylafax.py
reports/adapters/file: text.py
reports/samples/foobulations: monthly.grd
reports/src : GRDataMapper.py GRRun.py
Added files:
reports/adapters/email: sendmail.py
reports/adapters/file: stdout.py
reports/adapters/filters/raw: Adapter.py __init__.py
reports/adapters/filters/sablotron: Adapter.py __init__.py
reports/src : GROutputAdapter.py
Log message:
Started on modularization of GNUe Reprots transformation adapters and
destination adapters; cleanup of code
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/etc/sample.gnue.conf.diff?cvsroot=OldCVS&tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/etc/sample.report-filters.conf.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/email/sendmail.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/email/smtp.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/fax/hylafax.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/file/stdout.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/file/text.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/filters/raw/Adapter.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/filters/raw/__init__.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/filters/sablotron/Adapter.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/adapters/filters/sablotron/__init__.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/samples/foobulations/monthly.grd.diff?cvsroot=OldCVS&tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GROutputAdapter.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRDataMapper.py.diff?cvsroot=OldCVS&tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRRun.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: gnue/common/etc/sample.gnue.conf
diff -c gnue/common/etc/sample.gnue.conf:1.23
gnue/common/etc/sample.gnue.conf:1.24
*** gnue/common/etc/sample.gnue.conf:1.23 Sat Apr 6 17:27:14 2002
--- gnue/common/etc/sample.gnue.conf Thu Apr 11 00:19:29 2002
***************
*** 222,230 ****
# DestinationType Adapters
PrinterAdapter = bsdlpr
! EmailAdapter = smtp
FileAdapter = file
FaxAdapter = hylafax
##############################################################################
--- 222,242 ----
# DestinationType Adapters
PrinterAdapter = bsdlpr
! EmailAdapter = sendmail
FileAdapter = file
FaxAdapter = hylafax
+
+ # DestinationType options
+ # (%s will be replaced with the printer name)
+ LprCommand = /usr/bin/lpr -P%s
+
+ # Sendmail binary (for EmailAdapter=sendmail)
+ SendmailBin = /usr/sbin/sendmail
+ SendmailFrom = address@hidden
+ SendmailSubject = Your Requested Report
+
+ # HylaFax sendfax binary (for FaxAdapter = hylafax)
+ HylaFaxBin = /usr/bin/sendfax
##############################################################################
Index: gnue/common/etc/sample.report-filters.conf
diff -c gnue/common/etc/sample.report-filters.conf:1.2
gnue/common/etc/sample.report-filters.conf:1.3
*** gnue/common/etc/sample.report-filters.conf:1.2 Sat Apr 6 20:20:35 2002
--- gnue/common/etc/sample.report-filters.conf Thu Apr 11 00:19:29 2002
***************
*** 1,3 ****
--- 1,4 ----
+
[mappings]
standard = GNUe:Reports:Standard
testing = GNUe:Reports:UnsupportedSimple
***************
*** 6,28 ****
[testing:text]
description = Basic text without any formatting
engine = sablotron
[testing:html]
description = HTML 3.0-compatable markup.
engine = sablotron
#
! #[standard:text]
! #description = Portable Document Format
! #
! #[standard:html]
! #description = Portable Document Format
! #
! #[standard:pdf]
! #description = Portable Document Format
! #
! #[standard:ps]
! #description = Postscript
#
--- 7,25 ----
[testing:text]
description = Basic text without any formatting
engine = sablotron
+ script = text.xsl
+ mimetype = text/plain
[testing:html]
description = HTML 3.0-compatable markup.
engine = sablotron
+ script = html.xsl
+ mimetype = text/html
#
! # It is not necessary to define 'raw' drivers
! # GNUe Reports automatically associates a "raw"
! # output for each mapping.
#
Index: gnue/reports/adapters/email/smtp.py
diff -c gnue/reports/adapters/email/smtp.py:1.1
gnue/reports/adapters/email/smtp.py:1.2
*** gnue/reports/adapters/email/smtp.py:1.1 Sat Apr 6 20:20:36 2002
--- gnue/reports/adapters/email/smtp.py Thu Apr 11 00:19:29 2002
***************
*** 0 ****
--- 1,75 ----
+ #
+ # 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 2002 Free Software Foundation
+ #
+ # FILE:
+ # transforms/file/stdio.py
+ #
+ # DESCRIPTION:
+ # Basic destination adapter for writing to stdout
+ #
+ # NOTES:
+ #
+
+ import sys
+
+ from gnue.reports.GROutputAdapter import DestinationAdapter as Base
+
+ class DestinationAdapter(_BaseAdapter):
+
+ #
+ # Typically, a transform adapter will call EITHER
+ # getOutputHandle or getOutputFile, not both.
+ #
+ # return a stream handle for outut by
+ # the transform adapter
+ #
+ def getOutputHandle(self):
+ self.tempfile = None
+ self.input = sys.stdout
+
+ # Make any output from the program go to stderr instead
+ sys.stdout = sys.stderr
+
+ return self.input
+
+ #
+ # return a file name for outut by the
+ # transform adapter
+ #
+ def getOutputFile(self):
+ self.input, self.tempfile = self.createTempFile()
+ self.input.close()
+ return self.tempfile
+
+ #
+ # Wrap up
+ #
+ def close(self, mimetype='plain/text'):
+ #
+ # If we had to use a temp file, echo it back to screen
+ #
+ if self.tempfile:
+ self.input.close()
+ input = open(self.tempfile)
+ while (in = input.readline())
+ print in
+ input.close()
+ self.deleteTempFile(self.tempfile)
+
Index: gnue/reports/adapters/fax/hylafax.py
diff -c gnue/reports/adapters/fax/hylafax.py:1.1
gnue/reports/adapters/fax/hylafax.py:1.2
*** gnue/reports/adapters/fax/hylafax.py:1.1 Sat Apr 6 20:20:36 2002
--- gnue/reports/adapters/fax/hylafax.py Thu Apr 11 00:19:30 2002
***************
*** 0 ****
--- 1,86 ----
+ #
+ # 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 2002 Free Software Foundation
+ #
+ # FILE:
+ # email/sendmail.py
+ #
+ # DESCRIPTION:
+ # Basic destination adapter for writing to sendmail
+ #
+ # NOTES:
+ #
+
+ from gnue.common import GConfig
+ from gnue.reports import VERSION
+ from gnue.reports.GROutputAdapter import DestinationAdapter as Base
+ import sys, os, string
+ from mimetools import choose_boundary
+ from MimeWriter import MimeWriter
+ import base64
+
+ try:
+ from cStringIO import StringIO
+ except ImportError:
+ from StringIO import StringIO
+
+
+
+ class DestinationAdapter(_BaseAdapter):
+
+ #
+ # Typically, a transform adapter will call EITHER
+ # getOutputHandle or getOutputFile, not both.
+ #
+ # return a stream handle for outut by
+ # the transform adapter
+ #
+ def getOutputHandle(self):
+ self.usingHandle = 1
+ self.input, self.tempfile = self.createTempFile()
+ return self.input
+
+ #
+ # return a file name for outut by the
+ # transform adapter
+ #
+ def getOutputFile(self):
+ self.usingHandle = 0
+ self.input, self.tempfile = self.createTempFile()
+ self.input.close()
+ return self.tempfile
+
+ #
+ # Wrap up
+ #
+ def close(self, mimetype='plain/text'):
+
+ if self.usingHandle:
+ self.input.close()
+
+ file = self.tempfile
+
+ fax_to = string.replace(string.replace(self.destination, "`",""),';','')
+
+ os.system(GConfig.get('HylafaxBin',"/usr/bin/sendfax")+" -d '%s' %s" %
(fax_to, file))
+ self.deleteTempFile(self.tempfile)
+
+
+ # The supported mime types that can be fed to HylaFax
+ _supportedMimeTypes = ('plain/text', 'application/ps')
Index: gnue/reports/adapters/file/text.py
diff -c gnue/reports/adapters/file/text.py:1.1
gnue/reports/adapters/file/text.py:1.2
*** gnue/reports/adapters/file/text.py:1.1 Sat Apr 6 20:20:36 2002
--- gnue/reports/adapters/file/text.py Thu Apr 11 00:19:30 2002
***************
*** 0 ****
--- 1,60 ----
+ #
+ # 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 2002 Free Software Foundation
+ #
+ # FILE:
+ # transforms/file/text.py
+ #
+ # DESCRIPTION:
+ # Basic destination adapter for writing to a text file
+ #
+ # NOTES:
+ #
+
+
+ from gnue.reports.GROutputAdapter import DestinationAdapter as Base
+
+ class DestinationAdapter(_BaseAdapter):
+
+ #
+ # Typically, a transform adapter will call EITHER
+ # getOutputHandle or getOutputFile, not both.
+ #
+ # return a stream handle for outut by
+ # the transform adapter
+ #
+ def getOutputHandle(self):
+ self.output = open(destination,'w')
+ return self.output
+
+ #
+ # return a file name for outut by the
+ # transform adapter
+ #
+ def getOutputFile(self):
+ self.output = None
+ return self.destination
+
+ #
+ # Wrap up
+ #
+ def close(self, mimetype='plain/text'):
+ if self.output:
+ self.output.close()
+
Index: gnue/reports/samples/foobulations/monthly.grd
diff -c gnue/reports/samples/foobulations/monthly.grd:1.13
gnue/reports/samples/foobulations/monthly.grd:1.14
*** gnue/reports/samples/foobulations/monthly.grd:1.13 Wed Apr 10 18:25:00 2002
--- gnue/reports/samples/foobulations/monthly.grd Thu Apr 11 00:19:30 2002
***************
*** 36,42 ****
<out:col align="right"><field name="foobs"/></out:col>
</out:row>
</section>
! <out:row type="subtotal" level="2"> <!-- TODO: Replace w/summs
once they work -->
<out:col/>
<out:col align="right">Total for <field name="name"/></out:col>
<out:col align="right"><summ function="sum" section="details"
field="foobs"/></out:col>
--- 36,42 ----
<out:col align="right"><field name="foobs"/></out:col>
</out:row>
</section>
! <out:row type="subtotal" level="2">
<out:col/>
<out:col align="right">Total for <field name="name"/></out:col>
<out:col align="right"><summ function="sum" section="details"
field="foobs"/></out:col>
Index: gnue/reports/src/GRDataMapper.py
diff -c gnue/reports/src/GRDataMapper.py:1.14
gnue/reports/src/GRDataMapper.py:1.15
*** gnue/reports/src/GRDataMapper.py:1.14 Wed Apr 10 15:58:35 2002
--- gnue/reports/src/GRDataMapper.py Thu Apr 11 00:19:30 2002
***************
*** 56,62 ****
self._fieldsOld = {}
self.toplevel = 0 # Is this the first section to use a datasource
self.initial = 1 # Are we in an initial run in which we have no
history?
- ## self.changed = 0 # Did this section change w/the last
self.grouping = 0 # Is this a "grouping" section?
self._lastSection = None
self.datasource = None
--- 56,61 ----
***************
*** 112,118 ****
pass
-
#
# Get a field's current value
#
--- 111,116 ----
***************
*** 135,147 ****
def addChildSection(self, mapper):
self.sections.append(mapper)
- ## #
- ## # Set initial states
- ## #
- ## def resetState(self):
- ## self.initial = 1
- ## self.changed = 0
-
#
# Zero out the summary data
--- 133,138 ----
***************
*** 152,178 ****
self.summaries[field][function] = None
- ## #
- ## # Save current values before new query occurs
- ## #
- ## def _loadFields(self, recordset):
- ## GDebug.printMesg(10, 'self=%s,%s'%(self,self.name))
- ## if ( self.initial or \
- ## not self.grouping or \
- ## self.fields[field] != val ):
- ## self.changed = 1
- ## GDebug.printMesg(10, "Field %s changed after nextRecord
(%s,%s,%s,%s)" % (field, self.initial, self.grouping, self.fields[field], val))
- ## self.fields[field] = val
- ##
- ## handler = self
- ## while handler:
- ## handler._handleSummary(field, val)
- ## handler = handler.parent
- ##
- ## GDebug.printMesg(10, "After _loadFields, changed=%s" % self.changed)
- ## self.initial = 0
-
-
#
# Will the next recordset cause our section to change?
#
--- 143,148 ----
***************
*** 192,198 ****
return changed
! ## #
# Initiate the calculation of summaries
#
def _handleSummary(self):
--- 162,168 ----
return changed
! #
# Initiate the calculation of summaries
#
def _handleSummary(self):
Index: gnue/reports/src/GRRun.py
diff -c gnue/reports/src/GRRun.py:1.8 gnue/reports/src/GRRun.py:1.9
*** gnue/reports/src/GRRun.py:1.8 Tue Apr 9 18:55:41 2002
--- gnue/reports/src/GRRun.py Thu Apr 11 00:19:30 2002
***************
*** 29,35 ****
from gnue.reports import VERSION
! from gnue.common import GDebug, GConfig
from gnue.common.GClientApp import GClientApp
from GREngine import GREngine
import GRExceptions
--- 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 GRExceptions
***************
*** 72,77 ****
--- 72,81 ----
'[--quiet] option or you may get junk in your output stream. '
'NOTE: Currently the default value is "-" -- this may change once
GNUe '
'Reports is formally released!'],
+ [ 'destination_options', None, 'destination-options', 1, '', 'opts',
+ 'Options to pass to the destination process. Available options are '
+ 'specific to the type of destination. '
+ 'Example: \'--destination-options "-o nobanner" \''],
[ 'filter', 'f', 'filter', 1, 'raw', 'filt',
'Select the filter to be used to process report output. <filt> '
'is the name of the filtering process as defined on the Report '
***************
*** 79,89 ****
'(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', 'O', 'filter-options', 1, '', 'opts',
'Options to pass to the filter process. Available options are '
'specific to the filter. --filter-list will list available filters
'
'and their options. Example: \'--filter-options "paper=letter
margin=1,1,1,1" \''],
! [ 'sortoption', 's', 'sort-option', 1, '', 'sort',
'Select the "sort-option" used to sort the report. '],
[ 'quiet', 'q', 'quiet', 0, 0, None,
'Run GNUe Reports in quiet mode -- i.e., display no output. '
--- 83,93 ----
'(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 '
'specific to the filter. --filter-list will list available filters
'
'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. '],
[ 'quiet', 'q', 'quiet', 0, 0, None,
'Run GNUe Reports in quiet mode -- i.e., display no output. '
***************
*** 115,124 ****
"GNUe Reports is the primary reporting agent of the GNU Enterprise
system."
USAGE = GClientApp.USAGE % COMMAND + " [param1=val] [param2=val] [...]"
! #
# Initialize the class
#
! def __init__(self):
GClientApp.__init__(self)
lh = LoginHandler()
--- 119,128 ----
"GNUe Reports is the primary reporting agent of the GNU Enterprise
system."
USAGE = GClientApp.USAGE % COMMAND + " [param1=val] [param2=val] [...]"
! #
# Initialize the class
#
! def __init__(self):
GClientApp.__init__(self)
lh = LoginHandler()
***************
*** 127,133 ****
lh.defaults['_username'] = self.OPTIONS['user']
if len(self.OPTIONS['password']):
lh.defaults['_password'] = self.OPTIONS['password']
! except:
pass
self.getConnectionManager().setLoginHandler(lh)
--- 131,137 ----
lh.defaults['_username'] = self.OPTIONS['user']
if len(self.OPTIONS['password']):
lh.defaults['_password'] = self.OPTIONS['password']
! except:
pass
self.getConnectionManager().setLoginHandler(lh)
- gnue common/etc/sample.gnue.conf common/etc/sam...,
Jason Cater <=