commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef/src GFParser.py GFTrigger.py


From: Jason Cater
Subject: gnue/gnuef/src GFParser.py GFTrigger.py
Date: Wed, 04 Jul 2001 17:23:55 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/07/04 17:23:55

Modified files:
        gnuef/src      : GFParser.py GFTrigger.py 

Log message:
        Added GTypecasts to gnue.common for typecasting xml data

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFParser.py.diff?cvsroot=OldCVS&tr1=1.45&tr2=1.46&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFTrigger.py.diff?cvsroot=OldCVS&tr1=1.38&tr2=1.39&r1=text&r2=text

Patches:
Index: gnue/gnuef/src/GFParser.py
diff -u gnue/gnuef/src/GFParser.py:1.45 gnue/gnuef/src/GFParser.py:1.46
--- gnue/gnuef/src/GFParser.py:1.45     Tue Jul  3 18:42:45 2001
+++ gnue/gnuef/src/GFParser.py  Wed Jul  4 17:23:55 2001
@@ -29,9 +29,10 @@
 # HISTORY:
 #
 
-from gnue.common.GParser import *
 from gnue.common import GDataSource, GParser
 import copy, types
+#from gnue.common.GTypecast import * 
+from gnue.common import GTypecast
 
 
 
@@ -85,395 +86,416 @@
 
     xmlElements = { 
       'form': { 
-         'BaseClass':    GFForm.GFForm,
+         'BaseClass': GFForm.GFForm,
          'Required': 1,
          'SingleInstance': 1, 
          'Attributes': { 
             'title': {
-               'Typecast': char, 
+               'Typecast': GTypecast.text, 
                'Default': 'Untitled Form' },
             'readonly': {
-               'Typecast': bool, 
-               'Default':  0 },
+               'Typecast': GTypecast.boolean,
+               'Default': 0 },
             'tabbed': {
-               'Typecast': char, 
+               'Typecast': GTypecast.name, 
                'ValueSet': { 
                   'left': {}, 
                   'right': {}, 
                   'bottom': {}, 
                   'top': {} }, 
-               'Default':  "" }, 
+               'Default': "" }, 
             'width': {
-               'Typecast': int, 
+               'Typecast': GTypecast.whole, 
                'Default': 40 },
             'height': {
-               'Typecast': int, 
+               'Typecast': GTypecast.whole, 
                'Default': 12 } },
-         'ParentTags':  None },
+         'ParentTags': None },
 
       'import': { 
-         'BaseClass':    GFLibrary.GFImport,
+         'BaseClass': GFLibrary.GFImport,
          'Attributes': { 
             'library': {
                'Required': 1, 
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'datasources': {
-               'Typecast': char, 
-               'Default':  "" }, 
+               'Typecast': GTypecast.name, 
+               'Default': "" }, 
             'pages': {
-               'Typecast': char, 
-               'Default':  ""  }, 
+               'Typecast': GTypecast.name, 
+               'Default': ""  }, 
             'triggers': {
-               'Typecast': char, 
-               'Default':  "" } }, 
-         'ParentTags':  ('form',) },
+               'Typecast': GTypecast.name, 
+               'Default': "" } }, 
+         'ParentTags': ('form',) },
 
       'database': { 
-         'BaseClass':    GFObjects.GFDatabase,   
+         'BaseClass': GFObjects.GFDatabase,   
          'Attributes': { 
             'name': {
                'Required': 1, 
-               'Unique':   1, 
-               'Typecast': char }, 
+               'Unique': 1, 
+               'Typecast': GTypecast.name }, 
             'provider': {
                'Required': 1, 
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'dbname': {
                'Required': 1, 
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'host': {
                'Required': 1, 
-               'Typecast': char } }, 
+               'Typecast': GTypecast.text } }, 
          'Deprecated': 1, 
