commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnue-reports README samples/location/zip-b...


From: Jason Cater
Subject: gnue/gnue-reports README samples/location/zip-b...
Date: Tue, 29 May 2001 19:19:50 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/05/29 19:19:49

Modified files:
        gnue-reports   : README 
        gnue-reports/samples/location: zip-by-state.grd 
        gnue-reports/src: GREngine.py GRExceptions.py GRLayout.py 
                          GRParameters.py GRParser.py GRReport.py 
                          GRSources.py grrun 
Added files:
        gnue-reports/src: GRDataMapper.py 

Log message:
        First working model of Reports. Currently does not recognize summaries, 
sortoptions, or parameters (the latter two are pending changes to the 
<datasource> tag formats).

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/README.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/samples/location/zip-by-state.grd.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRDataMapper.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GREngine.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRExceptions.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRLayout.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRParameters.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRParser.py.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRReport.py.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRSources.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/grrun.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gnue/gnue-reports/README
diff -u gnue/gnue-reports/README:1.3 gnue/gnue-reports/README:1.4
--- gnue/gnue-reports/README:1.3        Fri May 25 01:18:35 2001
+++ gnue/gnue-reports/README    Tue May 29 19:19:49 2001
@@ -1,12 +1,17 @@
 GNUe-Reports is in an early alpha state and is not currently useful.
 You have been warned :) 
 
-GNUe-Reports requires gnue-common to be installed.
+GNUe-Reports requires gnue-common to be installed, including the setup
+of the connections file (see gnue-common README for details). 
 
 In the src directory, there is a "grrun" program.  It creates a 
 Report Engine, passes the engine a report, and prints the output 
 from the engine to stdout.  Execute "grrun --help" to see all 
 available run-time options (user parameters, sorting options, etc).  
+
+
+At the time of this writing, only postgresql is supported. This will
+quickly change. 
 
 For questions, use the reports mailing list at http://lists.gnue.org/ 
 or visit us in IRC at irc.openprojects.net, channel #gnuenterprise
Index: gnue/gnue-reports/samples/location/zip-by-state.grd
diff -u gnue/gnue-reports/samples/location/zip-by-state.grd:1.3 
gnue/gnue-reports/samples/location/zip-by-state.grd:1.4
--- gnue/gnue-reports/samples/location/zip-by-state.grd:1.3     Fri May 25 
01:18:35 2001
+++ gnue/gnue-reports/samples/location/zip-by-state.grd Tue May 29 19:19:49 2001
@@ -35,20 +35,17 @@
 
 
   <layout>
-    <section group="main">
-
-      (Some random text)
-
-      <field source="zips" name="zipcode"/>
-      <field source="zips" name="city"/>
-
-      (Some more random text)
-
-      <section group="state" source="states">
-        <field source="states" name="description"/>
+    &lt;myreport&gt;<section name="citydetail" source="zips">
+      ===========
+      City: <field source="zips" name="city"/>
+      <section name="zipdetail">
+        <field source="zips" name="zipcode"/>
+        <section name="statedetail" source="states">
+          <field source="states" name="description"/> (<field source="zips" 
name="state"/>)
+        </section>
       </section>
-
     </section>
+    &lt;/myreport&gt;
   </layout>
 
 
Index: gnue/gnue-reports/src/GREngine.py
diff -u gnue/gnue-reports/src/GREngine.py:1.5 
gnue/gnue-reports/src/GREngine.py:1.6
--- gnue/gnue-reports/src/GREngine.py:1.5       Fri May 25 01:18:35 2001
+++ gnue/gnue-reports/src/GREngine.py   Tue May 29 19:19:49 2001
@@ -46,10 +46,12 @@
   # Run the report (reportFile) and generate the XML output. 
   # Write the XML output to handle tempFileHandle 
   #
-  def processReport(self, reportFile, parameters={}, sortoption=None): 
+  def processReport(self, reportFile, parameters={}, sortoption=None, \
+                          includeStructuralComments=0): 
 
     import sys
     outputHandle = sys.stdout
+#    outputHandle = sys.stderr
 
     drive = os.path.splitdrive(reportFile) 
     if len(drive[0]):
@@ -59,7 +61,8 @@
 
     report = GRParser.loadReport(fileHandle, self._connectionManager)
 
