commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnue-common/src GDataSource.py GObjects.py...


From: Jason Cater
Subject: gnue/gnue-common/src GDataSource.py GObjects.py...
Date: Wed, 04 Jul 2001 17:24:11 -0700

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

Modified files:
        gnue-common/src: GDataSource.py GObjects.py GParser.py 
        gnue-common/src/dbdrivers/postgresql: DBdriver.py 
Added files:
        gnue-common/src: GTypecast.py 

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

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GTypecast.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GDataSource.py.diff?cvsroot=OldCVS&tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GObjects.py.diff?cvsroot=OldCVS&tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GParser.py.diff?cvsroot=OldCVS&tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gnue/gnue-common/src/GDataSource.py
diff -u gnue/gnue-common/src/GDataSource.py:1.10 
gnue/gnue-common/src/GDataSource.py:1.11
--- gnue/gnue-common/src/GDataSource.py:1.10    Tue Jun 26 21:18:28 2001
+++ gnue/gnue-common/src/GDataSource.py Wed Jul  4 17:24:11 2001
@@ -34,6 +34,7 @@
 import GObjects 
 import sys
 import GConnections
+import GTypecast
 
 
 ########################################################################
@@ -105,27 +106,27 @@
             'name':        {
                'Required': 1, 
                'Unique':   1, 
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'type':        {
-               'Typecast': char, 
+               'Typecast': GTypecast.name, 
                'Default':  "object" }, 
             'database':    {
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'table':       {
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'cache':       {
-               'Typecast': int },
+               'Typecast': GTypecast.whole },
             'prequery':    {
                'Typecast': bool, 
                'Default':  0 },
             'order_by':    {
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'master':      {
-               'Typecast': char }, 
+               'Typecast': GTypecast.name }, 
             'masterlink':  {
-               'Typecast': char }, 
+               'Typecast': GTypecast.text }, 
             'detaillink':  {
-               'Typecast': char } }
+               'Typecast': GTypecast.text } }
 
 
 
Index: gnue/gnue-common/src/GObjects.py
diff -u gnue/gnue-common/src/GObjects.py:1.13 
gnue/gnue-common/src/GObjects.py:1.14
--- gnue/gnue-common/src/GObjects.py:1.13       Fri Jun 29 17:59:05 2001
+++ gnue/gnue-common/src/GObjects.py    Wed Jul  4 17:24:11 2001
@@ -149,9 +149,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))
         
Index: gnue/gnue-common/src/GParser.py
diff -u gnue/gnue-common/src/GParser.py:1.17 
gnue/gnue-common/src/GParser.py:1.18
--- gnue/gnue-common/src/GParser.py:1.17        Fri Jun 29 15:55:58 2001
+++ gnue/gnue-common/src/GParser.py     Wed Jul  4 17:24:11 2001
@@ -46,6 +46,7 @@
 import string
 import sys
 import GDebug
+import GTypecast
 
 
 #######################################################
@@ -114,10 +115,13 @@
 #
 # This is for typecasting strings
 #
+# NOTE: This is a redefinition of GTypecast.text.
+#   This redefinition will be removed as soon as all
+#   references to it are changes.  You should be using
+#   GTypecast from now on.
+#
 #######################################################
-def char (value): 
-  # Do we convert '&lt;',etc stuff here?
-  return str(value)
+char  = GTypecast.text
 
 
 #######################################################
@@ -126,18 +130,13 @@
 #
 # This is for typecasting booleans
 #
+# NOTE: This is a redefinition of GTypecast.boolean. 
+#   This redefinition will be removed as soon as all
+#   references to it are changes.  You should be using
+#   GTypecast from now on. 
+#
 #######################################################
-def bool (value): 
-  if value == 0 or value == 1: 
-    return value
-
-  rv = string.lower(string.strip(value))
-  if len(rv): 
-    return not (rv[0] == 'n' or rv[0] == 'f' or rv == '0')
-  else: 
-    # This may seem counter-intuitive, but if attribute was present 
-    # without a specified value, then treat as true
-    return 1
+bool = GTypecast.boolean
 
 
 #######################################################
Index: gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py:1.7 
gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py:1.8
--- gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py:1.7   Sat Jun 30 
11:37:32 2001
+++ gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py       Wed Jul  4 
17:24:11 2001
@@ -29,7 +29,7 @@
 #
 
 
-import pg
+import pg, pgdb
 
 from string import lower
 import sys



reply via email to

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