main logo
Subject: [dabo-dev] dabo Commit 2503
Author: Ed Leafe
Posted: 2006/11/30 10:10:20
 
View Entire Thread
New Search


dabo Commit
Revision 2503
Date: 2006-11-30 07:10:16 -0800 (Thu, 30 Nov 2006)
Author: ed

Changed:
U trunk/dabo/biz/dBizobj.py
U trunk/dabo/db/dCursorMixin.py
U trunk/dabo/db/dDataSet.py

Log:
Added references to the bizobj and cursor that \'own\' a data set. This will enable you to write replace() statements using functions such as \'self.Bizobj.foo(myField)\', where \'foo\' is a method of the bizobj.


Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2006-11-29 23:31:49 UTC (rev 2502)
+++ trunk/dabo/biz/dBizobj.py 2006-11-30 15:10:16 UTC (rev 2503)
@@ -156,6 +156,7 @@
crs.BackendObject = cn.getBackendObject()
crs.sqlManager = self.SqlManager
crs.AutoCommit = self.AutoCommit
+ crs._bizobj = self
crs.setSQL(self.SQL)
if self.RequeryOnLoad:
crs.requery()

Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py 2006-11-29 23:31:49 UTC (rev 2502)
+++ trunk/dabo/db/dCursorMixin.py 2006-11-30 15:10:16 UTC (rev 2503)
@@ -94,6 +94,9 @@
# Reference to the object with backend-specific behaviors
self.__backend = None

+ # Reference to the bizobj that \'owns\' this cursor, if any,
+ self._bizobj = None
+
# set properties for the SQL Builder functions
self.clearSQL()
self.hasSqlBuilder = True
@@ -875,6 +878,9 @@
beginning with \'=\'. Literals can be of any type.
"""
if isinstance(self._records, dDataSet):
+ # Make sure that the data set object has any necessary references
+ self._records.Cursor = self
+ self._records.Bizobj = self._bizobj
self._records.replace(field, valOrExpr, scope=scope)



Modified: trunk/dabo/db/dDataSet.py
===================================================================
--- trunk/dabo/db/dDataSet.py 2006-11-29 23:31:49 UTC (rev 2502)
+++ trunk/dabo/db/dDataSet.py 2006-11-30 15:10:16 UTC (rev 2503)
@@ -1,4 +1,5 @@
import sys
+import re
import dabo
from dabo.db.dMemento import dMemento
from dabo.dLocalize import _
@@ -44,6 +45,7 @@
super(dDataSet, self).__init__(*args, **kwargs)
self._connection = None
self._cursor = None
+ self._bizobj = None
self._populated = False
# We may need to encode fields that are not legal names.
self.fieldAliases = {}
@@ -393,6 +395,20 @@
# print "CONVERTED", dt-ft


+ def _getBizobj(self):
+ return self._bizobj
+
+ def _setBizobj(self, val):
+ self._bizobj = val
+
+
+ def _getCursor(self):
+ return self._cursor
+
+ def _setCursor(self, val):
+ self._cursor = val
+
+
def _getEncoding(self):
return self._encoding

@@ -405,8 +421,15 @@
# queries is executed
pass

+
+ Bizobj = property(_getBizobj, _setBizobj, None,
+ _("Reference to the bizobj that \'owns\' this data set. Default=None (bizobj)"))
+
+ Cursor = property(_getCursor, _setCursor, None,
+ _("Reference to the bizobj that \'owns\' this data set. Default=None (dCursorMixin)"))
+
Encoding = property(_getEncoding, _setEncoding, None,
- """ Gets or sets the encoding """)
+ _(" The encoding used for data in the dataset. (str)"))








 
©2006 Ed Leafe
<-- Prior Message New Search Next Message -->