commit-gnue
[Top][All Lists]
Advanced

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

r5084 - in trunk/gnue-common/src/datasources/drivers/special: . static


From: jan
Subject: r5084 - in trunk/gnue-common/src/datasources/drivers/special: . static
Date: Mon, 9 Feb 2004 14:11:46 -0600 (CST)

Author: jan
Date: 2004-02-09 14:11:45 -0600 (Mon, 09 Feb 2004)
New Revision: 5084

Added:
   trunk/gnue-common/src/datasources/drivers/special/static/Connection.py
   trunk/gnue-common/src/datasources/drivers/special/static/DataObject.py
   trunk/gnue-common/src/datasources/drivers/special/static/RecordSet.py
   trunk/gnue-common/src/datasources/drivers/special/static/ResultSet.py
Removed:
   trunk/gnue-common/src/datasources/drivers/special/static/Driver.py
Modified:
   trunk/gnue-common/src/datasources/drivers/special/__init__.py
   trunk/gnue-common/src/datasources/drivers/special/static/__init__.py
Log:
update static driver to new DB-API


Modified: trunk/gnue-common/src/datasources/drivers/special/__init__.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/special/__init__.py       
2004-02-09 19:48:51 UTC (rev 5083)
+++ trunk/gnue-common/src/datasources/drivers/special/__init__.py       
2004-02-09 20:11:45 UTC (rev 5084)
@@ -1 +1 @@
-DRIVERS = ["configfile"]
+DRIVERS = ["configfile","static"]

Added: trunk/gnue-common/src/datasources/drivers/special/static/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/special/static/Connection.py      
2004-02-09 19:48:51 UTC (rev 5083)
+++ trunk/gnue-common/src/datasources/drivers/special/static/Connection.py      
2004-02-09 20:11:45 UTC (rev 5084)
@@ -0,0 +1,57 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# 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
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# FILE:
+# static/Connection.py
+#
+# DESCRIPTION:
+# Basic connection object for static datasources
+#
+# NOTES:
+#
+
+__all__ = ['Connection']
+
+from gnue.common.apps import GDebug, GConfig
+from gnue.common.datasources.GDataObjects import *
+from DataObject import *
+
+class Connection(Connection):
+
+  # TODO: do we have/need Introspection?
+  #defaultBehavior = Introspection
+  
+  supportedDataObjects = {
+    'object': STATIC_DataObject
+  }
+
+  # We don't do logins
+  def getLoginFields(self):
+    return ()
+
+  # We don't do connections (we are connectionless)
+  def connect(self, connectData={}):
+    # build field list
+    self._fieldReferences=string.split(self._staticSet.fields,",")
+
+    self._postConnect()
+
+
+

Added: trunk/gnue-common/src/datasources/drivers/special/static/DataObject.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/special/static/DataObject.py      
2004-02-09 19:48:51 UTC (rev 5083)
+++ trunk/gnue-common/src/datasources/drivers/special/static/DataObject.py      
2004-02-09 20:11:45 UTC (rev 5084)
@@ -0,0 +1,50 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it 
+# and/or modify it under the terms of the GNU General Public 
+# 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 
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public 
+# License along with program; see the file COPYING. If not, 
+# write to the Free Software Foundation, Inc., 59 Temple Place 
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2001-2004 Free Software Foundation
+#
+# FILE:
+# _static/DBdriver.py
+#
+# DESCRIPTION:
+# Virtual database driver for a connectionless, static set of data
+#
+# NOTES:
+# Used whenever a fixed set of data is needed
+#
+
+__all__ = ['STATIC_DataObject']
+
+from gnue.common.apps import GDebug
+from gnue.common.datasources.GDataObjects import DataObject
+from ResultSet import STATIC_ResultSet
+
+class STATIC_DataObject (DataObject): 
+
+  def _createResultSet(self, conditions={}, readOnly=0, masterRecordSet=None, 
sql=""):
+    return STATIC_ResultSet(self, masterRecordSet=masterRecordSet)
+
+  # We don't do commits
+  def commit(self):
+    pass
+
+  # And we don't do rollbacks
+  def rollback(self):
+    pass
+
+