-         'ParentTags':  ('form',) },
+         'ParentTags': ('form',) },
 
       'datasource': { 
-         'BaseClass':    GFObjects.GFDataSource,  
-         'Attributes':   GDataSource.tagAttributes, 
-         'ParentTags':  ('form',) },
+         'BaseClass': GFObjects.GFDataSource,  
+         'Attributes': GDataSource.tagAttributes, 
+         'ParentTags': ('form',) },
 
       'page': { 
-         'BaseClass':    GFObjects.GFPage,
+         'BaseClass': GFObjects.GFPage,
          'Required': 1,
          'Attributes': { 
             'name': {
-               'Unique':   1, 
-               'Typecast': char } }, 
-         'ParentTags':  ('form',) },
+               'Unique': 1, 
+               'Typecast': GTypecast.name } }, 
+         'ParentTags': ('form',) },
 
       'block': { 
-         'BaseClass':    GFObjects.GFBlock,      
+         'BaseClass': GFObjects.GFBlock,      
          'Attributes': { 
             'name': {
                'Required': 1, 
-               'Unique':   1, 
-               'Typecast': char }, 
+               'Unique': 1, 
+               'Typecast': GTypecast.name }, 
             'master': {
                'References': (('datasource','name'),), 
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'detail': {
                'References': (('datasource','name'),), 
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'rows': {
-               'Typecast': int,  
-               'Default':  1}, 
+               'Typecast': GTypecast.whole,  
+               'Default': 1}, 
             'rowSpacer': {
-               'Typecast': int },
+               'Typecast': GTypecast.whole },
             'transparentBlock':{
-               'Typecast': bool, 
-               'Default':  0 },
+               'Typecast': GTypecast.boolean, 
+               'Default': 0 },
             'datasource': {
                'References': (('datasource','name'),), 
-               'Typecast': char } }, 
-         'ParentTags':  ('page',) },
+               'Typecast': GTypecast.name } }, 
+         'ParentTags': ('page',) },
 
       'label': { 
-         'BaseClass':    GFObjects.GFLabel, 
+         'BaseClass': GFObjects.GFLabel, 
          'Attributes': { 
             'name': {
-               'Unique':   1, 
-               'Typecast': char }, 
+               'Unique': 1, 
+               'Typecast': GTypecast.name }, 
             'text': {
                'Required': 1, 
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'alignment': {
-               'Typecast': char, 
+               'Typecast': GTypecast.name, 
                'ValueSet': { 
                   'left': {}, 
                   'right': {}, 
                   'center': {} }, 
-               'Default':  "left"}, 
+               'Default': "left"}, 
             'width': {
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'x': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'y': {
                'Required': 1, 
-               'Typecast': int } }, 
-         'ParentTags':  ('block',) },
+               'Typecast': GTypecast.whole } }, 
+         'ParentTags': ('page','block',) },
 
       # If you implement a new entry "style", add to the entryStyles 
       # structure after this list
       'entry': { 
-         'BaseClass':    GFObjects.GFEntry,
+         'BaseClass': GFObjects.GFEntry,
          'Attributes': { 
             'name': {
                'Required': 1, 
-               'Unique':   1, 
-               'Typecast': char }, 
+               'Unique': 1, 
+               'Typecast': GTypecast.name }, 
             'field': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'height': {
-               'Typecast': int, 
+               'Typecast': GTypecast.whole, 
                'Default': 1 }, 
             'width': {
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'max_length': {
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'visibleCount':{
-               'Typecast': int, 
-               'Deprecatetd': 1, 
+               'Typecast': GTypecast.whole, 
+               'Deprecated': 1, 
                'Default': 1 }, 
             'readonly': {
-               'Typecast': bool, 
-               'Default':  0   }, 
+               'Typecast': GTypecast.boolean, 
+               'Default': 0   }, 
             'uppercase': {
-               'Typecast': bool, 
-               'Default':  0   }, 
+               'Typecast': GTypecast.boolean, 
+               'Default': 0   }, 
             'lowercase': {
-               'Typecast': bool, 
-               'Default':  0   }, 
+               'Typecast': GTypecast.boolean, 
+               'Default': 0   }, 
             'numeric': {
-               'Typecast': bool, 
-               'Default':  0   }, 
+               'Typecast': GTypecast.boolean, 
+               'Default': 0   }, 
             'hidden': {
-               'Typecast': bool, 
-               'Default':  0   }, 
+               'Typecast': GTypecast.boolean, 
+               'Default': 0   }, 
             'style': {
-               'Typecast': char, 
+               'Typecast': GTypecast.name, 
                'ValueSet': { 
                   'default': {}, 
                   'dropdown': {}, 
                   'checkbox': {} }, 
                'Default': 'default'}, 
             'value': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'foreign_key': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'default': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'queryDefault':{
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'foreign_key_description': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'sloppyQuery': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'x': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'y': {
                'Required': 1, 
-               'Typecast': int } }, 
-         'ParentTags':  ('block',) },
+               'Typecast': GTypecast.whole } }, 
+         'ParentTags': ('block',) },
 
       'scrollbar': { 
-         'BaseClass':    GFObjects.GFScrollBar,  
+         'BaseClass': GFObjects.GFScrollBar,  
          'Attributes': { 
             'width': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'height': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'x': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'y': {
                'Required': 1, 
-               'Typecast': int } }, 
-         'ParentTags':  ('block',) },
+               'Typecast': GTypecast.whole } }, 
+         'ParentTags': ('page','block',) },
 
       'box': { 
-         'BaseClass':    GFObjects.GFBox,
+         'BaseClass': GFObjects.GFBox,
          'Attributes': { 
             'name': {
-               'Unique':   1, 
-               'Typecast': char }, 
+               'Unique': 1, 
+               'Typecast': GTypecast.name }, 
             'label': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'width': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'height': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'x': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'y': {
                'Required': 1, 
-               'Typecast': int } }, 
-         'ParentTags':  ('block',) },
+               'Typecast': GTypecast.whole } }, 
+         'ParentTags': ('page','block',) },
 
       'button': { 
-         'BaseClass':    GFObjects.GFButton,     
+         'BaseClass': GFObjects.GFButton,     
          'Attributes': { 
             'name': {
-               'Unique':   1, 
-               'Typecast': char }, 
+               'Unique': 1, 
+               'Typecast': GTypecast.name }, 
             'trigger': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'label': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'width': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'height': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'x': {
                'Required': 1, 
-               'Typecast': int }, 
+               'Typecast': GTypecast.whole }, 
             'y': {
                'Required': 1, 
-               'Typecast': int } },  
-         'ParentTags':  ('block',) },
+               'Typecast': GTypecast.whole } },  
+         'ParentTags': ('page','block',) },
 
       'trigger': { 
-         'BaseClass':    GFTrigger.GFTrigger, 
+         'BaseClass': GFTrigger.GFTrigger, 
          'Attributes': { 
             'name': {
-               'Unique':   1, 
-               'Typecast': char }, 
+               'Unique': 1, 
+               'Typecast': GTypecast.name }, 
             'id': {
                'Deprecated': 1,   # DEPRECATED: Use name instead
-               'Typecast': char },
+               'Typecast': GTypecast.name },
             'type': {
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'src': {
                'References': (('trigger','name'),), 
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'language': {
-               'Typecast': char,
-               'Default':  'python' } }, 
+               'Typecast': GTypecast.name,
+               'ValueSet': { 
+                   'python': {} }, 
+               'Default': 'python' } }, 
          'MixedContent': 1, 
          'KeepWhitespace': 1, 
          'UsableBySiblings': 1, 
