Changeset 3210
- Timestamp:
- 06/23/07 12:12:27 (2 years ago)
- Files:
-
- trunk/dabo/biz/dBizobj.py (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/biz/dBizobj.py
r3209 r3210 58 58 59 59 # Various attributes used for Properties 60 self._autoCommit = False 60 61 self._caption = "" 61 62 self._dataSource = "" 63 self._nonUpdateFields = [] 62 64 self._scanRestorePosition = True 63 65 self._scanReverse = False … … 133 135 if self.__cursors: 134 136 _dataStructure = getattr(self.__cursors[self.__cursors.keys()[0]], "_dataStructure", None) 135 _virtualFields = getattr(self.__cursors[self.__cursors.keys()[0]], "_virtualFields", {})137 self._virtualFields = getattr(self.__cursors[self.__cursors.keys()[0]], "_virtualFields", {}) 136 138 else: 137 139 # The first cursor is being created, before DataStructure is assigned. 138 140 _dataStructure = None 139 _virtualFields = {}141 self._virtualFields = {} 140 142 errMsg = self.beforeCreateCursor() 141 143 if errMsg: … … 155 157 if _dataStructure is not None: 156 158 crs._dataStructure = _dataStructure 157 crs._virtualFields = _virtualFields159 crs._virtualFields = self._virtualFields 158 160 crs.KeyField = self.KeyField 159 161 crs.Table = self.DataSource … … 494 496 def execute(self, sql): 495 497 """Execute the sql on the cursor. Dangerous. Use executeSafe instead.""" 498 self._syncWithCursors() 496 499 return self._CurrentCursor.execute(sql) 497 500 … … 503 506 main cursor. 504 507 """ 508 self._syncWithCursors() 505 509 return self._CurrentCursor.executeSafe(sql) 506 510 … … 1448 1452 1449 1453 1454 def _syncWithCursors(self): 1455 """Many bizobj properties need to be passed through to the cursors 1456 that provide it with data connectivity. This method ensures that all 1457 such cursors are in sync with the bizobj. 1458 """ 1459 for crs in self.__cursors.values(): 1460 crs.AutoCommit = self._autoCommit 1461 crs.AutoPopulatePK = self._autoPopulatePK 1462 crs.AutoQuoteNames = self._autoQuoteNames 1463 crs.Table = self._dataSource 1464 crs.VirtualFields = self._virtualFields 1465 crs.Encoding = self.Encoding 1466 crs.KeyField = self._keyField 1467 crs.setNonUpdateFields(self._nonUpdateFields) 1468 1469 1450 1470 def _getAutoCommit(self): 1451 1471 return self._CurrentCursor.AutoCommit 1452 1472 1453 1473 def _setAutoCommit(self, val): 1454 for crs in self.__cursors.values():1455 crs.AutoCommit = val1474 self._autoCommit = val 1475 self._syncWithCursors() 1456 1476 1457 1477 … … 1464 1484 def _setAutoPopulatePK(self, val): 1465 1485 self._autoPopulatePK = bool(val) 1466 for crs in self.__cursors.values(): 1467 crs.AutoPopulatePK = val 1486 self._syncWithCursors() 1468 1487 1469 1488 … … 1473 1492 def _setAutoQuoteNames(self, val): 1474 1493 self._autoQuoteNames = val 1475 for crs in self.__cursors.values(): 1476 crs.AutoQuoteNames = val 1494 self._syncWithCursors() 1477 1495 1478 1496 … … 1526 1544 def _setDataSource(self, val): 1527 1545 self._dataSource = str(val) 1528 for crs in self.__cursors.values(): 1529 crs.Table = val 1546 self._syncWithCursors() 1530 1547 1531 1548 … … 1559 1576 1560 1577 def _setVirtualFields(self, val): 1561 for crs in self.__cursors.values():1562 crs.VirtualFields = val1563 1578 self._virtualFields = val 1579 self._syncWithCursors() 1564 1580 1565 1581 1566 1582 def _getEncoding(self): 1567 ret = None 1568 cursor = self._CurrentCursor 1569 if cursor is not None: 1570 ret = cursor.Encoding 1571 if ret is None: 1572 if self.Application: 1573 ret = self.Application.Encoding 1574 else: 1575 ret = dabo.defaultEncoding 1583 try: 1584 ret = self._encoding 1585 except AttributeError: 1586 ret = None 1587 cursor = self._CurrentCursor 1588 if cursor is not None: 1589 ret = cursor.Encoding 1590 if ret is None: 1591 if self.Application: 1592 ret = self.Application.Encoding 1593 else: 1594 ret = dabo.defaultEncoding 1595 self._encoding = ret 1576 1596 return ret 1577 1597 1578 1598 def _setEncoding(self, val): 1579 for crs in self.__cursors.values():1580 crs.Encoding = val1599 self._encoding = val 1600 self._syncWithCursors() 1581 1601 1582 1602 … … 1603 1623 def _setKeyField(self, val): 1604 1624 self._keyField = val 1605 for crs in self.__cursors.values(): 1606 crs.KeyField = val 1625 self._syncWithCursors() 1607 1626 1608 1627 … … 1651 1670 if fldList is None: 1652 1671 fldList = [] 1653 for crs in self.__cursors.values():1654 crs.setNonUpdateFields(fldList)1672 self._nonUpdateFields = fldList 1673 self._syncWithCursors() 1655 1674 1656 1675