-    report.process(outputHandle, parameters, sortoption)
+    report.process(outputHandle, parameters, sortoption, \
+                   includeStructuralComments)
 
     GDebug.printMesg(999, '-'*60)
     GDebug.printMesg(999, report.dumpXML(1))
Index: gnue/gnue-reports/src/GRExceptions.py
diff -u gnue/gnue-reports/src/GRExceptions.py:1.1 
gnue/gnue-reports/src/GRExceptions.py:1.2
--- gnue/gnue-reports/src/GRExceptions.py:1.1   Fri May 25 01:18:35 2001
+++ gnue/gnue-reports/src/GRExceptions.py       Tue May 29 19:19:49 2001
@@ -46,14 +46,43 @@
 class ReportMarkupException(ReportException): 
   pass
 
-# Called if report definition does not contain a <layout> section
-class NoLayoutSection(ReportMarkupException): 
+# Raised if report definition does not contain any layout directives
+class NoLayoutDefined(ReportMarkupException): 
   pass
 
-# Called if report definition does not contain a <sources> section
+# Raised if report definition does not contain a <layout> section
+class NoLayoutSection(NoLayoutDefined): 
+  pass
+
+# Raised if report definition does not contain a <sources> section
 class NoSourcesSection(ReportMarkupException): 
   pass
 
-# Called if a datasource references a master that does not exist
+# Raised if a datasource references a master that does not exist
 class MasterSourceNotFound(ReportMarkupException): 
   pass
+
+# Raised if a source is referenced in  sibling sections. 
+# Sources can only be mapped to a single section or children 
+# of that section.
+class SourceMappedToSiblingSections(ReportMarkupException): 
+  pass
+
+# Raised if more than one section has the same name
+class SectionHasDuplicateName(ReportMarkupException): 
+  pass
+
+# Raised if a field is referenced without a source 
+# and non of its ancestors define a source
+class LayoutFieldHasNoSource(ReportMarkupException): 
+  pass
+
+# Raised if a summary is referenced without a source 
+# and non of its ancestors define a source
+class LayoutSummaryHasNoSource(ReportMarkupException): 
+  pass
+
+# Raised if a field/summary uses a source outside of its scope 
+class SourceOutOfScope(ReportMarkupException): 
+  pass
+
Index: gnue/gnue-reports/src/GRLayout.py
diff -u gnue/gnue-reports/src/GRLayout.py:1.3 
gnue/gnue-reports/src/GRLayout.py:1.4
--- gnue/gnue-reports/src/GRLayout.py:1.3       Fri May 25 01:18:35 2001
+++ gnue/gnue-reports/src/GRLayout.py   Tue May 29 19:19:49 2001
@@ -16,7 +16,7 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place 
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000 Free Software Foundation
+# Copyright 2000, 2001 Free Software Foundation
 #
 # FILE:
 # GRLayout.py
@@ -31,16 +31,32 @@
 
 
 from gnue.common.GObjects import *
+from gnue.common import GDebug
+import GRExceptions
+import string
 
-class GRLayoutElement (GObj): 
-  def __init__(self, parent=None, type='GRLayoutElement'):
-    GObj.__init__(self, parent, type=type)
 
 
+# Used to send structural comment
+# Chose not to do  "if COMMENT == 1: dest.write"
+# for performance reasons
+def _structuralComment(dest, text): 
+  dest.write(text)
+
+def _noStructuralComment(dest, text): 
+  pass
+
+structuralComment = _noStructuralComment
+
+
+############################################################
+#
+#
 class GRLayout (GObj): 
   def __init__(self, parent):
     GObj.__init__(self, parent, type='GRLayout')
 
+
   def buildObject(self): 
     # If there is more than one object attached to a layout 
     # object, then create an unattached section to contain them.
@@ -50,22 +66,213 @@
       section = GRSection(self)
       section._children = temp
       section.buildObject()