-         'ParentTags':  ('form',) },
+         'ParentTags': ('form',) },
 
       'options': { 
-         'BaseClass':    GFObjects.GFOptions,    
+         'BaseClass': GFObjects.GFOptions,    
          'SingleInstance': 1, 
          'UsableBySiblings': 1, 
-         'ParentTags':  ('form',) },
+         'ParentTags': ('form',) },
 
       'option': { 
-         'BaseClass':    GFObjects.GFOption,
+         'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
                'Required': 1, 
-               'Typecast': char },
+               'Typecast': GTypecast.name },
             'value': {
-               'Typecast': char } }, 
-         'MixedContent':   1, 
-         'ParentTags':  ('options',) },
+               'Typecast': GTypecast.text } }, 
+         'MixedContent': 1, 
+         'ParentTags': ('options',) },
 
       'title': { 
-         'BaseClass':    GFObjects.GFOption,
+         'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': char, 
-               'Default':  'title' },
+               'Typecast': GTypecast.name, 
+               'ValueSet': {
+                   'title': {} }, 
+               'Default': 'title' },
             'value': {
-               'Typecast': char } }, 
-         'MixedContent':   1, 
+               'Typecast': GTypecast.text } }, 
+         'MixedContent': 1, 
          'SingleInstance': 1, 
-         'ParentTags':  ('options',) },
+         'Deprecated': 1, 
+         'ParentTags': ('options',) },
 
       'name': { 
-         'BaseClass':    GFObjects.GFOption,
+         'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': char, 
-               'Default':  'name' },
+               'Typecast': GTypecast.name, 
+               'ValueSet': {
+                   'name': {} }, 
+               'Default': 'name' },
             'value': {
-               'Typecast': char } }, 
-         'MixedContent':   1, 
+               'Typecast': GTypecast.text } },
+         'MixedContent': 1, 
          'SingleInstance': 1, 
-         'ParentTags':  ('options',) },
+         'ParentTags': ('options',) },
 
       'height': { 
-         'BaseClass':    GFObjects.GFOption,
+         'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': char, 
-               'Default':  'height' },
+               'Typecast': GTypecast.name, 
+               'ValueSet': {
+                   'height': {} },
+               'Default': 'height' },
             'value': {
-               'Typecast': char } }, 
-         'MixedContent':   1, 
+               'Typecast': GTypecast.text } },
+         'MixedContent': 1, 
          'SingleInstance': 1, 