Deleted: trunk/gnue-common/src/datasources/drivers/special/static/Driver.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/special/static/Driver.py  
2004-02-09 19:48:51 UTC (rev 5083)
+++ trunk/gnue-common/src/datasources/drivers/special/static/Driver.py  
2004-02-09 20:11:45 UTC (rev 5084)
@@ -1,159 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# 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 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public 
-# License along with program; see the file COPYING. If not, 
-# write to the Free Software Foundation, Inc., 59 Temple Place 
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2001-2004 Free Software Foundation
-#
-# FILE:
-# _static/DBdriver.py
-#
-# DESCRIPTION:
-# Virtual database driver for a connectionless, static set of data
-#
-# NOTES:
-# Used whenever a fixed set of data is needed
-#
-
-from gnue.common.apps import GDebug
-import string
-from gnue.common.datasources.GDataObjects import *
-
-
-###########################################################
-#
-# This is an static data driver for connectionless clients
-# 
-###########################################################
-class STATIC_DataObject (DataObject): 
-
-  def _createResultSet(self, conditions={}, readOnly=0, masterRecordSet=None, 
sql=""):
-    return STATIC_ResultSet(self, masterRecordSet=masterRecordSet)
-
-  # We don't do logins
-  def getLoginFields(self):
-    return ()
-
-  # We don't do connections (we are connectionless)
-  def connect(self, connectData={}):
-    # build field list
-    self._fieldReferences=string.split(self._staticSet.fields,",")
-
-    self._postConnect()
-
-  # We don't do commits
-  def commit(self):
-    pass
-
-  # And we don't do rollbacks
-  def rollback(self):
-    pass
-
-
-
-###########################################################
-#
-#
-#
-###########################################################
-class STATIC_ResultSet(ResultSet):
-
-  def __init__(self, dataObject, cursor=None, defaultValues={}, 
masterRecordSet=None):
-    ResultSet.__init__(self, dataObject, \
-            cursor, defaultValues, masterRecordSet)
-    
-    self._recordSetClass = STATIC_RecordSet
-
-  # Returns 1=DataObject has uncommitted changes
-  def isPending(self):
-    return 0    # Static DataObjects cannot have pending changes :)
-
-  # Post changes to the database
-  def post(self):
-    # Leave this here in case (for some bizarro reason)
-    # a bound dataobject uses us as a master
-    for record in (self._cachedRecords):
-      record.post()
-
-  # Load cacheCount number of new records
-  def _loadNextRecord(self):
-    if hasattr(self,"_alldataloaded"):
-      return 0
-    
-    # Load static data
-    for row in self._dataObject._staticSet._children:
-      dict = {}
-      for field in row._children:
-        dict[field.name] = field.value
-
-      record=self._recordSetClass(parent=self,initialData=dict)
-      
-      self._cachedRecords.append (record)
-      
-      self._recordCount=self._recordCount+1
-
-    self._alldataloaded = 1
-      
-    return 1
-
-
-  # Create an empty record
-  def _createEmptyRecord(self, masterRecordSet=None): 
-    return self._recordSetClass(self, None)
-
-
-###########################################################
-# 
-#
-# 
-###########################################################
-class STATIC_RecordSet (RecordSet): 
-
-  def isPending(self):
-    return 0
-
-  # Post any changes to database
-  def _postChanges(self): 
-    return 1
-
-  
-
-
-
-#
-#  Extensions to Trigger Namespaces
-#  
-class TriggerExtensions: 
-  def __init__(self, connection): 
-    self.__connection = connection
-
-
-
-######################################
-#
-#  The following hashes describe
-#  this driver's characteristings.
-#
-######################################
-
-#
-#  All datasouce "types" and corresponding DataObject class
-#
-supportedDataObjects = {
-  'object': STATIC_DataObject
-}
-
-