+    elif len(self._children) == 0: 
+      raise GRException.NoLayoutDefined, \
+        "The layout section does not contain anything"
+
+  #
+  # Prepare for running
+  # 
+  def prepare(self, mapper):
+
+    self._mapper = mapper
+    self.walk(self.__prepare)
+
+  # Used by prepare()
+  def __prepare(self, object): 
+
+    if isinstance(object, GRLayoutElement): 
+
+        
+      # If section/field/summary does not have a source, 
+      # inherit parent's source (if available)
+
+      if object.source == None and \
+         isinstance(object._parent, GRLayoutElement): 
+
+        object.source = object._parent.source
+
+        if object.source == None and isinstance(object, GRField): 
+          raise LayoutFieldHasNoSource, \
+             "Field %s in section %s does not connect to a source" \
+                 % (object.name, object.getParentOfType('GRSection').name)
+
+        if object.source == None and isinstance(object, GRSumm): 
+          raise LayoutSummaryHasNoSource, \
+             "Summary %s in section %s does not connect to a source" \
+                 % (object.name, object.getParentOfType('GRSection').name)
+
+    
+
+      # This all looks confusing, but basically it simply figures out
+      # what section a field or summary actually pulls from and also 
+      # makes sure a section, field, or summary isn't trying to use
+      # a source outside of the source's scope.  After it's satisfied 
+      # with the results, it adds the element to the mapper object.
+
+      if isinstance(object, GRSection) and object.source != None: 
+        if isinstance(object._parent, GRLayout): 
+          self._mapper.addSection(object.name, object.source, None)
+        else: 
+          self._mapper.addSection(object.name, \
+              object.source, object._parent.name)
+        object._mymapper = self._mapper.sectionMap[object.name]
+
+      elif isinstance(object, GRField): 
+        s = object._parent.getAncestorWithSource(object.source)
+        if s == None: 
+          raise SourceOutOfScope, \
+                "Field %s in section %s uses out-of-scope source %s" \
+                     % (object.name, object._parent.name, object.source)
+
+        object._section = s.name             
+        object._mymapper = self._mapper.sectionMap[object._section]
+
+        GDebug.printMesg(6,'Mapping field %s to section %s' \
+                   % (object.name, object._section))
+        self._mapper.addFieldToSection(object._section, object.name)
+
+      elif isinstance(object, GRSumm): 
+        if object.section == None: 
+          s = object._parent.getAncestorWithSource(object.source)
+          if s == None: 
+            raise SourceOutOfScope, \
+              "Summary %s in section %s uses out-of-scope source %s" \
+                   % (object.name, object._parent.name, object.source)
+        else:
+          s = self._mapper.sectionMap[object.section].\
+                 getAncestorWithSource(object.source)
+          if s == None: 
+            raise SourceOutOfScope, \
+              "Summary %s in section %s uses out-of-scope source %s" \
+                   % (object.name, object._parent.name, object.source)
+
+        object._section = s.name
+        object._mymapper = self._mapper.sectionMap[object._section]
+
+        GDebug.printMesg(6,'Mapping summary %s [%s] to section %s' \
+                   % (object.name, object.function, object._section))
+        self._mapper.addSummaryToSection(object._section, object.name, \
+                 object.function)
+
+
+  #
+  # Process layout and dump output.
+  # self.prepare *must* have been called.
+  # 
+  def process(self, dest, includeStructuralComments=0): 
+
+    global structuralComment
+    if includeStructuralComments: 
+      structuralComment = _structuralComment
+
+    for child in self._children:
+      structuralComment(dest, '<!-- <layout> -->')
+      child.process(dest, self._mapper)
+      structuralComment(dest, '<!-- </layout> -->\n')
+      
 
 
-
-class GRField (GRLayoutElement): 
-  def __init__(self, parent):
-    GRLayoutElement.__init__(self, parent, 'GRField')
 
+############################################################
+#
+# Any elements contained within a <layout> element 
+# inherit GRLayoutElement
+#
+class GRLayoutElement (GObj): 
+  def __init__(self, parent=None, type='GRLayoutElement'):
+    GObj.__init__(self, parent, type=type)
+    self.name = None
+    self.source = None
+    self._mymapper = None
+    
+  def process(self, dest, mapper): 
+    pass
 
+############################################################
+#
+# <section> tag
+#
 class GRSection (GRLayoutElement): 
   def __init__(self, parent):
     GRLayoutElement.__init__(self, parent, 'GRSection')
 
