[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue gnue-common/src/GDataSource.py gnuef/src/G...
From: |
Jason Cater |
Subject: |
gnue gnue-common/src/GDataSource.py gnuef/src/G... |
Date: |
Wed, 19 Sep 2001 01:27:44 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 01/09/19 01:27:44
Modified files:
gnue-common/src: GDataSource.py
gnuef/src : GFForm.py GFInstance.py
gnuef/src/GFObjects: GFDataSource.py GFEntry.py
Log message:
changes to make datasources case-insensitive; misc other changes
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GDataSource.py.diff?cvsroot=OldCVS&tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFForm.py.diff?cvsroot=OldCVS&tr1=1.119&tr2=1.120&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFInstance.py.diff?cvsroot=OldCVS&tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFObjects/GFDataSource.py.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFObjects/GFEntry.py.diff?cvsroot=OldCVS&tr1=1.17&tr2=1.18&r1=text&r2=text
Patches:
Index: gnue/gnue-common/src/GDataSource.py
diff -u gnue/gnue-common/src/GDataSource.py:1.16
gnue/gnue-common/src/GDataSource.py:1.17
--- gnue/gnue-common/src/GDataSource.py:1.16 Wed Sep 19 01:11:15 2001
+++ gnue/gnue-common/src/GDataSource.py Wed Sep 19 01:27:44 2001
@@ -31,52 +31,53 @@
import GDebug
import GDataObjects
-import GObjects
-import sys
+import GObjects
+import sys, string
import GConnections
import GTypecast
########################################################################
#
-# Class that handles DataSources. This is a subclass of GObj, which
-# means this class can be created from XML markup and stored in an
-# Object tree (e.g., a Forms tree).
+# Class that handles DataSources. This is a subclass of GObj, which
+# means this class can be created from XML markup and stored in an
+# Object tree (e.g., a Forms tree).
#
########################################################################
-class GDataSource(GObjects.GObj):
+class GDataSource(GObjects.GObj):
- def __init__(self, parent=None, type="GDataSource"):
- GObjects.GObj.__init__(self, parent, type)
+ def __init__(self, parent=None, type="GDataSource"):
+ GObjects.GObj.__init__(self, parent, type)
self.type = ""
self.database = None
self._connectionManager = None
self._dataObject = None
- self._connectionComment = ""
+ self._connectionComment = ""
self._fieldReferences = {}
self._unboundFieldReferences = {}
self._defaultValues = {}
#
- # This method should be called after the object is created
+ # This method should be called after the object is created
# but before any other methods are called
#
- def setConnectionManager(self, connectionManager):
+ def setConnectionManager(self, connectionManager):
self._connectionManager = connectionManager
- def initialize(self):
+ def initialize(self):
- if not self.database:
+ if not self.database:
# We are a connectionless datasource (virtual?)
# We have to bind to something, so bind to empty driver
from gnue.common.dbdrivers._empty import DBdriver
GDebug.printMesg (7, 'Using empty data driver')
- self._dataObject = DBdriver.supportedDataObjects['object']()
+ self._dataObject = DBdriver.supportedDataObjects['object']()
- elif self._connectionManager:
- # This will throw a GConnections.NotFoundError if an unknown
- # connection name is specified. The calling method should
+ elif self._connectionManager:
+ self.database = string.lower(self.database)
+ # This will throw a GConnections.NotFoundError if an unknown
+ # connection name is specified. The calling method should
# catch this exception and handle it properly (exit w/message)
self._dataObject = \
self._connectionManager.getDataObject(self.database, self.type)
@@ -85,18 +86,18 @@
self._dataObject._unboundFieldReferences = self._unboundFieldReferences
self._dataObject._defaultValues = self._defaultValues
- # Copy all attributes from XML to the dataObject
- for attribute in tagAttributes.keys():
- if hasattr(self, attribute):
+ # Copy all attributes from XML to the dataObject
+ for attribute in tagAttributes.keys():
+ if hasattr(self, attribute):
self._dataObject.__dict__[attribute] = self.__dict__[attribute]
-
- def connect(self):
- if self.database != None:
+
+ def connect(self):
+ if self.database != None:
self._connectionManager.\
requestConnection(self._dataObject, self.database)
- def getDataObject(self):
+ def getDataObject(self):
return self._dataObject
def referenceField(self, field, defaultValue=None):
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.119 gnue/gnuef/src/GFForm.py:1.120
--- gnue/gnuef/src/GFForm.py:1.119 Sun Sep 16 17:16:24 2001
+++ gnue/gnuef/src/GFForm.py Wed Sep 19 01:27:44 2001
@@ -33,12 +33,12 @@
import traceback
from gnue.common import GDebug, openResource
-from gnue.common import GConfig
+from gnue.common import GConfig
from GFObjects import *
from GFEvent import *
from GFError import DBError
from GFTriggerError import *
-from GFLibrary import *
+from GFLibrary import *
import GFLibrary
import GFParser
import GFTrigger
@@ -80,24 +80,24 @@
# Convert some deprecated options to new style
i = 0
- while i < len(self._children):
- if isinstance(self._children[i], GFOptions):
+ while i < len(self._children):
+ if isinstance(self._children[i], GFOptions):
j = 0
- while j < len(self._children[i]._children):
+ while j < len(self._children[i]._children):
if self._children[i]._children[j].name in \
- ('title','width','height'):
+ ('title','width','height'):
self.__dict__[self._children[i]._children[j].name] = \
self._children[i]._children[j].value
self._children[i]._children.pop(j)
else:
j = j + 1
- if not len (self._children[i]._children):
+ if not len (self._children[i]._children):
self._children.pop(i)
- else:
+ else:
i = i + 1
else:
i = i + 1
-
+
#
# primaryInit
#
@@ -105,15 +105,15 @@
#
def primaryInit(self):
# TODO: Look at moving this into GParser
- # Import all needed objects
- self.walk(self.initImportedObjects)
+ # Import all needed objects
+ self.walk(self.initImportedObjects)
# analyze the tree
self.walk(self.analyzeTree)
-
+
def secondaryInit(self):
# create the first records
- for key in self._datasourceDictionary.keys():
+ for key in self._datasourceDictionary.keys():
if not self._datasourceDictionary[key].hasMaster():
self._datasourceDictionary[key].createEmptyResultSet()
@@ -128,7 +128,7 @@
# analyzeTree
#
# Scans the tree form tree and performs the following
- #
+ #
# builds the various entity lists
# it also sets the initial focus of the form
# constructs the trigger namespace
@@ -150,12 +150,14 @@
elif object.getObjectType() == 'GFEntry' and self._currentEntry == None
and not object.hidden:
self._currentEntry = object
-
+
elif object.getObjectType() =='GFDataSource':
- self._datasourceDictionary[object.name]=object
try:
self._triggerns[object.name] = GFTrigger.GFTriggerHelper( object )
except AttributeError: pass
+
+ object.name = string.lower(object.name)
+ self._datasourceDictionary[object.name]=object
def setFocus(self,object):
if object.getObjectType() == 'GFBlock' and self._currentBlock == None:
Index: gnue/gnuef/src/GFInstance.py
diff -u gnue/gnuef/src/GFInstance.py:1.22 gnue/gnuef/src/GFInstance.py:1.23
--- gnue/gnuef/src/GFInstance.py:1.22 Thu Aug 30 14:48:47 2001
+++ gnue/gnuef/src/GFInstance.py Wed Sep 19 01:27:44 2001
@@ -31,12 +31,6 @@
# make the next/prec methods more generic in the GFForm
# change self._form in here to a list
-#
-# Copyright (c) 2000 Free Software Foundation
-#
-# $Id: GFInstance.py,v 1.22 2001/08/30 18:48:47 jamest Exp $
-#
-
import pstats
import os
import os.path
@@ -44,7 +38,7 @@
import urllib
import gnue.common.GConfig
from gnue.forms.GFForm import *
-from gnue.forms.GFParser import loadForm
+from gnue.forms.GFParser import loadForm
from gnue.forms import VERSION
from gnue.common import GDebug, GDataObjects
@@ -378,7 +372,7 @@
elif self._form._currentBlock._resultSet.current.isPending():
status = 'modified'
else:
- status = 'saved'
+ status = 'saved'
self.dispatchEvent(GFEvent('uiUPDATESTATUS',[None,status,None,None,None,None,None]))
@@ -459,7 +453,7 @@
return
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
self.updateStatus()
-
+
def executeCommit(self, event):
message = self._form.commit()
if message:
@@ -477,13 +471,13 @@
messageBox.show()
self.updateRecordStatus()
self.updateRecordCounter()
-
+
def replaceValue(self,event):
replacement = ""
object = event.data[0]
value = event.data[1]
self._form.replaceValue(object,value)
-
+
# Hack!
self.dispatchEvent(GFEvent('updateDETAILBLOCK',self._form._currentBlock))
@@ -510,7 +504,7 @@
ui.buildForm(self._form)
ui.activateForm(self._form)
-
+
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
self.updateStatus()
self._ui = ui
Index: gnue/gnuef/src/GFObjects/GFDataSource.py
diff -u gnue/gnuef/src/GFObjects/GFDataSource.py:1.7
gnue/gnuef/src/GFObjects/GFDataSource.py:1.8
--- gnue/gnuef/src/GFObjects/GFDataSource.py:1.7 Thu Sep 13 22:38:27 2001
+++ gnue/gnuef/src/GFObjects/GFDataSource.py Wed Sep 19 01:27:44 2001
@@ -6,8 +6,8 @@
# 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
+# 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.
#
@@ -64,6 +64,7 @@
def secondaryInit(self):
if hasattr(self, 'master') and self.master:
+ self.master = string.lower(self.master)
GDebug.printMesg(3,"Linking detail '%s' to master '%s'" \
% (self.name, self.master) )
@@ -76,17 +77,17 @@
"Detail source '%s' references non-existant master '%s'" \
% (self.name, self.master)
- def createResultSet(self, conditions={}):
+ def createResultSet(self, conditions={}):
resultSet = GDataSource.createResultSet(self, conditions=conditions)
self.__setResultSet( resultSet )
return resultSet
- def createEmptyResultSet(self):
+ def createEmptyResultSet(self):
resultSet = GDataSource.createEmptyResultSet(self)
self.__setResultSet( resultSet )
return resultSet
- def __setResultSet(self, resultSet):
+ def __setResultSet(self, resultSet):
self._currentResultSet = resultSet
# Notify all the listeners (i.e., blocks) that the result set changed
for listener in self._resultSetListeners:
Index: gnue/gnuef/src/GFObjects/GFEntry.py
diff -u gnue/gnuef/src/GFObjects/GFEntry.py:1.17
gnue/gnuef/src/GFObjects/GFEntry.py:1.18
--- gnue/gnuef/src/GFObjects/GFEntry.py:1.17 Wed Sep 19 01:11:15 2001
+++ gnue/gnuef/src/GFObjects/GFEntry.py Wed Sep 19 01:27:44 2001
@@ -113,7 +113,8 @@
if hasattr(self,'foreign_key'):
datasourceName,self.fieldName = string.split(self.foreign_key,'.')
- self.datasource = self._block._form._datasourceDictionary[datasourceName]
+ self.datasource = \
+ self._block._form._datasourceDictionary[string.lower(datasourceName)]
def isQueryable(self):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue gnue-common/src/GDataSource.py gnuef/src/G...,
Jason Cater <=