Added: trunk/gnue-common/src/datasources/drivers/special/static/RecordSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/special/static/RecordSet.py       
2004-02-09 19:48:51 UTC (rev 5083)
+++ trunk/gnue-common/src/datasources/drivers/special/static/RecordSet.py       
2004-02-09 20:11:45 UTC (rev 5084)
@@ -0,0 +1,49 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it 
+# and/or modify it under the terms of the GNU General Public 
+# 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 
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public 
+# License along with program; see the file COPYING. If not, 
+# write to the Free Software Foundation, Inc., 59 Temple Place 
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2001-2004 Free Software Foundation
+#
+# FILE:
+# _static/DBdriver.py
+#
+# DESCRIPTION:
+# Virtual database driver for a connectionless, static set of data
+#
+# NOTES:
+# Used whenever a fixed set of data is needed
+#
+
+__all__ = ['STATIC_RecordSet']
+
+from gnue.common.apps import GDebug
+import string
+from gnue.common.datasources.GDataObjects import *
+
+
+class STATIC_RecordSet (RecordSet): 
+
+  def isPending(self):
+    return 0
+
+  # Post any changes to database
+  def _postChanges(self): 
+    return 1
+
+  
+
+

Added: trunk/gnue-common/src/datasources/drivers/special/static/ResultSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/special/static/ResultSet.py       
2004-02-09 19:48:51 UTC (rev 5083)
+++ trunk/gnue-common/src/datasources/drivers/special/static/ResultSet.py       
2004-02-09 20:11:45 UTC (rev 5084)
@@ -0,0 +1,82 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it 
+# and/or modify it under the terms of the GNU General Public 
+# 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 
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public 
+# License along with program; see the file COPYING. If not, 
+# write to the Free Software Foundation, Inc., 59 Temple Place 
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2001-2004 Free Software Foundation
+#
+# FILE:
+# _static/ResultSet.py
+#
+# DESCRIPTION:
+# Virtual database driver for a connectionless, static set of data
+#
+# NOTES:
+# Used whenever a fixed set of data is needed
+#
+
+__all__ = ["STATIC_ResultSet"]
+
+from gnue.common.apps import GDebug
+from gnue.common.datasources.GDataObjects import *
+from RecordSet import STATIC_RecordSet
+
+class STATIC_ResultSet(ResultSet):
+
+  def __init__(self, dataObject, cursor=None, defaultValues={}, 
masterRecordSet=None):
+    ResultSet.__init__(self, dataObject, \
+            cursor, defaultValues, masterRecordSet)
+    
+    self._recordSetClass = STATIC_RecordSet
+
+  # Returns 1=DataObject has uncommitted changes
+  def isPending(self):
+    return 0    # Static DataObjects cannot have pending changes :)
+
+  # Post changes to the database
+  def post(self):
+    # Leave this here in case (for some bizarro reason)
+    # a bound dataobject uses us as a master
+    for record in (self._cachedRecords):
+      record.post()
+
+  # Load cacheCount number of new records
+  def _loadNextRecord(self):
+    if hasattr(self,"_alldataloaded"):
+      return 0
+    
+    # Load static data
+    for row in self._dataObject._staticSet._children:
+      dict = {}
+      for field in row._children:
+        dict[field.name] = field.value
+
+      record=self._recordSetClass(parent=self,initialData=dict)
+      
+      self._cachedRecords.append (record)
+      
+      self._recordCount=self._recordCount+1
+
+    self._alldataloaded = 1
+      
+    return 1
+
+
+  # Create an empty record
+  def _createEmptyRecord(self, masterRecordSet=None): 
+    return self._recordSetClass(self, None)
+
+

Modified: trunk/gnue-common/src/datasources/drivers/special/static/__init__.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/special/static/__init__.py        
2004-02-09 19:48:51 UTC (rev 5083)
+++ trunk/gnue-common/src/datasources/drivers/special/static/__init__.py        
2004-02-09 20:11:45 UTC (rev 5084)
@@ -1,4 +1,4 @@
-from Driver import *
+from Connection import Connection
 
 __description__ = _("Static Special Data Driver")
 __driverurl__ = "n/a"





reply via email to

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