+  def process(self, dest, mapper): 
+
+
+    myTurnAtBat = 1
+
+    while myTurnAtBat: 
+      structuralComment(dest,"<!--[section:%s]-->" % self.name)
+      GDebug.printMesg(10,"Repeating Section %s" % self.name)
+      for child in self._children:
+        if child.getObjectType() == "_content_": 
+          dest.write(child.getContent())
+        else: 
+          if isinstance(child, GRSection) and child._mymapper.toplevel: 
+            GDebug.printMesg(10, "Getting first record for child; 
(child,toplevel)=(%s,%s)" % (child.name, child._mymapper.toplevel))
+            mapper.getFirstRecord(child.source)
+          child.process(dest, mapper)
+      if self._mymapper == None or not self._mymapper.toplevel: 
+        myTurnAtBat = 0
+      else:
+        goto = mapper.getNextRecord(self.source)
+        GDebug.printMesg (10, "Goto is '%s'" % goto)
+        if goto == None: 
+          myTurnAtBat = 0
+        else: 
+          if goto != self.name: 
+            GDebug.printMesg (10, "Calling process() for section '%s'" % goto)
+            mapper.sectionMap[goto].process(dest, mapper)
+      structuralComment(dest,"<!--[/section:%s]-->" % self.name)
+    GDebug.printMesg(10,"Left section %s" % self.name)
+            
+
+
+  #
+  #  getAncestorWithSource()
+  #
+  def getAncestorWithSource(self, source): 
+    if self.source == source: 
+      return self
+    elif isinstance(self._parent, GRSection): 
+      return self._parent.getAncestorWithSource(source)
+    else: 
+      return None
+
+
+############################################################
+#
+# <field> tag
+#
+class GRField (GRLayoutElement): 
+  def __init__(self, parent):
+    GRLayoutElement.__init__(self, parent, 'GRField')
+    self._section = None
+    self.format = None
+
+  def process(self, dest, mapper): 
+    structuralComment(dest,"<!--[field:%s]-->" % self.name)
+    dest.write (self._mymapper.getField(self.name, self.format))
+    structuralComment(dest,"<!--[/field:%s]-->" % self.name)
 
-class GRSummary (GRLayoutElement): 
+
+############################################################
+#
+# <summ> tag
+#
+class GRSumm (GRLayoutElement): 
   def __init__(self, parent):
-    GRLayoutElement.__init__(self, parent, 'GRSummary')
+    GRLayoutElement.__init__(self, parent, 'GRSumm')
+    self.section = None
+    self.function = "count"
+    self.format = None
+
+  def process(self, dest, mapper): 
+    structuralComment(dest,"<!--[summ:%s]-->" % self.name)
+    dest.write (self._mymapper.getSummary(self.name, self.function, 
self.format))
+    structuralComment(dest,"<!--[/summ:%s]-->" % self.name)
+
 
 
 
Index: gnue/gnue-reports/src/GRParameters.py
diff -u gnue/gnue-reports/src/GRParameters.py:1.3 
gnue/gnue-reports/src/GRParameters.py:1.4
--- gnue/gnue-reports/src/GRParameters.py:1.3   Wed May 23 15:54:42 2001
+++ gnue/gnue-reports/src/GRParameters.py       Tue May 29 19:19:49 2001
@@ -64,8 +64,9 @@
   # parameters used to run the current report
   #
   def getRunOptionsAsXML(self): 
-    xml = ""
+    from xml.sax import saxutils
 
+    xml = ""
     parameters = {}
 
     for child in self._children: 
@@ -78,7 +79,7 @@
 
     for param in parameters.keys(): 
       xml = xml + '    <GNUe-request-parameter 
id="%s">%s</GNUe-request-parameter>\n' % \
-            (param, parameters[param])
+            (param, saxutils.escape(parameters[param]))
 
     return xml
 
Index: gnue/gnue-reports/src/GRParser.py
diff -u gnue/gnue-reports/src/GRParser.py:1.7 
gnue/gnue-reports/src/GRParser.py:1.8
--- gnue/gnue-reports/src/GRParser.py:1.7       Fri May 25 01:18:35 2001
+++ gnue/gnue-reports/src/GRParser.py   Tue May 29 19:19:49 2001
@@ -85,13 +85,15 @@
                                       'default':     (0, 0, bool, 0)   }, 1),
       'sortcolumn':   (GRSortColumn,{ 'name':        (1, 0, char, None)}, 1), 
       'layout':       (GRLayout,    { 'format':      (0, 0, char, None)}, 0), 