-         'ParentTags':  None },
+         'Deprecated': 1, 
+         'ParentTags': None },
 
       'width': { 
-         'BaseClass':    GFObjects.GFOption,
+         'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': char, 
-               'Default':  'width' },
+               'Typecast': GTypecast.name, 
+               'ValueSet': {
+                   'width': {} },
+               'Default': 'width' },
             'value': {
-               'Typecast': char } }, 
-         'MixedContent':   1, 
+               'Typecast': GTypecast.text } },
+         'MixedContent': 1, 
          'SingleInstance': 1, 
-         'ParentTags':  ('options',) },
+         'Deprecated': 1, 
+         'ParentTags': ('options',) },
 
       'author': { 
-         'BaseClass':    GFObjects.GFOption,
+         'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': char, 
-               'Default':  'author' },
+               'Typecast': GTypecast.name, 
+               'ValueSet': {
+                   'author': {} },
+               'Default': 'author' },
             'value': {
-               'Typecast': char } }, 
-         'MixedContent':   1, 
+               'Typecast': GTypecast.text } },
+         'MixedContent': 1, 
          'SingleInstance': 1, 
-         'ParentTags':  ('options',) },
+         'ParentTags': ('options',) },
 
       'description':{ 
-         'BaseClass':    GFObjects.GFOption,
+         'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': char, 
-               'Default':  'description' },
+               'Typecast': GTypecast.name, 
+               'ValueSet': {
+                   'description': {} },
+               'Default': 'description' }, 
             'value': {
-               'Typecast': char } }, 
-         'MixedContent':   1, 
+               'Typecast': GTypecast.text } },
+         'MixedContent': 1, 
          'SingleInstance': 1, 
-         'ParentTags':  ('options',) },
+         'ParentTags': ('options',) },
 
       'version': { 
-         'BaseClass':    GFObjects.GFOption,
+         'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': char, 
-               'Default':  'version' },
+               'Typecast': GTypecast.name, 
+               'ValueSet': {
+                   'version': {} },
+               'Default': 'version' },
             'value': {
-               'Typecast': char } }, 
-         'MixedContent':   1, 
+               'Typecast': GTypecast.text } },
+         'MixedContent': 1, 
          'SingleInstance': 1, 
-         'ParentTags':  ('options',) },
+         'ParentTags': ('options',) },
 
       'tip': { 
-         'BaseClass':    GFObjects.GFOption,
+         'BaseClass': GFObjects.GFOption,
          'Attributes': { 
             'name': {
-               'Typecast': char, 
-               'Default':  'tip' },
+               'Typecast': GTypecast.name, 
+               'ValueSet': {
+                   'tip': {} },
+               'Default': 'tip' },
             'value': {
-               'Typecast': char } }, 
-         'MixedContent':   1, 
+               'Typecast': GTypecast.text } },
+         'MixedContent': 1, 
          'SingleInstance': 1, 
-         'ParentTags':  ('options',) }, 
+         'ParentTags': ('options',) }, 
     }
     
       
@@ -495,7 +517,7 @@
       p['BaseClass'] = GFLibrary.GFImportItem
       p['Attributes']['library'] = { 
          'Required': 1, 
-         'Typecast': char }
+         'Typecast': GTypecast.name }
       p['MixedContent'] = 0
       p['Required'] = 0
     
@@ -511,9 +533,9 @@
 #
 # Different Types of Entries
 #
-entryStyles = {'text':       'Text Field', 
-               'dropdown':   'Drop Down Box', 
-               'checkbox':   'Check Box' }
+entryStyles = {'text': 'Text Field', 
+               'dropdown': 'Drop Down Box', 
+               'checkbox': 'Check Box' }
 
 #######################################################
 #
Index: gnue/gnuef/src/GFTrigger.py
diff -u gnue/gnuef/src/GFTrigger.py:1.38 gnue/gnuef/src/GFTrigger.py:1.39
--- gnue/gnuef/src/GFTrigger.py:1.38    Fri Jun 29 15:55:58 2001
+++ gnue/gnuef/src/GFTrigger.py Wed Jul  4 17:23:55 2001
@@ -205,9 +205,13 @@
         if val != None and \
            (not 
lookupDict[xmlEntity]['Attributes'][attribute].has_key('Default') or \
             (lookupDict[xmlEntity]['Attributes'][attribute]['Default']) != 
(val)): 
-          if lookupDict[xmlEntity]['Attributes'][attribute]['Typecast'] == 
bool \
+          typecast = lookupDict[xmlEntity]['Attributes'][attribute]['Typecast']
+          if typecast == GTypecast.boolean \
              and val == 1:
             xmlString = xmlString + ' %s=""' % (attribute)
+          elif typecast == GTypecast.names: 
+            xmlString = xmlString + ' %s="%s"' % \
+                (attribute, string.join(val,','))
           else: 
             xmlString = xmlString + ' %s="%s"' % (attribute, 
saxutils.escape('%s' % val))
         



reply via email to

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