dabo Commit
Revision 5011
Date: 2009-02-01 20:03:44 -0800 (Sun, 01 Feb 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5011

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

Log:
Added code to better handle setting the cursor's Table property when operating 
as a web app. This avoids the calls to getFields(), etc., which are not 
possible when the cursor is not connected to a database.

Also, ran across an error message in my testing that could be a bit more 
informative, so I improved the output.


Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py   2009-02-01 22:45:47 UTC (rev 5010)
+++ trunk/dabo/biz/dBizobj.py   2009-02-02 04:03:44 UTC (rev 5011)
@@ -1573,7 +1573,8 @@
                """Accepts a data set and type defintion dict, and updates the 
cursor
                with these values.
                """
-               self.DataStructure = stru
+               if stru:
+                       self.DataStructure = stru
                self._CurrentCursor._storeData(data, typs)
 
 
@@ -1874,6 +1875,8 @@
                        crs.DataStructure = self._dataStructure
                if not self._RemoteProxy:
                        crs.Table = self._dataSource
+               else:
+                       crs._setTableForRemote(self._dataSource)
                crs.UserSQL = self._userSQL
                crs.VirtualFields = self._virtualFields
                crs.Encoding = self.Encoding

Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2009-02-01 22:45:47 UTC (rev 5010)
+++ trunk/dabo/db/dCursorMixin.py       2009-02-02 04:03:44 UTC (rev 5011)
@@ -1755,7 +1755,7 @@
                and an exception is raised.
                """
                if (rownum >= self.RowCount) or (rownum < 0):
-                       raise dException.dException(_("Invalid row specified."))
+                       raise dException.dException(_("Invalid row specified: 
%s. RowCount=%s") % (rownum, self.RowCount))
                self.RowNumber = rownum
 
 
@@ -2305,6 +2305,13 @@
                return self.getFieldVal(fieldName, row)
 
 
+       def _setTableForRemote(self, tbl):
+               """Used when running as a remote application. We don't want to 
trigger
+               the methods to query the database for field information.
+               """
+               self._table = self.AuxCursor._table = self.sqlManager._table = 
"%s" % tbl
+
+
        ## Property getter/setter methods ##
        def _getAutoSQL(self):
                return self.getSQL()



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to