-      'section':      (GRSection,   { 'group':       (0, 0, char, None), 
+      'section':      (GRSection,   { 'name':        (0, 0, char, None), 
                                       'source':      (0, 0, char, None)}, 0), 
       'field':        (GRField,     { 'name':        (1, 0, char, None), 
                                       'source':      (0, 0, char, None), 
                                       'format':      (0, 0, char, None)}, 1), 
       'summ':         (GRField,     { 'name':        (1, 0, char, None), 
-                                      'reset':       (0, 0, char, None), 
+                                      'function':    (0, 0, char, "count"), 
+                                      'source':      (0, 0, char, None), 
+                                      'section':     (0, 0, char, None), 
                                       'format':      (0, 0, char, None)}, 1), 
       'sources':      (GRSources,   {                                  }, 1), 
       'datasource':   (GRDataSource,  GDataSource.tagAttributes         , 1), 
Index: gnue/gnue-reports/src/GRReport.py
diff -u gnue/gnue-reports/src/GRReport.py:1.7 
gnue/gnue-reports/src/GRReport.py:1.8
--- gnue/gnue-reports/src/GRReport.py:1.7       Fri May 25 01:18:35 2001
+++ gnue/gnue-reports/src/GRReport.py   Tue May 29 19:19:49 2001
@@ -64,45 +64,54 @@
   # Process the report and generate output per the report definition.
   # Destination must be a file handle (StringIO will work as well) 
   #
-  def process(self, dest, parameters={}, sortoption=None): 
+  def process(self, dest, userParameters={}, userSortOption=None, \
+      includeStructuralComments=0): 
  
+    import GRDataMapper
+
     # Connect to databases
     GDebug.printMesg(3,"Initializing DataSource Connections")
 
-    self._parameters  = self.getChildOfType('GRParameters') or \
+    parameters  = self.getChildOfType('GRParameters') or \
                             GRParameters.GRParameters(self)
-    self._sortoptions = self.getChildOfType('GRSortOptions') or \
+    sortoptions = self.getChildOfType('GRSortOptions') or \
                             GRSortOptions.GRSortOptions(self)
-    self._sources =     self.getChildOfType('GRSources')
-    self._layout =      self.getChildOfType('GRLayout')
+    sources =     self.getChildOfType('GRSources')
+    layout =      self.getChildOfType('GRLayout')
+
+
     #
-    # We need to create exceptions if _sources or _parameters is None
+    # Raise exceptions if _sources or _parameters is None
     #
-    if self._sources == None: 
+    if sources == None: 
       raise NoSourcesSection, "No <sources> section has been defined."
 
-    if self._layout == None: 
+    if layout == None: 
       raise NoLayoutSection, "No <layout> section has been defined."
 
 
     # Load the user-specified parameters
-    self._parameters.setUserParameters(parameters)
+    parameters.setUserParameters(userParameters)
 
     # .. and the sort option
-    self._sortoptions.setSortOption(sortoption)
+    sortoptions.setSortOption(userSortOption)
 
     # Prepare data sources for active duty
-    self._sources.prepare()
+    sources.prepare()
+
+    # .. and the layout sections
+    mapper = GRDataMapper.GRDataMapper(sources)
+    layout.prepare(mapper)
 
     # Write common header information
     dest.write ('<?xml version="1.0"?>\n')
     dest.write ("<GNUe-report-output>\n") 
     dest.write ("  <GNUe-report-request>\n")
-    dest.write (self._parameters.getRunOptionsAsXML())
-    dest.write (self._sortoptions.getRunOptionsAsXML()) 
+    dest.write ( parameters.getRunOptionsAsXML() )
+    dest.write ( sortoptions.getRunOptionsAsXML() ) 
     dest.write ("  </GNUe-report-request>\n")
 
-    
+    layout.process(dest, includeStructuralComments)
 
     dest.write ("</GNUe-report-output>\n") 
 
Index: gnue/gnue-reports/src/GRSources.py
diff -u gnue/gnue-reports/src/GRSources.py:1.2 
gnue/gnue-reports/src/GRSources.py:1.3
--- gnue/gnue-reports/src/GRSources.py:1.2      Fri May 25 01:18:35 2001
+++ gnue/gnue-reports/src/GRSources.py  Tue May 29 19:19:49 2001
@@ -16,7 +16,7 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place 
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000 Free Software Foundation
+# Copyright 2000, 2001 Free Software Foundation
 #
 # FILE:
 # GRSources.py
@@ -42,8 +42,7 @@
 
   #
   # Prepare for running
-  #
- 
+  # 
   def prepare(self): 
 
     # Connect to databases    
@@ -66,18 +65,29 @@
       GDebug.printMesg(3,"Linking detail '%s' to master '%s'" \
                          % (object.name, object.master) )
       if self._datasourceDictionary.has_key(object.master): 
-        pass 
+        self._datasourceDictionary[object.master] \
+            .getDataObject().addDetailDataObject(object.getDataObject(), 
+                                                 object)
       else: 
         raise GRExceptions.MasterSourceNotFound, \
            "Detail source '%s' references non-existant master '%s'" \
                          % (object.name, object.master)
 
+  def getDataSource(self, source): 
+    return self._datasourceDictionary[source]
+
 
 class GRDataSource (GDataSource): 
   def __init__(self, parent):
     GDataSource.__init__(self, parent, 'GRDataSource')
     self.master = None
-
 
+  #  Used in GRSources.__connectMasterDetail to link detail datasource to 
+  #  master source.  Called by GDataObjects.ResultSet when master changed
+  #  This will actually be over-written by GRDataMapper but at the time 
+  #  the master-detail must be linked, the GRDataMapper will not have been 
+  #  created yet.  [Yes, it's fugly]
+  def masterResultSetChanged(self, masterResultSet, detailResultSet): 
+    pass
 
 
Index: gnue/gnue-reports/src/grrun
diff -u gnue/gnue-reports/src/grrun:1.3 gnue/gnue-reports/src/grrun:1.4
--- gnue/gnue-reports/src/grrun:1.3     Wed May 23 15:54:42 2001
+++ gnue/gnue-reports/src/grrun Tue May 29 19:19:49 2001
@@ -47,14 +47,17 @@
   COMMAND_OPTIONS = [ 
       [ 'destination_type', 'O', 'destination-type', 1, 'printer', 'type',  
           'This specifies how the report should be output. The currently ' + \
-          'supported values for <type> are printer [default], file, and 
email.' ],
+          'supported values for <type> are printer [default], file, and email. 
'+\
+          '[NOT YET IMPLEMENTED]' ],
       [ 'destination', 'o', 'destination', 1, 'lp', 'dest', 
           'Where should the report be output to?  The value of this ' \
           'depends on the destination type (e.g., if sending to printer, ' + \
           'then -o specifies the printer name; if sending via email, then ' + \
-          '-o specifies the email address.)'], 
+          '-o specifies the email address.) [NOT YET IMPLEMENTED]'], 
       [ 'sortoption', 'S', 'sort-option', 1, '', 'sort',  
           'Select the "sort-option" used to sort the report. '], 
+      [ 'comment', 'C', 'comment', 0, 0, None,  
+          'Include structural comments in the XML output stream. Useful for 
debugging .grd files.'], 
       [ 'user', 'u', 'user', 1, '', 'name',  
           'Username used to log into the database.  Note that if ' + \
           'specified, this will be used for all databases.  If not ' + \
@@ -80,7 +83,7 @@
       if len(self.OPTIONS['user']):
         lh.defaults['_username'] = self.OPTIONS['user']
       if len(self.OPTIONS['password']):
-        lh.defaults['_username'] = self.OPTIONS['password']
+        lh.defaults['_password'] = self.OPTIONS['password']
     except: 
       pass
 
@@ -123,10 +126,13 @@
 
 
     GREngine(self.getConnectionManager()).processReport(reportfile, \
-        parameters=userParameters, sortoption=sortoption)
+        parameters=userParameters, sortoption=sortoption, \
+        includeStructuralComments=self.OPTIONS["comment"])
 
 
-# This is a temporary solution to getting a login
+#
+# This is a (temporary?) solution to getting a login
+#
 from gnue.common import GLoginHandler
 import getpass
 class LoginHandler(GLoginHandler.LoginHandler): 
@@ -146,10 +152,10 @@
          if self.defaults.has_key(prompt[0])  and self.defaults[prompt[0]]: 
            print "  %s: " % prompt[1], 
            if prompt[2]: 
-             print "*****"
+             print "***"
            else:
              print self.defaults[prompt[0]]
-             val[prompt[0]] = self.defaults[prompt[0]]
+           val[prompt[0]] = self.defaults[prompt[0]]
          else: 
            if prompt[2]: 
              val[prompt[0]] = getpass.getpass("  %s: " % prompt[1])



reply via email to

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