[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7398 - in trunk/gnue-common/src/datasources: . drivers/Base
From: |
reinhard |
Subject: |
[gnue] r7398 - in trunk/gnue-common/src/datasources: . drivers/Base |
Date: |
Mon, 18 Apr 2005 08:44:24 -0500 (CDT) |
Author: reinhard
Date: 2005-04-18 08:44:23 -0500 (Mon, 18 Apr 2005)
New Revision: 7398
Modified:
trunk/gnue-common/src/datasources/GDataSource.py
trunk/gnue-common/src/datasources/drivers/Base/DataObject.py
trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py
trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py
Log:
No weak references necessary any more.
Modified: trunk/gnue-common/src/datasources/GDataSource.py
===================================================================
--- trunk/gnue-common/src/datasources/GDataSource.py 2005-04-18 13:35:18 UTC
(rev 7397)
+++ trunk/gnue-common/src/datasources/GDataSource.py 2005-04-18 13:44:23 UTC
(rev 7398)
@@ -27,7 +27,6 @@
import cStringIO
import string
import types
-import weakref
from gnue.common.apps import errors
from gnue.common.definitions import GObjects, GParser, GParserHelpers
@@ -276,12 +275,12 @@
if not self.type=="static":
from gnue.common.datasources.drivers import Base
gDebug (7, 'Using empty data driver')
- dataObject = Base.DataObject (None, weakref.ref (self))
+ dataObject = Base.DataObject (None, self)
else:
from gnue.common.datasources.drivers.special import static
gDebug (7, 'Using static data driver')
- dataObject = static.DataObject (None, weakref.ref (self))
+ dataObject = static.DataObject (None, self)
for child in self._children:
if isinstance(child, GStaticSet):
@@ -296,7 +295,7 @@
# catch this exception and handle it properly (exit w/message)
dataObject = \
self._connections.getDataObject (self.connection, self.type,
- datasource = weakref.ref (self))
+ datasource = self)
gDebug (7, "GDataSource.py bound to %s " % dataObject)
# Check if the connection has a fixed primary key name
Modified: trunk/gnue-common/src/datasources/drivers/Base/DataObject.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/DataObject.py
2005-04-18 13:35:18 UTC (rev 7397)
+++ trunk/gnue-common/src/datasources/drivers/Base/DataObject.py
2005-04-18 13:44:23 UTC (rev 7398)
@@ -87,18 +87,18 @@
resultset = self.__createResultSet (readOnly, masterRecordSet)
- if (self.__dataSource ()).type == 'object':
+ if self.__dataSource.type == 'object':
resultset.query ('object',
table = self.table,
- fieldnames = (self.__dataSource
())._fieldReferences.keys (),
+ fieldnames = self.__dataSource._fieldReferences.keys (),
condition = cond,
sortorder = self.sorting and self.sorting or [],
distinct = self.distinct)
- elif (self.__dataSource ()).type == 'static':
+ elif self.__dataSource.type == 'static':
resultset.query ('static', data = self._staticSet.data)
- elif (self.__dataSource ()).type == 'sql':
+ elif self.__dataSource.type == 'sql':
resultset.query ('sql', sql = self._rawSQL.getChildrenAsContent ())
return resultset
@@ -113,12 +113,12 @@
return self._resultSetClass (
dataObject = self,
- defaultData = (self.__dataSource ())._defaultData,
- connection = (self.__dataSource ())._connection,
- rowidField = (self.__dataSource ())._rowidField,
- primarykeyFields = (self.__dataSource ())._primarykeyFields,
- tablename = (self.__dataSource ()).table,
- boundFields = (self.__dataSource ())._fieldReferences.keys (),
+ defaultData = self.__dataSource._defaultData,
+ connection = self.__dataSource._connection,
+ rowidField = self.__dataSource._rowidField,
+ primarykeyFields = self.__dataSource._primarykeyFields,
+ tablename = self.__dataSource.table,
+ boundFields = self.__dataSource._fieldReferences.keys (),
readonly = readOnly,
masterRecord = masterRecord,
dataSource = self.__dataSource)
Modified: trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py 2005-04-18
13:35:18 UTC (rev 7397)
+++ trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py 2005-04-18
13:44:23 UTC (rev 7398)
@@ -75,8 +75,7 @@
masterLinkFields in this record.
@param masterLinkFields: Fields in this record matching the masterKeyFields
of the master record.
- @param dataSource: weak reference to a GDataSource instance to notify of
- data events.
+ @param dataSource: GDataSource instance to notify of data events.
"""
self.__connection = connection
@@ -88,7 +87,7 @@
self.__masterRecord = masterRecord
self.__masterKeyFields = masterKeyFields
self.__masterLinkFields = masterLinkFields
- self.__dataSource = dataSource # this is already a weakref!
+ self.__dataSource = dataSource
# Record status
# New records: 'empty' -(setField)-> 'inserted' -(delete)-> 'void'
@@ -118,8 +117,8 @@
for (field, value) in initialData.items ():
self.__fields [field] = value
- if self.__dataSource () is not None:
- (self.__dataSource ())._onRecordLoaded (self)
+ if self.__dataSource is not None:
+ self.__dataSource._onRecordLoaded (self)
else:
@@ -213,8 +212,8 @@
self.__status = 'inserted'
elif self.__status == 'clean':
self.__status = 'modified'
- if self.__dataSource () is not None:
- (self.__dataSource ())._onModification (self)
+ if self.__dataSource is not None:
+ self.__dataSource._onModification (self)
# ---------------------------------------------------------------------------
@@ -393,19 +392,19 @@
status = self.__status
# Call the hooks for commit-level hooks
- if self.__dataSource () is not None:
+ if self.__dataSource is not None:
# A trigger code could change the status from empty/inserted/modified to
# deleted. In that case, both triggers would be called.
if self.__status in ['empty', 'inserted']:
- (self.__dataSource ())._beforeCommitInsert (self)
+ self.__dataSource._beforeCommitInsert (self)
if self.__status == 'modified':
- (self.__dataSource ())._beforeCommitUpdate (self)
+ self.__dataSource._beforeCommitUpdate (self)
if self.__status == 'deleted':
- (self.__dataSource ())._beforeCommitDelete (self)
+ self.__dataSource._beforeCommitDelete (self)
# Check for empty primary key and set with the sequence value if so
# TODO: Move this to GDataSource
- ds = self.__dataSource ()
+ ds = self.__dataSource
if self.__status in ['empty', 'inserted']:
if hasattr (ds, 'primarykey') and \
hasattr (ds, 'primarykeyseq'):
@@ -465,7 +464,7 @@
"""
# First, requery ourselves
- if self.__dataSource () is not None and (self.__dataSource ()).requery:
+ if self.__dataSource is not None and self.__dataSource.requery:
if self.__rowidField or self.__primarykeyFields:
self.__requery (self.__boundFields)
Modified: trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py 2005-04-18
13:35:18 UTC (rev 7397)
+++ trunk/gnue-common/src/datasources/drivers/Base/ResultSet.py 2005-04-18
13:44:23 UTC (rev 7398)
@@ -59,7 +59,7 @@
self.__boundFields = boundFields
self.__readonly = readonly
self.__masterRecord = masterRecord
- self.__dataSource = dataSource # This is already a weakref!
+ self.__dataSource = dataSource
self._cachedRecords = []
self._currentRecord = -1
@@ -96,7 +96,7 @@
getattr (self, queryfunc) (self.__connection, **kwargs)
- self.__generator = self._fetch ((self.__dataSource ()).cache)
+ self.__generator = self._fetch (self.__dataSource.cache)
# (TODO: could be delayed to first call of getRecordCount)
self._recordCount = self._count ()
@@ -625,8 +625,8 @@
# Finally, tell everyone who wants to know that we have become a "new
# ResultSet" (i.e. the complete data should be redisplayed).
- if self.__dataSource () is not None:
- (self.__dataSource ()).notifyResultSetListeners ()
+ if self.__dataSource is not None:
+ self.__dataSource.notifyResultSetListeners ()
self.__sync ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7398 - in trunk/gnue-common/src/datasources: . drivers/Base,
reinhard <=