commit-gnue
[Top][All Lists]
Advanced

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

gnue/reports/src GRParser.py


From: Jason Cater
Subject: gnue/reports/src GRParser.py
Date: Mon, 02 Jul 2001 10:03:19 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/07/02 10:03:19

Modified files:
        reports/src    : GRParser.py 

Log message:
        Updates GRParser to new GParser dictionary format

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/reports/src/GRParser.py.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: gnue/reports/src/GRParser.py
diff -u gnue/reports/src/GRParser.py:1.9 gnue/reports/src/GRParser.py:1.10
--- gnue/reports/src/GRParser.py:1.9    Wed Jun 20 15:33:38 2001
+++ gnue/reports/src/GRParser.py        Mon Jul  2 10:03:18 2001
@@ -36,7 +36,23 @@
 from GRSortOptions import *
 from GRLayout import *
 from gnue.common import GDataSource
+import copy, types
 
+
+
+
+
+
+########
+########  Please keep this file neat !!!
+########
+
+
+
+
+
+
+
 #######################################################
 # This method loads a report from an XML file and returns 
 # a GRReport object.  If initialize is 1 (default), then 
@@ -49,6 +65,162 @@
 
 
 
+xmlElements = None
+
+
+def getXMLelements(): 
+
+  global xmlElements
+
+  if xmlElements == None:
+
+    #
+    #
+    xmlElements = { 
+      'report':       {
+         'BaseClass': GRReport.GRReport, 
+         'Required': 1,
+         'SingleInstance': 1, 
+         'Attributes':  { 
+            'title':       {
+               'Typecast': char } } ,
+         'ParentTags':  None },
+
+      'parameters':   {
+         'BaseClass': GRParameters , 
+         'SingleInstance': 1, 
+         'ParentTags':  ('form',)}, 
+
+      'parameter':    {
+         'BaseClass': GRParameter, 
+         'Attributes': { 
+            'id':          {
+               'Required': 1, 
+               'Unique': 1, 
+               'Typecast': char },
+            'required':    {
+               'Typecast': bool, 
+               'Default': 0 },
+            'limited':     {
+               'Typecast': bool, 
+               'Default': 0 },
+            'default':     {
+               'Typecast': char },
+            'description': {
+               'Required': 1, 
+               'Typecast': char },
+            'source':      {
+               'Typecast': char }, 
+            'type':        {
+               'Typecast': char, 
+               'Default': "char" } }, 
+         'ParentTags':  ('parameters',) }, 
+
+      'sortoptions':  {
+         'BaseClass': GRSortOptions, 
+         'SingleInstance': 1, 
+         'ParentTags':  ('form',) }, 
+
+      'sortoption':   {
+         'BaseClass': GRSortOption,
+         'Attributes': { 
+            'id':          {
+               'Required': 1, 
+               'Unique': 1, 
+               'Typecast': char }, 
+            'description': {
+               'Required': 1, 
+               'Typecast': char },
+            'default':     {
+               'Typecast': bool, 
+               'Default': 0 } }, 
+         'ParentTags':  ('sortoptions',) },
+
+      'sortcolumn':   {
+         'BaseClass': GRSortColumn,
+         'Attributes': { 
+            'name':        {
+               'Required': 1, 
+               'Typecast': char } }, 
+         'ParentTags':  ('sortoption',) }, 
+
+      'layout':       {
+         'BaseClass': GRLayout,    
+         'Required': 1,
+         'SingleInstance': 1, 
+         'Attributes': { 
+            'format':      {
+               'Typecast': char } }, 
+         'ParentTags':  ('form',) }, 
+
+      'section':      {
+         'BaseClass': GRSection,   
+         'Required': 1,
+         'MixedContent': 1, 
+         'KeepWhitespace': 1, 
+         'Attributes': { 
+            'name':        {
+               'Typecast': char }, 
+            'source':      {
+               'Typecast': char } }, 
+         'ParentTags':  ('layout',) }, 
+
+      'default':      {
+         'BaseClass': GRDefault, 
+         'MixedContent': 1, 
+         'KeepWhitespace': 1, 
+         'ParentTags':  ('layout',) },
+
+      'field':        {
+         'BaseClass': GRField,     
+         'Attributes': { 
+            'name':        {
+               'Required': 1, 
+               'Typecast': char }, 
+            'source':      {
+               'Typecast': char }, 
+            'format':      {
+               'Typecast': char } }, 
+         'ParentTags':  ('layout',) }, 
+
+      'summ':         {
+         'BaseClass': GRField,     
+         'Attributes': { 
+            'name':        {
+               'Required': 1, 
+               'Typecast': char }, 
+            'function':    {
+               'Typecast': char, 
+               'Default': "count"}, 
+            'source':      {
+               'Typecast': char, 
+               'Default': None}, 
+            'section':     {
+               'Typecast': char }, 
+            'format':      {
+               'Typecast': char } }, 
+         'ParentTags':  ('layout',) }, 
+
+      'sources':      {
+         'BaseClass': GRSources, 
+         'SingleInstance': 1, 
+         'ParentTags':  ('form',) }, 
+
+      'datasource':   {
+         'BaseClass': GRDataSource,  
+         'Attributes': GDataSource.tagAttributes, 
+         'ParentTags':  ('sources',) } 
+    } 
+
+    #
+    # Add DataSource elements
+    #
+    xmlElements.update(GDataSource.xmlElements)
+
+
+  return xmlElements
+
+
 #######################################################
 #
 # xmlReportHandler
@@ -61,47 +233,5 @@
 class xmlReportHandler (xmlHandler): 
   def __init__(self): 
     xmlHandler.__init__(self) 
-
-    #
-    # xmlElements=
-    #   {tagName: (baseClass, attributesHash, normalizeWhitespace?)}
-    #      
-    # attributesHash=
-    #   {attrName: (required?, uniqueID?, typecast, defaultValue)}
-    #
-    self.xmlElements = { 
-      'report':       (GRReport.GRReport, { 'title':       (0, 0, char, 
None)}, 1), 
-      'parameters':   (GRParameters,{                                  }, 1), 
-      'parameter':    (GRParameter, { 'id':          (1, 1, char, None), 
-                                      'required':    (0, 0, bool, 0), 
-                                      'limited':     (0, 0, bool, 0), 
-                                      'default':     (0, 0, char, None), 
-                                      'description': (1, 0, char, None), 
-                                      'source':      (0, 0, char, None), 
-                                      'type':        (0, 0, char, "char")}, 1),
-      'sortoptions':  (GRSortOptions,{                                 }, 1), 
-      'sortoption':   (GRSortOption,{ 'id':          (1, 1, char, None), 
-                                      'description': (1, 0, char, None), 
-                                      'default':     (0, 0, bool, 0)   }, 1),
-      'sortcolumn':   (GRSortColumn,{ 'name':        (1, 0, char, None)}, 1), 
-      'layout':       (GRLayout,    { 'format':      (0, 0, char, None)}, 0), 
-      'section':      (GRSection,   { 'name':        (0, 0, char, None), 
-                                      'source':      (0, 0, char, None)}, 0), 
-      'default':      (GRDefault,   {                                  }, 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), 
-                                      '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), 
-    } 
-
-    #
-    # Add DataSource elements
-    #
-    self.xmlElements.update(GDataSource.xmlElements)
 
+    self.xmlElements = getXMLelements()



reply via email to

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