Changeset 5958
- Timestamp:
- 08/22/2010 01:17:38 PM (1 year ago)
- Files:
-
- trunk/dabo/__init__.py (modified) (2 diffs)
- trunk/dabo/biz/dBizobj.py (modified) (2 diffs)
- trunk/dabo/dApp.py (modified) (16 diffs)
- trunk/dabo/dEvents.py (modified) (2 diffs)
- trunk/dabo/dLocalize.py (modified) (2 diffs)
- trunk/dabo/dObject.py (modified) (1 diff)
- trunk/dabo/dPref.py (modified) (3 diffs)
- trunk/dabo/db/dBackend.py (modified) (3 diffs)
- trunk/dabo/db/dConnectInfo.py (modified) (1 diff)
- trunk/dabo/db/dCursorMixin.py (modified) (12 diffs)
- trunk/dabo/db/dDataSet.py (modified) (1 diff)
- trunk/dabo/db/dbFirebird.py (modified) (4 diffs)
- trunk/dabo/db/dbMySQL.py (modified) (3 diffs)
- trunk/dabo/db/dbOracle.py (modified) (1 diff)
- trunk/dabo/db/dbPostgreSQL.py (modified) (2 diffs)
- trunk/dabo/db/dbSQLite.py (modified) (4 diffs)
- trunk/dabo/lib/RemoteConnector.py (modified) (4 diffs)
- trunk/dabo/lib/datanav/Page.py (modified) (1 diff)
- trunk/dabo/lib/logger.py (modified) (1 diff)
- trunk/dabo/logging.conf (added)
- trunk/dabo/settings.py (modified) (2 diffs)
- trunk/dabo/ui/__init__.py (modified) (3 diffs)
- trunk/dabo/ui/dDataControlMixinBase.py (modified) (4 diffs)
- trunk/dabo/ui/uitk/__init__.py (modified) (1 diff)
- trunk/dabo/ui/uitk/dFormMixin.py (modified) (1 diff)
- trunk/dabo/ui/uitk/dPemMixin.py (modified) (3 diffs)
- trunk/dabo/ui/uitk/uiApp.py (modified) (3 diffs)
- trunk/dabo/ui/uiwx/__init__.py (modified) (8 diffs)
- trunk/dabo/ui/uiwx/dDataControlMixin.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dDateTextBox.py (modified) (2 diffs)
- trunk/dabo/ui/uiwx/dDockForm.py (modified) (8 diffs)
- trunk/dabo/ui/uiwx/dEditor.py (modified) (6 diffs)
- trunk/dabo/ui/uiwx/dFont.py (modified) (2 diffs)
- trunk/dabo/ui/uiwx/dForm.py (modified) (6 diffs)
- trunk/dabo/ui/uiwx/dFormMixin.py (modified) (2 diffs)
- trunk/dabo/ui/uiwx/dGlWindow.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dGrid.py (modified) (11 diffs)
- trunk/dabo/ui/uiwx/dGridSizer.py (modified) (2 diffs)
- trunk/dabo/ui/uiwx/dImage.py (modified) (2 diffs)
- trunk/dabo/ui/uiwx/dLinePlot.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dListControl.py (modified) (3 diffs)
- trunk/dabo/ui/uiwx/dMaskedTextBox.py (modified) (3 diffs)
- trunk/dabo/ui/uiwx/dPageFrame.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dPemMixin.py (modified) (8 diffs)
- trunk/dabo/ui/uiwx/dRadioList.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dRichTextBox.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dSizerMixin.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dSlidePanelControl.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dSlider.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dSpinner.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/dTextBoxMixin.py (modified) (1 diff)
- trunk/dabo/ui/uiwx/uiApp.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/__init__.py
r5849 r5958 102 102 import locale 103 103 import logging 104 import logging.handlers 104 105 try: 105 106 import pysqlite2 … … 127 128 from settings import * 128 129 129 # Instantiate the logger object, which will send messages to user-overridable 130 # locations. Do this before any other imports. 131 from dabo.lib.logger import Log 132 infoLog = Log() 133 infoLog.Caption = "Dabo Info Log" 134 if verboseLogging: 135 infoLog.LogObject = sys.stdout 136 else: 137 class NullWrite(object): 138 def write(self, txt): pass 139 infoLog.LogObject = NullWrite() 140 errorLog = Log() 141 errorLog.Caption = "Dabo Error Log" 142 errorLog.LogObject = sys.stderr 143 # Create a separate log reference for event tracking. 144 eventLog = Log() 145 eventLog.Caption = "Dabo Event Log" 146 eventLog.LogObject = sys.stdout 147 # This log is set to None by default. It must be manually activated 148 # via the Application object. 149 dbActivityLog = Log() 150 dbActivityLog.Caption = "Database Activity Log" 151 dbActivityLog.LogObject = None 130 _logConfFileName = "logging.conf" 131 logConfFile = os.path.join(os.getcwd(), _logConfFileName) 132 if not os.path.exists(logConfFile): 133 daboloc = os.path.dirname(__file__) 134 logConfFile = os.path.join(daboloc, _logConfFileName) 135 import logging.config 136 logging.config.fileConfig(logConfFile) 137 138 log = logging.getLogger("dabo.mainLog") 139 dbActivityLog = logging.getLogger("dabo.dbActivityLog") 140 consoleLog = fileLog = dbLog = None 141 for _handler in log.handlers: 142 try: 143 _handler.baseFilename 144 fileLog = _handler 145 except AttributeError: 146 consoleLog = _handler 147 for _handler in dbActivityLog.handlers: 148 try: 149 _handler.baseFilename 150 dbLog = _handler 151 break 152 except AttributeError: 153 pass 154 155 156 ######################################################## 157 #### The commented out code was a first attempt at using Python logging, but with 158 #### the dabo.settings file being used to configure instead of logging.conf 159 ######################################################## 160 # logConsoleHandler = logging.StreamHandler() 161 # logConsoleHandler.setLevel(logConsoleLevel) 162 # logFileHandler = logging.handlers.RotatingFileHandler(filename=logFile, maxBytes=maxLogFileSize, 163 # encoding=defaultEncoding) 164 # logFileHandler.setLevel(logFileLevel) 165 # consoleFormatter = logging.Formatter(consoleFormat) 166 # fileFormatter = logging.Formatter(fileFormat) 167 # logConsoleHandler.setFormatter(consoleFormatter) 168 # logFileHandler.setFormatter(fileFormatter) 169 # log = logging.getLogger(logName) 170 # log.setLevel(logging.DEBUG) 171 # log.addHandler(logConsoleHandler) 172 # log.addHandler(logFileHandler) 173 # 174 # This log is set to the null output device ('nul' on Windows; /dev/null on the rest) 175 # dbActivityLog = logging.getLogger("dabo.dbActivityLog") 176 # dbLogHandler = logging.handlers.RotatingFileHandler(filename=dbLogFile, maxBytes=maxLogFileSize, 177 # encoding=defaultEncoding) 178 # dbActivityLog.addHandler(dbLogHandler) 179 # dbActivityLog.setLevel(dbLogFileLevel) 180 # dbLogHandler.setLevel(dbLogFileLevel) 181 ######################################################## 152 182 153 183 # Install localization service for dabo. dApp will install localization service trunk/dabo/biz/dBizobj.py
r5915 r5958 428 428 except StandardError, e: 429 429 # Need to record what sort of error could be thrown 430 dabo. errorLog.write(_("Failed to set RowNumber. Error: %s") % e)430 dabo.log.error(_("Failed to set RowNumber. Error: %s") % e) 431 431 432 432 … … 832 832 except StandardError, e: 833 833 # Reset things and bail 834 dabo. errorLog.write(_("Error in scanChangedRows: %s") % e)834 dabo.log.error(_("Error in scanChangedRows: %s") % e) 835 835 self._CurrentCursor = old_currentCursorKey 836 836 self._positionUsingPK(old_pk) trunk/dabo/dApp.py
r5849 r5958 294 294 except urllib2.URLError, e: 295 295 # Cannot sync; record the error and move on 296 dabo. errorLog.write(_("File re-sync failed. Reason: %s") % e)296 dabo.log.error(_("File re-sync failed. Reason: %s") % e) 297 297 298 298 … … 406 406 self.closeConnections() 407 407 self._tempFileHolder.release() 408 dabo. infoLog.write(_("Application finished."))408 dabo.log.info(_("Application finished.")) 409 409 self._finished = True 410 410 self.afterFinish() … … 579 579 except urllib2.URLError, e: 580 580 # Could not connect 581 dabo. errorLog.write(_("Could not connect to the Dabo servers: %s") % e)581 dabo.log.error(_("Could not connect to the Dabo servers: %s") % e) 582 582 return e 583 583 except ValueError: 584 584 pass 585 585 except StandardError, e: 586 dabo. errorLog.write(_("Failed to open URL '%(url)s'. Error: %(e)s") % locals())586 dabo.log.error(_("Failed to open URL '%(url)s'. Error: %(e)s") % locals()) 587 587 return e 588 588 if simplejson: … … 605 605 except StandardError, e: 606 606 # No internet access, or Dabo site is down. 607 dabo. errorLog.write(_("Cannot access the Dabo site. Error: %s") % e)607 dabo.log.error(_("Cannot access the Dabo site. Error: %s") % e) 608 608 self._resetWebUpdateCheck() 609 609 return None … … 622 622 if not zipfiles: 623 623 # No updates available 624 dabo. infoLog.write(_("No changed files available."))624 dabo.log.info(_("No changed files available.")) 625 625 return 626 626 projects = ("dabo", "demo", "ide") … … 729 729 if newFile: 730 730 file(pth, "w").write(newFile) 731 dabo. infoLog.write(_("File %s updated") % pth)731 dabo.log.info(_("File %s updated") % pth) 732 732 733 733 … … 940 940 self.dbConnectionDefs[k] = v 941 941 942 dabo. infoLog.write(_("%s database connection definition(s) loaded.")942 dabo.log.info(_("%s database connection definition(s) loaded.") 943 943 % (len(self.dbConnectionDefs))) 944 944 … … 989 989 else: 990 990 # Custom app code or the dabo.ui module already set this: don't touch 991 dabo. infoLog.write(_("User interface already set to '%s', so dApp didn't touch it.")991 dabo.log.info(_("User interface already set to '%s', so dApp didn't touch it.") 992 992 % self.UI) 993 993 … … 998 998 connDefs = importConnections(filePath, useHomeDir=True) 999 999 except SAXParseException, e: 1000 dabo. errorLog.write(_("Error parsing '%(filePath)s': %(e)s") % locals())1000 dabo.log.error(_("Error parsing '%(filePath)s': %(e)s") % locals()) 1001 1001 return {} 1002 1002 # Convert the connect info dicts to dConnectInfo instances: … … 1086 1086 stdDirs = self._standardDirs + ("main.py", ) 1087 1087 if dirname not in stdDirs: 1088 dabo. errorLog.write(_("Non-standard directory '%s' requested") % dirname)1088 dabo.log.error(_("Non-standard directory '%s' requested") % dirname) 1089 1089 return None 1090 1090 osp = os.path … … 1325 1325 pass 1326 1326 if not ret: 1327 dabo. infoLog.write(_("WARNING: No BasePrefKey has been set for this application."))1327 dabo.log.info(_("WARNING: No BasePrefKey has been set for this application.")) 1328 1328 try: 1329 1329 f = inspect.stack()[-1][1] … … 1357 1357 1358 1358 1359 def _getDatabaseActivityLog(self): 1360 return dabo.dbActivityLog.LogObject 1361 1362 def _setDatabaseActivityLog(self, val): 1363 if isinstance(val, basestring): 1364 try: 1365 f = open(val, "a") 1366 except IOError, e: 1367 dabo.errorLog.write(_("Could not open file: '%(val)s': %(e)s") % locals()) 1368 return 1369 else: 1370 f = val 1371 dabo.dbActivityLog.LogObject = f 1359 # def _getDatabaseActivityLog(self): 1360 # return dabo.dbActivityLog 1361 # 1362 # def _setDatabaseActivityLog(self, val): 1363 # try: 1364 # dbLogger = dabo.dbActivityLog 1365 # for hnd in dbLogger.handlers: 1366 # dbLogger.removeHandler(hnd) 1367 # dabo.dbLogHandler = logging.handlers.RotatingFileHandler(filename=val, 1368 # maxBytes=dabo.maxLogFileSize, encoding=self.Encoding) 1369 # dbLogger.addHandler(dabo.dbLogHandler) 1370 # dbLogger.setLevel(logging.INFO) 1371 # dabo.dbLogHandler.setLevel(logging.INFO) 1372 # except IOError, e: 1373 # dabo.log.error(_("Could not open file: '%(val)s': %(e)s") % locals()) 1374 # return 1372 1375 1373 1376 … … 1446 1449 # HomeDirectory the location of the main script, since we can't guess at 1447 1450 # the application's directory structure. 1448 dabo. infoLog.write("Can't deduce HomeDirectory:setting to the script directory.")1451 dabo.log.info("Can't deduce HomeDirectory:setting to the script directory.") 1449 1452 hd = scriptDir 1450 1453 … … 1460 1463 self._homeDirectory = os.path.abspath(val) 1461 1464 else: 1462 dabo. errorLog.write(_("Setting App HomeDirectory: Path does not exist. '%s'") % val)1465 dabo.log.error(_("Setting App HomeDirectory: Path does not exist. '%s'") % val) 1463 1466 1464 1467 … … 1617 1620 if uiType is None: 1618 1621 self._uiAlreadySet = True 1619 dabo. infoLog.write(_("User interface set set to None."))1622 dabo.log.info(_("User interface set set to None.")) 1620 1623 elif dabo.ui.loadUI(uiType): 1621 1624 self._uiAlreadySet = True 1622 dabo. infoLog.write(_("User interface set to '%s' by dApp.") % uiType)1625 dabo.log.info(_("User interface set to '%s' by dApp.") % uiType) 1623 1626 else: 1624 dabo. infoLog.write(_("Tried to set UI to '%s', but it failed.") % uiType)1627 dabo.log.info(_("Tried to set UI to '%s', but it failed.") % uiType) 1625 1628 else: 1626 1629 raise RuntimeError(_("The UI cannot be reset once assigned.")) … … 1687 1690 any previous crypto objects are released. Write-only. (varies)""")) 1688 1691 1689 DatabaseActivityLog = property(_getDatabaseActivityLog, _setDatabaseActivityLog, None,1690 _("""Path to the file (or file-like object) to be used for logging all database1691 activity. Default=None, which means no log is kept. (file or str)"""))1692 # DatabaseActivityLog = property(_getDatabaseActivityLog, _setDatabaseActivityLog, None, 1693 # _("""Path to the file (or file-like object) to be used for logging all database 1694 # activity. Default=None, which means no log is kept. (file or str)""")) 1692 1695 1693 1696 DefaultMenuBarClass = property(_getDefaultMenuBarClass, _setDefaultMenuBarClass, None, trunk/dabo/dEvents.py
r5751 r5958 1 1 # -*- coding: utf-8 -*- 2 import logging 2 3 import time 3 4 import dabo … … 93 94 for logEventName in logEvents: 94 95 if logEventName.lower() == "all" or logEventName == eventName: 95 dabo.eventLog.write("dEvent Fired: %s %s" % 96 holdLevel = dabo.log.level 97 dabo.log.setLevel(logging.INFO) 98 dabo.log.info("dEvent Fired: %s %s" % 96 99 (self._eventObject.getAbsoluteName(), 97 100 self.__class__.__name__,)) 101 dabo.log.setLevel(holdLevel) 98 102 break 99 103 trunk/dabo/dLocalize.py
r5917 r5958 83 83 except IOError: 84 84 # No translation file found 85 dabo. errorLog.write("""85 dabo.log.error(""" 86 86 No translation file found for domain 'dabo'. 87 87 Locale dir = %s … … 95 95 translation = gettext.translation(domain, localedir, languages=lang, codeset=charset) 96 96 except IOError: 97 dabo. errorLog.write("No translation found for domain '%s' and language %s." % (domain, lang))98 dabo. errorLog.write("""97 dabo.log.error("No translation found for domain '%s' and language %s." % (domain, lang)) 98 dabo.log.error(""" 99 99 No translation file found for domain '%s'. 100 100 Locale dir = %s trunk/dabo/dObject.py
r5828 r5958 252 252 except SyntaxError, e: 253 253 snm = self.Name 254 dabo. errorLog.write(_("Method '%(nm)s' of object '%(snm)s' has the following error: %(e)s") % locals())254 dabo.log.error(_("Method '%(nm)s' of object '%(snm)s' has the following error: %(e)s") % locals()) 255 255 continue 256 256 # OK, we have the compiled code. Add it to the class definition. trunk/dabo/dPref.py
r5911 r5958 18 18 # descends from dObject, which needs to load dPref.py first. 19 19 warnings.warn("Class dPref requires package 'pysqlite2'.") 20 #dabo. errorLog.write("This class requires SQLite")20 #dabo.log.error("This class requires SQLite") 21 21 22 22 # We don't want to deal with these as preferences. … … 214 214 if not baseKey: 215 215 if not self._persistAll: 216 dabo. errorLog.write(_("No base key set; preference will not be persisted."))216 dabo.log.error(_("No base key set; preference will not be persisted.")) 217 217 return 218 218 else: … … 224 224 typ = self._typeDict[type(val)] 225 225 except KeyError: 226 dabo. errorLog.write(_("BAD TYPE: %s") % type(val))226 dabo.log.error(_("BAD TYPE: %s") % type(val)) 227 227 typ = "?" 228 228 # Convert it to a string that can be properly converted back trunk/dabo/db/dBackend.py
r5911 r5958 203 203 """ Begin a SQL transaction. Override in subclasses if needed.""" 204 204 self._connection.begin() 205 dabo.dbActivityLog. write("SQL: begin")205 dabo.dbActivityLog.info("SQL: begin") 206 206 return True 207 207 … … 210 210 """ Commit a SQL transaction.""" 211 211 self._connection.commit() 212 dabo.dbActivityLog. write("SQL: commit")212 dabo.dbActivityLog.info("SQL: commit") 213 213 return True 214 214 … … 217 217 """ Roll back (revert) a SQL transaction.""" 218 218 self._connection.rollback() 219 dabo.dbActivityLog. write("SQL: rollback")219 dabo.dbActivityLog.info("SQL: rollback") 220 220 return True 221 221 trunk/dabo/db/dConnectInfo.py
r5759 r5958 191 191 raise ValueError("Invalid database type: %s." % nm) 192 192 except ImportError: 193 dabo. errorLog.write(_("You do not have the database module for %s installed") % dbType)193 dabo.log.error(_("You do not have the database module for %s installed") % dbType) 194 194 self._dbType = None 195 195 self._backendObject = None trunk/dabo/db/dCursorMixin.py
r5913 r5958 256 256 except Exception, e: 257 257 tfv = type(field_val) 258 dabo. infoLog.write(_("_correctFieldType() failed for field: '%(field_name)s'; value: '%(field_val)s'; type: '%(tfv)s'")258 dabo.log.info(_("_correctFieldType() failed for field: '%(field_name)s'; value: '%(field_val)s'; type: '%(tfv)s'") 259 259 % locals()) 260 260 … … 277 277 # change self.Encoding and log the message 278 278 self.Encoding = enc 279 dabo. errorLog.write(_("Field %(fname)s: Incorrect unicode encoding set; using '%(enc)s' instead")279 dabo.log.error(_("Field %(fname)s: Incorrect unicode encoding set; using '%(enc)s' instead") 280 280 % {'fname':field_name, 'enc':enc} ) 281 281 return ret … … 287 287 288 288 rfv = repr(field_val) 289 dabo. errorLog.write(_("%(rfv)s couldn't be converted to %(pythonType)s (field %(field_name)s)")289 dabo.log.error(_("%(rfv)s couldn't be converted to %(pythonType)s (field %(field_name)s)") 290 290 % locals()) 291 291 return ret … … 310 310 if not self.IsPrefCursor: 311 311 try: 312 dabo.dbActivityLog. write("SQL: %s, PARAMS: %s" % (312 dabo.dbActivityLog.info("SQL: %s, PARAMS: %s" % ( 313 313 sql.decode(self.Encoding).replace("\n", " "), 314 314 ', '.join("%s" % p for p in params))) 315 315 except StandardError: 316 316 # A problem with writing to the log, most likely due to encoding issues 317 dabo.dbActivityLog. write("FAILED SQL: %s")317 dabo.dbActivityLog.info("FAILED SQL: %s") 318 318 else: 319 319 res = self.superCursor.execute(self, sql) 320 320 if not self.IsPrefCursor: 321 dabo.dbActivityLog. write("SQL: %s" % (321 dabo.dbActivityLog.info("SQL: %s" % ( 322 322 sql.decode(self.Encoding).replace("\n", " "),)) 323 323 except Exception, e: … … 329 329 if params: 330 330 try: 331 dabo.dbActivityLog. write("FAILED SQL: %s, PARAMS: %s" % (331 dabo.dbActivityLog.info("FAILED SQL: %s, PARAMS: %s" % ( 332 332 sql.decode(self.Encoding).replace("\n", " "), 333 333 ', '.join("%s" % p for p in params))) 334 334 except StandardError: 335 335 # A problem with writing to the log, most likely due to encoding issues 336 dabo.dbActivityLog. write("FAILED SQL: %s")336 dabo.dbActivityLog.info("FAILED SQL: %s") 337 337 else: 338 dabo.dbActivityLog. write("FAILED SQL: %s" % (338 dabo.dbActivityLog.info("FAILED SQL: %s" % ( 339 339 sql.decode(self.Encoding).replace("\n", " "),)) 340 340 # Database errors need to be decoded from database encoding. … … 351 351 raise dException.DBNoAccessException(errMsg) 352 352 else: 353 dabo.dbActivityLog. write(353 dabo.dbActivityLog.info( 354 354 _("DBQueryException encountered in execute(): %s\n%s") % (errMsg, sql)) 355 355 raise dException.DBQueryException(errMsg) … … 376 376 except UnicodeError: 377 377 errMsg = unicode(e) 378 dabo. errorLog.write("Error fetching records: %s" % errMsg)378 dabo.log.error("Error fetching records: %s" % errMsg) 379 379 380 380 if _records and not self.BackendObject._alreadyCorrectedFieldTypes: … … 1004 1004 sft, stv = ustr(fldType), ustr(type(val)) 1005 1005 msg = _("!!! Data Type Mismatch: field=%(fld)s. Expecting: %(sft)s; got: %(stv)s") % locals() 1006 dabo. errorLog.write(msg)1006 dabo.log.error(msg) 1007 1007 1008 1008 # If the new value is different from the current value, change it and also … … 1056 1056 self._clearMemento(row) 1057 1057 else: 1058 dabo. infoLog.write("Field value changed, but the memento"1058 dabo.log.info("Field value changed, but the memento" 1059 1059 " can't be saved, because there is no valid KeyField.") 1060 1060 … … 1325 1325 except UnicodeError: 1326 1326 errMsg = unicode(e) 1327 dabo.dbActivityLog. write(1327 dabo.dbActivityLog.info( 1328 1328 _("DBQueryException encountered in save(): %s") % errMsg) 1329 1329 raise e … … 1331 1331 errMsg = ustr(e) 1332 1332 if "connect" in errMsg.lower(): 1333 dabo.dbActivityLog. write(1333 dabo.dbActivityLog.info( 1334 1334 _("Connection Lost exception encountered in saverow(): %s") % errMsg) 1335 1335 raise dException.ConnectionLostException(errMsg) … … 1761 1761 newval = typ() 1762 1762 except Exception, e: 1763 dabo. errorLog.write(_("Failed to create newval for field '%s'") % field_alias)1764 dabo. errorLog.write(ustr(e))1763 dabo.log.error(_("Failed to create newval for field '%s'") % field_alias) 1764 dabo.log.error(ustr(e)) 1765 1765 newval = u"" 1766 1766 trunk/dabo/db/dDataSet.py
r5911 r5958 295 295 if len(ds) == 0: 296 296 # Can't create and populate a table without a structure 297 dabo. errorLog.write(_("Cannot populate without data for alias '%s'")297 dabo.log.error(_("Cannot populate without data for alias '%s'") 298 298 % alias) 299 299 return None trunk/dabo/db/dbFirebird.py
r5911 r5958 36 36 # use type_conv=300 for blob encoding 37 37 kinterbasdb.init(type_conv=300) 38 dabo.dbActivityLog. write("kinterbasdb.init(type_conv=300)")38 dabo.dbActivityLog.info("kinterbasdb.init(type_conv=300)") 39 39 else: 40 40 kinterbasdb.init(type_conv=200) 41 dabo.dbActivityLog. write("kinterbasdb.init(type_conv=200)")41 dabo.dbActivityLog.info("kinterbasdb.init(type_conv=200)") 42 42 if initialized is None: 43 43 # Older versions of kinterbasedb didn't have this attribute, so we write … … 210 210 if not self._connection._has_transaction(): 211 211 self._connection.begin() 212 dabo.dbActivityLog. write("SQL: begin")212 dabo.dbActivityLog.info("SQL: begin") 213 213 ret = True 214 214 return ret … … 220 220 """ 221 221 self._connection.commit() 222 dabo.dbActivityLog. write("SQL: commit")222 dabo.dbActivityLog.info("SQL: commit") 223 223 224 224 … … 267 267 cursor.execute(sql) 268 268 ret = cursor.getFieldVal("nextval") 269 dabo.dbActivityLog. write("SQL: result of pregenPK: %d" % ret)269 dabo.dbActivityLog.info("SQL: result of pregenPK: %d" % ret) 270 270 return ret 271 271 trunk/dabo/db/dbMySQL.py
r5911 r5958 90 90 """ Begin a SQL transaction.""" 91 91 cursor.execute("START TRANSACTION") 92 dabo.dbActivityLog. write("SQL: begin")92 dabo.dbActivityLog.info("SQL: begin") 93 93 return True 94 94 … … 97 97 """ Commit a SQL transaction.""" 98 98 cursor.execute("COMMIT") 99 dabo.dbActivityLog. write("SQL: commit")99 dabo.dbActivityLog.info("SQL: commit") 100 100 return True 101 101 … … 104 104 """ Rollback a SQL transaction.""" 105 105 cursor.execute("ROLLBACK") 106 dabo.dbActivityLog. write("SQL: rollback")106 dabo.dbActivityLog.info("SQL: rollback") 107 107 return True 108 108 trunk/dabo/db/dbOracle.py
r5911 r5958 154 154 if not self._connection._has_transaction(): 155 155 self._connection.begin() 156 dabo.dbActivityLog. write("SQL: begin")156 dabo.dbActivityLog.info("SQL: begin") 157 157 ret = True 158 158 return ret trunk/dabo/db/dbPostgreSQL.py
r5911 r5958 87 87 encoding = self._encodings[encoding] 88 88 except KeyError: 89 dabo.dbActivityLog. write("unknown encoding %r" % encoding)89 dabo.dbActivityLog.info("unknown encoding %r" % encoding) 90 90 if self._connection.encoding != encoding: 91 91 try: 92 92 self._connection.set_client_encoding(encoding) 93 93 except Exception: 94 dabo.dbActivityLog. write("cannot set database client encoding")94 dabo.dbActivityLog.info("cannot set database client encoding") 95 95 return encoding 96 96 97 97 98 98 def beginTransaction(self, cursor): 99 dabo.dbActivityLog. write("SQL: begin (implicit, nothing done)")99 dabo.dbActivityLog.info("SQL: begin (implicit, nothing done)") 100 100 return True 101 101 … … 213 213 """ 214 214 self.commitTransaction(cursor) 215 dabo.dbActivityLog. write("SQL: Commit")215 dabo.dbActivityLog.info("SQL: Commit") 216 216 217 217 trunk/dabo/db/dbSQLite.py
r5911 r5958 97 97 """ 98 98 cursor.execute("BEGIN") 99 dabo.dbActivityLog. write("SQL: begin")99 dabo.dbActivityLog.info("SQL: begin") 100 100 return True 101 101 … … 106 106 try: 107 107 cursor.execute("COMMIT", errorClass=opError) 108 dabo.dbActivityLog. write("SQL: commit")108 dabo.dbActivityLog.info("SQL: commit") 109 109 return True 110 110 except opError, e: … … 116 116 except UnicodeError: 117 117 errMsg = unicode(e) 118 dabo.dbActivityLog. write("SQL: commit failed: %s" % errMsg)118 dabo.dbActivityLog.info("SQL: commit failed: %s" % errMsg) 119 119 raise dException.DBQueryException(errMsg) 120 120 … … 123 123 """ Rollback a SQL transaction.""" 124 124 cursor.execute("ROLLBACK") 125 dabo.dbActivityLog. write("SQL: rollback")125 dabo.dbActivityLog.info("SQL: rollback") 126 126 return True 127 127 128 128 129 129 def flush(self, crs): 130 dabo.dbActivityLog. write("SQL: flush")130 dabo.dbActivityLog.info("SQL: flush") 131 131 self._connection.commit() 132 132 trunk/dabo/lib/RemoteConnector.py
r5915 r5958 61 61 if reRaise: 62 62 raise 63 dabo. errorLog.write("HTTPError: %s" % e)63 dabo.log.error("HTTPError: %s" % e) 64 64 return None 65 65 ret = res.read() … … 191 191 errText = e.read() 192 192 errMsg = "\n".join(errText.splitlines()[4:]) 193 dabo. errorLog.write(_("HTTP Error getting app list: %s") % e)193 dabo.log.error(_("HTTP Error getting app list: %s") % e) 194 194 raise 195 195 # If they passed an app name, and it's in the returned app list, run it … … 257 257 return homedir 258 258 else: 259 dabo. errorLog.write(_("HTTP Error syncing files: %s") % e)259 dabo.log.error(_("HTTP Error syncing files: %s") % e) 260 260 return 261 261 except urllib2.URLError: … … 289 289 res = self.UrlOpener.open(url) 290 290 except urllib2.HTTPError, e: 291 dabo. errorLog.write(_("HTTP Error retrieving files: %s") % e)291 dabo.log.error(_("HTTP Error retrieving files: %s") % e) 292 292 # res holds a zip file 293 293 f = StringIO(res.read()) trunk/dabo/lib/datanav/Page.py
r5915 r5958 431 431 chc = (_(CHOICE_TRUE), _(CHOICE_FALSE)) 432 432 else: 433 dabo. errorLog.write(_("Type '%s' not recognized.") % typ)433 dabo.log.error(_("Type '%s' not recognized.") % typ) 434 434 chc = () 435 435 return chc trunk/dabo/lib/logger.py
r5915 r5958 15 15 16 16 So, to display general informational messages, call: 17 dabo. infoLog.write("message")17 dabo.log.info("message") 18 18 19 19 For error messages, call: 20 dabo. errorLog.write("message")20 dabo.log.error("message") 21 21 22 22 By default, infoLog writes to stdout and errorLog to stderr. But your code trunk/dabo/settings.py
r5681 r5958 3 3 import os 4 4 import sys 5 import logging 5 6 6 7 # Dabo Global Settings … … 180 181 webupdate_urlbase = "http://daboserver.com/webupdate" 181 182 183 ######################################################## 184 #### The commented out code was a first attempt at using Python logging, but with 185 #### the dabo.settings file being used to configure instead of logging.conf 186 ######################################################## 187 # Logging settings 188 # logLevel = logging.DEBUG 189 # logFile = "dabo.log" 190 # logConsoleLevel = logging.ERROR 191 # logFileLevel = logging.ERROR 192 # logName = "DaboLog" 193 # consoleFormat = "%(asctime)s - %(levelname)s - %(message)s" 194 # fileFormat = "%(asctime)s - %(levelname)s - %(message)s" 195 # # Set the db file to the null device initially 196 # dbLogFile = os.devnull 197 # dbLogFileLevel = logging.DEBUG 198 # maxLogFileSize = 5242880 # 5 MB 199 ######################################################## 200 182 201 183 202 ### Settings - end 203 184 204 185 205 # Make sure that the current directory is in the sys.path trunk/dabo/ui/__init__.py
r5828 r5958 68 68 pass 69 69 else: 70 dabo. infoLog.write(_("Cannot change the uiType to '%(typ)s', because UI '%(currType)s' is already loaded.")70 dabo.log.info(_("Cannot change the uiType to '%(typ)s', because UI '%(currType)s' is already loaded.") 71 71 % locals()) 72 72 return retVal … … 85 85 86 86 if __defaultUI: 87 dabo. infoLog.write(_("Automatically loading default ui '%s'...") % __defaultUI)87 dabo.log.info(_("Automatically loading default ui '%s'...") % __defaultUI) 88 88 # For now, don't do the tempting option: 89 89 #loadUI(defaultUI) … … 95 95 else: 96 96 pass 97 #dabo. infoLog.write(_("No default UI set. (DABO_DEFAULT_UI)"))97 #dabo.log.info(_("No default UI set. (DABO_DEFAULT_UI)")) 98 98 99 99 trunk/dabo/ui/dDataControlMixinBase.py
r5916 r5958 247 247 exec ("src.%s = curVal" % self.DataField) 248 248 except StandardError, e: 249 dabo. errorLog.write("Could not bind to '%s.%s'\nReason: %s" % (self.DataSource, self.DataField, e) )249 dabo.log.error("Could not bind to '%s.%s'\nReason: %s" % (self.DataSource, self.DataField, e) ) 250 250 else: 251 251 # The source is a direct object reference … … 257 257 else: 258 258 nm = ustr(self.DataSource) 259 dabo. errorLog.write("Could not bind to '%s.%s'\nReason: %s" % (nm, self.DataField, e) )259 dabo.log.error("Could not bind to '%s.%s'\nReason: %s" % (nm, self.DataField, e) ) 260 260 self._oldVal = curVal 261 261 self._from_flushValue = True … … 311 311 return "L" 312 312 else: 313 dabo. infoLog.write(_("getShortDataType - unknown type: %s") % (value,))313 dabo.log.info(_("getShortDataType - unknown type: %s") % (value,)) 314 314 return "?" 315 315 … … 459 459 if not isinstance(ds, (dObject, dPref)): 460 460 # Warn about possible unsupported behavior. 461 dabo. infoLog.write(_("DataSource '%s' does not inherit from a proper Dabo class. This may result in unsupported problems.") % ds.__repr__())461 dabo.log.info(_("DataSource '%s' does not inherit from a proper Dabo class. This may result in unsupported problems.") % ds.__repr__()) 462 462 else: 463 463 self._srcIsBizobj = isinstance(ds, dabo.biz.dBizobj) trunk/dabo/ui/uitk/__init__.py
r3199 r5958 4 4 from uiApp import uiApp 5 5 6 dabo. infoLog.write("The Tkinter module is experimental only, and doesn't work. You've been warned.")6 dabo.log.info("The Tkinter module is experimental only, and doesn't work. You've been warned.") 7 7 uiType = {'shortName': 'tk', 'moduleName': 'uitk', 'longName': 'Tkinter'} 8 8 trunk/dabo/ui/uitk/dFormMixin.py
r5916 r5958 51 51 # exec(self.debugText) 52 52 # except: 53 # dabo. infoLog.write(_("Could not execute: %s") % self.debugText)53 # dabo.log.info(_("Could not execute: %s") % self.debugText) 54 54 # dlg.Destroy() 55 55 # trunk/dabo/ui/uitk/dPemMixin.py
r5916 r5958 282 282 283 283 def _setFont(self, font): 284 dabo. errorLog.write("_setFont not implemented yet.")284 dabo.log.error("_setFont not implemented yet.") 285 285 286 286 … … 291 291 return "Not implemented yet." 292 292 def _setFontBold(self, fontBold): 293 dabo. errorLog.write("_setFontBold not implemented yet.")293 dabo.log.error("_setFontBold not implemented yet.") 294 294 295 295 def _getFontItalic(self): 296 296 return "Not implemented yet." 297 297 def _setFontItalic(self, fontItalic): 298 dabo. errorLog.write("_setFontItalic not implemented yet.")298 dabo.log.error("_setFontItalic not implemented yet.") 299 299 300 300 def _getFontFace(self): … … 304 304 return "Not implemented yet." 305 305 def _setFontSize(self, fontSize): 306 dabo. errorLog.write("_setFontSize not implemented yet.")306 dabo.log.error("_setFontSize not implemented yet.") 307 307 308 308 def _getFontUnderline(self): 309 309 return "Not implemented yet." 310 310 def _setFontUnderline(self, val): 311 dabo. errorLog.write("_setFontUnderline not implemented yet.")311 dabo.log.error("_setFontUnderline not implemented yet.") 312 312 313 313 trunk/dabo/ui/uitk/uiApp.py
r3199 r5958 80 80 81 81 def onEditPreferences(self, evt): 82 dabo. infoLog.write("Stub: uiApp.onEditPreferences()")82 dabo.log.info("Stub: uiApp.onEditPreferences()") 83 83 84 84 … … 135 135 # value = None 136 136 # if type(value) not in (type(str()), type(unicode())): 137 # dabo. errorLog.write("Active control isn't text-based.")137 # dabo.log.error("Active control isn't text-based.") 138 138 # return 139 139 # … … 169 169 # win.ShowPosition(win.GetSelection()[1]) 170 170 # else: 171 # dabo. infoLog.write("Not found")171 # dabo.log.info("Not found") 172 172 173 173 trunk/dabo/ui/uiwx/__init__.py
r5918 r5958 296 296 wx.CallAfter(fnc, obj, val) 297 297 except StandardError, e: 298 dabo. errorLog.write(_("setAfter() failed to set property '%(prop)s' to value '%(val)s': %(e)s.")298 dabo.log.error(_("setAfter() failed to set property '%(prop)s' to value '%(val)s': %(e)s.") 299 299 % locals()) 300 300 … … 308 308 callAfterInterval(interval, fnc, obj, val) 309 309 except StandardError, e: 310 dabo. errorLog.write(_("setAfterInterval() failed to set property '%(prop)s' to value '%(val)s': %(e)s.")310 dabo.log.error(_("setAfterInterval() failed to set property '%(prop)s' to value '%(val)s': %(e)s.") 311 311 % locals()) 312 312 … … 363 363 pass 364 364 else: 365 dabo. errorLog.write("Incorrect event class (%s) passed to continueEvent. Error: %s"365 dabo.log.error("Incorrect event class (%s) passed to continueEvent. Error: %s" 366 366 % (ustr(evt), ustr(e))) 367 367 … … 375 375 pass 376 376 else: 377 dabo. errorLog.write("Incorrect event class (%s) passed to continueEvent. Error: %s"377 dabo.log.error("Incorrect event class (%s) passed to continueEvent. Error: %s" 378 378 % (ustr(evt), ustr(e))) 379 379 … … 936 936 mm, dd, yy = dt.month, dt.day, dt.year 937 937 except AttributeError: 938 dabo. errorLog.write(_("Invalid date value passed to getDate(): %s") % dt)938 dabo.log.error(_("Invalid date value passed to getDate(): %s") % dt) 939 939 return None 940 940 dlg = wx.lib.calendar.CalenDlg(_getActiveForm(), mm, dd, yy) … … 966 966 if not isinstance(font, dFont): 967 967 # This will help identify older code 968 dabo. errorLog.write("Invalid font class passed to getFont")968 dabo.log.error("Invalid font class passed to getFont") 969 969 return None 970 970 param = font._nativeFont … … 1189 1189 srcFile = utils.resolvePathAndUpdate(srcFile) 1190 1190 except IOError, e: 1191 dabo. errorLog.write(_("Class file '%s' not found") % srcFile)1191 dabo.log.error(_("Class file '%s' not found") % srcFile) 1192 1192 raise 1193 1193 return srcFile, isRawXML … … 1477 1477 return pos 1478 1478 # If we reached here, something's wrong! 1479 dabo. errorLog.write(_("Containing sizer did not match item %s") % obj.Name)1479 dabo.log.error(_("Containing sizer did not match item %s") % obj.Name) 1480 1480 return None 1481 1481 elif isinstance(sz, wx.GridBagSizer): trunk/dabo/ui/uiwx/dDataControlMixin.py
r5918 r5958 87 87 except (TypeError, ValueError), e: 88 88 nm = self._name 89 dabo. errorLog.write(_("Could not set value of %(nm)s to %(val)s. Error message: %(e)s")89 dabo.log.error(_("Could not set value of %(nm)s to %(val)s. Error message: %(e)s") 90 90 % locals()) 91 91 self.flushValue() trunk/dabo/ui/uiwx/dDateTextBox.py
r5842 r5958 233 233 else: 234 234 nm, tv = self.Name, type(val) 235 dabo. errorLog.write(_("Non-date value in %(nm)s: '%(val)s' is type '%(tv)s'") % locals())235 dabo.log.error(_("Non-date value in %(nm)s: '%(val)s' is type '%(tv)s'") % locals()) 236 236 return 237 237 # Default direction … … 335 335 else: 336 336 # This shouldn't happen, because onChar would have filtered it out. 337 dabo. infoLog.write("Warning in dDateTextBox.adjustDate: %s key sent." % key)337 dabo.log.info("Warning in dDateTextBox.adjustDate: %s key sent." % key) 338 338 return 339 339 trunk/dabo/ui/uiwx/dDockForm.py
r4186 r5958 150 150 func() 151 151 else: 152 dabo. errorLog.write(_("Invalid dock position: '%s'.") % side)152 dabo.log.error(_("Invalid dock position: '%s'.") % side) 153 153 inf.Dock() 154 154 self._updateAUI() … … 236 236 self.FloatingBottom = val 237 237 else: 238 dabo. errorLog.write(_("Cannot set the position of a docked panel"))238 dabo.log.error(_("Cannot set the position of a docked panel")) 239 239 else: 240 240 self._properties["Bottom"] = val … … 465 465 self.FloatingHeight = val 466 466 else: 467 dabo. errorLog.write(_("Cannot set the Size of a docked panel"))467 dabo.log.error(_("Cannot set the Size of a docked panel")) 468 468 else: 469 469 self._properties["Height"] = val … … 478 478 self.FloatingLeft = val 479 479 else: 480 dabo. errorLog.write(_("Cannot set the position of a docked panel"))480 dabo.log.error(_("Cannot set the position of a docked panel")) 481 481 else: 482 482 self._properties["Left"] = val … … 534 534 self.FloatingRight = val 535 535 else: 536 dabo. errorLog.write(_("Cannot set the position of a docked panel"))536 dabo.log.error(_("Cannot set the position of a docked panel")) 537 537 else: 538 538 self._properties["Right"] = val … … 651 651 self.FloatingTop = val 652 652 else: 653 dabo. errorLog.write(_("Cannot set the position of a docked panel"))653 dabo.log.error(_("Cannot set the position of a docked panel")) 654 654 else: 655 655 self._properties["Top"] = val … … 686 686 self.FloatingWidth = val 687 687 else: 688 dabo. errorLog.write(_("Cannot set the Size of a docked panel"))688 dabo.log.error(_("Cannot set the Size of a docked panel")) 689 689 else: 690 690 self._properties["Width"] = val … … 837 837 if not ok: 838 838 # This should never happen; if so, log the error 839 dabo. errorLog.write(_("Unmanaged object added to a Dock Form: %s") %evt.child)839 dabo.log.error(_("Unmanaged object added to a Dock Form: %s") %evt.child) 840 840 841 841 trunk/dabo/ui/uiwx/dEditor.py
r5828 r5958 227 227 if ep < stcEndPos: 228 228 posdiff = stcEndPos-ep 229 dabo. errorLog.write(_('warning: on page %(page)s: not enough chars rendered, diff: %(posdiff)s') % locals())229 dabo.log.error(_('warning: on page %(page)s: not enough chars rendered, diff: %(posdiff)s') % locals()) 230 230 return True 231 231 … … 372 372 self._printPreview = wx.PrintPreview(po1, po2, self._printData) 373 373 if not self._printPreview.Ok(): 374 dabo. errorLog.write(_("An error occured while preparing preview."))374 dabo.log.error(_("An error occured while preparing preview.")) 375 375 return 376 376 frame = wx.PreviewFrame(self._printPreview, self.Form, _("Print Preview")) … … 389 389 390 390 if not printer.Print(self.Form, printout): 391 dabo. errorLog.write(_("An error occured while printing."))391 dabo.log.error(_("An error occured while printing.")) 392 392 else: 393 393 self.printData = wx.PrintData(printer.GetPrintDialogData().GetPrintData()) … … 845 845 newSize = int(fontSize) 846 846 except ValueError: 847 dabo. errorLog.write(_("Invalid value passed to changeFontSize: %s") % fontSize)847 dabo.log.error(_("Invalid value passed to changeFontSize: %s") % fontSize) 848 848 return 849 849 else: … … 2143 2143 self._language = val.lower() 2144 2144 else: 2145 dabo. errorLog.write(_("Currently only %s are supported") % ", ".join(LexerDic.keys()))2145 dabo.log.error(_("Currently only %s are supported") % ", ".join(LexerDic.keys())) 2146 2146 self.setDefaults() 2147 2147 self._defaultsSet = True … … 2415 2415 except TypeError, e: 2416 2416 nm = self._name 2417 dabo. errorLog.write(_("Could not set value of %(nm)s to %(val)s. Error message: %(e)s")2417 dabo.log.error(_("Could not set value of %(nm)s to %(val)s. Error message: %(e)s") 2418 2418 % locals()) 2419 2419 self._afterValueChanged() trunk/dabo/ui/uiwx/dFont.py
r5918 r5958 90 90 if not lowVal.startswith("ms shell dlg"): 91 91 # Ignore the non-existent MS Shell Dlg font names; they are Windows aliases 92 dabo. errorLog.write(_("The font '%s' doesn't exist on this system.") % val)92 dabo.log.error(_("The font '%s' doesn't exist on this system.") % val) 93 93 94 94 self._propsChanged() … … 131 131 self._nativeFont.SetPointSize(val) 132 132 except ValueError: 133 dabo. errorLog.write(_("Setting FontSize to %s failed") % val)133 dabo.log.error(_("Setting FontSize to %s failed") % val) 134 134 self._propsChanged() 135 135 trunk/dabo/ui/uiwx/dForm.py
r5955 r5958 440 440 self.update() 441 441 except dException.NoRecordsException, e: 442 dabo. errorLog.write(_("Cancel failed; no records to cancel."))442 dabo.log.error(_("Cancel failed; no records to cancel.")) 443 443 except dException.dException, e: 444 dabo. errorLog.write(_("Cancel failed with response: %s") % e)444 dabo.log.error(_("Cancel failed with response: %s") % e) 445 445 self.notifyUser(ustr(e), title=_("Cancel Not Allowed"), exception=e) 446 446 self.afterCancel() … … 512 512 513 513 except dException.DBQueryException, e: 514 dabo. errorLog.write(_("Database Execution failed with response: %s") % e)514 dabo.log.error(_("Database Execution failed with response: %s") % e) 515 515 self.notifyUser(ustr(e), title=_("Database Action Failed"), severe=True, exception=e) 516 516 self.StatusText = "" 517 517 518 518 except dException.dException, e: 519 dabo. errorLog.write(_("Requery failed with response: %s") % e)519 dabo.log.error(_("Requery failed with response: %s") % e) 520 520 self.notifyUser(ustr(e), title=_("Requery Not Allowed"), severe=True, exception=e) 521 521 self.StatusText = "" … … 565 565 sys.exit() 566 566 except dException.dException, e: 567 dabo. errorLog.write(_("Delete failed with response: %s") % e)567 dabo.log.error(_("Delete failed with response: %s") % e) 568 568 self.notifyUser(ustr(e), title=_("Deletion Not Allowed"), severe=True, exception=e) 569 569 self.afterDelete() … … 599 599 sys.exit() 600 600 except dException.dException, e: 601 dabo. errorLog.write(_("Delete All failed with response: %s") % e)601 dabo.log.error(_("Delete All failed with response: %s") % e) 602 602 self.notifyUser(ustr(e), title=_("Deletion Not Allowed"), severe=True, exception=e) 603 603 self.afterDeleteAll() … … 785 785 # Now that DataSources are not always bizobjs, just return 786 786 ## No bizobj for that DataSource; record the error 787 #dabo. errorLog.write("No business object found for DataSource: '%s', DataField: '%s' "787 #dabo.log.error("No business object found for DataSource: '%s', DataField: '%s' " 788 788 # % (ds, df)) 789 789 return True … … 856 856 self.afterSetPrimaryBizobj() 857 857 else: 858 dabo. infoLog.write(_("bizobj for data source %s does not exist.") % bizOrDataSource)858 dabo.log.info(_("bizobj for data source %s does not exist.") % bizOrDataSource) 859 859 860 860 trunk/dabo/ui/uiwx/dFormMixin.py
r5949 r5958 118 118 self.Connection = None 119 119 if self.Connection is None: 120 dabo. infoLog.write(_("Could not establish connection '%s'") %120 dabo.log.info(_("Could not establish connection '%s'") % 121 121 self._cxnName) 122 122 # If code to create bizobjs is present, run it. … … 576 576 self._objectRegistry[id] = obj 577 577 if hasattr(self, id) or self.__dict__.has_key(id): 578 dabo. errorLog.write(_("RegID '%s' conflicts with existing name") % id)578 dabo.log.error(_("RegID '%s' conflicts with existing name") % id) 579 579 else: 580 580 self.__dict__[id] = obj trunk/dabo/ui/uiwx/dGlWindow.py
r3672 r5958 21 21 except StandardError, e: 22 22 # Report the error, and abandon the import 23 dabo. errorLog.write(_("Error importing OpenGL: %s") % e)23 dabo.log.error(_("Error importing OpenGL: %s") % e) 24 24 openGL = False 25 25 trunk/dabo/ui/uiwx/dGrid.py
r5956 r5958 65 65 # # I'd like to know when kind isn't 0, to make sure I've covered all the 66 66 # # bases. Well okay, it's really because I'm just curious. 67 # dabo. infoLog.write("dGrid.Table.GetAttr:: kind is not 0, it is %s." % kind)67 # dabo.log.info("dGrid.Table.GetAttr:: kind is not 0, it is %s." % kind) 68 68 69 69 ## The column attr object is maintained in dColumn: … … 151 151 except IndexError: 152 152 # Something's odd. Print an error message and move on. 153 dabo. errorLog.write("Unknown data type found in setColumns(): %s"153 dabo.log.error("Unknown data type found in setColumns(): %s" 154 154 % col.DataType) 155 155 col.DataType = ustr(col.DataType) … … 350 350 class GridListEditor(wx.grid.GridCellChoiceEditor): 351 351 def __init__(self, *args, **kwargs): 352 dabo. infoLog.write("GridListEditor: Init ")353 dabo. infoLog.write(ustr(args))354 dabo. infoLog.write(ustr(kwargs))352 dabo.log.info("GridListEditor: Init ") 353 dabo.log.info(ustr(args)) 354 dabo.log.info(ustr(kwargs)) 355 355 super(GridListEditor, self).__init__(*args, **kwargs) 356 356 357 357 358 358 def Create(self, parent, id, evtHandler, *args, **kwargs): 359 dabo. infoLog.write("GridListEditor: Create")360 dabo. infoLog.write(ustr(args))361 dabo. infoLog.write(ustr(kwargs))359 dabo.log.info("GridListEditor: Create") 360 dabo.log.info(ustr(args)) 361 dabo.log.info(ustr(kwargs)) 362 362 self.control = dabo.ui.dDropdownList(parent=parent, id=id, 363 363 ValueMode="String") … … 373 373 374 374 def SetParameters(self, paramStr): 375 dabo. infoLog.write("GridListEditor: SetParameters: %s" % paramStr)375 dabo.log.info("GridListEditor: SetParameters: %s" % paramStr) 376 376 self.control.Choices = eval(paramStr) 377 377 378 378 379 379 def BeginEdit(self, row, col, grid): 380 dabo. infoLog.write("GridListEditor: BeginEdit (%d,%d)" % (row, col))380 dabo.log.info("GridListEditor: BeginEdit (%d,%d)" % (row, col)) 381 381 self.value = grid.GetTable().GetValue(row, col) 382 dabo. infoLog.write("GridListEditor: Value=%s" % self.value)383 dabo. infoLog.write("GridListEditor: Choices=%s" % self.control.Choices)382 dabo.log.info("GridListEditor: Value=%s" % self.value) 383 dabo.log.info("GridListEditor: Choices=%s" % self.control.Choices) 384 384 try: 385 385 self.control.Value = self.value 386 386 except ValueError: 387 dabo. infoLog.write("GridListEditor: Value not in Choices")387 dabo.log.info("GridListEditor: Value not in Choices") 388 388 self.control.SetFocus() 389 389 390 390 391 391 def EndEdit(self, row, col, grid): 392 dabo. infoLog.write("GridListEditor: EndEdit (%d,%d)" % (row, col))392 dabo.log.info("GridListEditor: EndEdit (%d,%d)" % (row, col)) 393 393 changed = False 394 394 v = self.control.Value … … 403 403 404 404 def Reset(self): 405 dabo. infoLog.write("GridListEditor: Reset")405 dabo.log.info("GridListEditor: Reset") 406 406 self.control.Value = self.value 407 407 408 408 # def SetSize(self, rectorig): 409 # dabo. infoLog.write("GridListEditor: SetSize: %s" % rectorig)410 # dabo. infoLog.write("GridListEditor: type of rectorig: %s" % type(rectorig))409 # dabo.log.info("GridListEditor: SetSize: %s" % rectorig) 410 # dabo.log.info("GridListEditor: type of rectorig: %s" % type(rectorig)) 411 411 # # rect = wx.Rect(rectorig) 412 # # dabo. infoLog.write("GridListEditor RECT: %s" % rect)412 # # dabo.log.info("GridListEditor RECT: %s" % rect) 413 413 # super(GridListEditor, self).SetSize(rectorig) 414 414 415 415 def IsAcceptedKey(self, key): 416 dabo. infoLog.write("GridListEditor: check key: %d" % (key))416 dabo.log.info("GridListEditor: check key: %d" % (key)) 417 417 return true 418 418 … … 1995 1995 self.DataSet[row][fld] = val 1996 1996 except StandardError, e: 1997 dabo. errorLog.write("Cannot update data set: %s" % e)1997 dabo.log.error("Cannot update data set: %s" % e) 1998 1998 1999 1999 … … 2050 2050 pyType = biz.getDataTypeForField(df) 2051 2051 except ValueError, e: 2052 dabo. errorLog.write(e)2052 dabo.log.error(e) 2053 2053 return None 2054 2054 return pyType … … 2601 2601 col = self.Columns[col] 2602 2602 else: 2603 dabo. errorLog.write(_("Invalid column number passed to 'showColumn()'."))2603 dabo.log.error(_("Invalid column number passed to 'showColumn()'.")) 2604 2604 return 2605 2605 col._visible = visible … … 3022 3022 ret = True 3023 3023 else: 3024 dabo. errorLog.write(_("Invalid boolean replacement value: %s") % replaceString)3024 dabo.log.error(_("Invalid boolean replacement value: %s") % replaceString) 3025 3025 ret = False 3026 3026 else: … … 3035 3035 ret = True 3036 3036 except errors: 3037 dabo. errorLog.write(_("Invalid replacement value: %s") % replaceString)3037 dabo.log.error(_("Invalid replacement value: %s") % replaceString) 3038 3038 ret = False 3039 3039 if ret: … … 3131 3131 if not inBatch: 3132 3132 # For now, just log it 3133 dabo. infoLog.write(_("Cannot set width of column %s") % col.Order)3133 dabo.log.info(_("Cannot set width of column %s") % col.Order) 3134 3134 return col 3135 3135 trunk/dabo/ui/uiwx/dGridSizer.py
r5941 r5958 380 380 if rowspan > 1: 381 381 if not self._clearCells(obj, rowspan, "row"): 382 dabo. errorLog.write("Cannot set RowSpan for %s; remove objects in the way first." % itm.Name)382 dabo.log.error("Cannot set RowSpan for %s; remove objects in the way first." % itm.Name) 383 383 return 384 384 self.setGridSpan(obj, row=rowspan) … … 389 389 if colspan > 1: 390 390 if not self._clearCells(obj, colspan, "col"): 391 dabo. errorLog.write("Cannot set ColSpan for %s; remove objects in the way first." % itm.Name)391 dabo.log.error("Cannot set ColSpan for %s; remove objects in the way first." % itm.Name) 392 392 return 393 393 self.setGridSpan(obj, col=colspan) trunk/dabo/ui/uiwx/dImage.py
r5841 r5958 228 228 maxIdx = self.FrameCount - 1 229 229 if idx > maxIdx: 230 dabo. errorLog.write(_("Attempt to set PictureIndex (%(idx)s)to a value greater than the maximum index available (%(maxIdx)s).") % locals())230 dabo.log.error(_("Attempt to set PictureIndex (%(idx)s)to a value greater than the maximum index available (%(maxIdx)s).") % locals()) 231 231 idx = self.PictureIndex = maxIdx 232 232 try: … … 269 269 self._showPic() 270 270 except KeyError: 271 dabo. errorLog.write(_("ScaleMode must be either 'Clip', 'Proportional' or 'Stretch'.") )271 dabo.log.error(_("ScaleMode must be either 'Clip', 'Proportional' or 'Stretch'.") ) 272 272 273 273 trunk/dabo/ui/uiwx/dLinePlot.py
r5919 r5958 9 9 except StandardError, e: 10 10 # Report the error, and abandon the import 11 dabo. errorLog.write(_("Error importing numpy.oldnumeric: %s") % e)11 dabo.log.error(_("Error importing numpy.oldnumeric: %s") % e) 12 12 _Numeric = False 13 13 trunk/dabo/ui/uiwx/dListControl.py
r5953 r5958 112 112 self.SetItemState(row, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED) 113 113 else: 114 dabo. errorLog.write("An attempt was made to select a non-existent row")114 dabo.log.error("An attempt was made to select a non-existent row") 115 115 116 116 … … 139 139 self.select(row) 140 140 else: 141 dabo. errorLog.write("'selectAll()' may only be called on List Controls that designated as MultipleSelect")141 dabo.log.error("'selectAll()' may only be called on List Controls that designated as MultipleSelect") 142 142 143 143 … … 255 255 self._restoreRowSelection(row) 256 256 else: 257 dabo. errorLog.write("An attempt was made to remove a non-existent row")257 dabo.log.error("An attempt was made to remove a non-existent row") 258 258 259 259 trunk/dabo/ui/uiwx/dMaskedTextBox.py
r5304 r5958 113 113 self._format = val 114 114 except AttributeError: 115 dabo. errorLog.write(_("Invalid Format value: %s") % val)115 dabo.log.error(_("Invalid Format value: %s") % val) 116 116 else: 117 117 self._properties["Format"] = val … … 125 125 if self.GetAutoformat() and val: 126 126 # Cannot have both a mask and a format 127 dabo. errorLog.write(_("Cannot set InputCodes when a Format has been set"))127 dabo.log.error(_("Cannot set InputCodes when a Format has been set")) 128 128 elif [cd for cd in val if cd not in self._allowedInputCodes]: 129 129 # Illegal codes 130 130 bad = "".join([cd for cd in val if cd not in self._allowedInputCodes]) 131 dabo. errorLog.write(_("Invalid InputCodes: %s") % bad)131 dabo.log.error(_("Invalid InputCodes: %s") % bad) 132 132 else: 133 133 val = self._uniqueCodes(val) … … 145 145 if self.GetAutoformat() and val: 146 146 # Cannot have both a mask and a format 147 dabo. errorLog.write(_("Cannot set a Mask when a Format has been set"))147 dabo.log.error(_("Cannot set a Mask when a Format has been set")) 148 148 else: 149 149 self._mask = val trunk/dabo/ui/uiwx/dPageFrame.py
r5919 r5958 133 133 # Changed this to write to the info log to avoid error messages that 134 134 # unnecessarily exaggerate the problem. 135 dabo. infoLog.write(_("ListSpacing is not supported in wxPython %s") % wx.__version__)135 dabo.log.info(_("ListSpacing is not supported in wxPython %s") % wx.__version__) 136 136 else: 137 137 self._properties["ListSpacing"] = val trunk/dabo/ui/uiwx/dPemMixin.py
r5934 r5958 457 457 # Log it and continue 458 458 nm = self.Name 459 dabo. errorLog.write(_("Empty Event Binding: Object: %(nm)s; Event: %(evt)s") % locals())459 dabo.log.error(_("Empty Event Binding: Object: %(nm)s; Event: %(evt)s") % locals()) 460 460 continue 461 461 try: 462 462 mthd = eval(mthdString) 463 463 except (AttributeError, NameError), e: 464 dabo. errorLog.write(_("Could not evaluate method '%(mthdString)s': %(e)s") % locals())464 dabo.log.error(_("Could not evaluate method '%(mthdString)s': %(e)s") % locals()) 465 465 continue 466 466 self.bindEvent(evt, mthd) … … 878 878 # Too many 'unlockDisplay' calls to the same object were made. Log 879 879 # the mistake, but don't throw a Python error. 880 dabo. errorLog.write(_("Extra call to unlockDisplay() for object %s") % self)880 dabo.log.error(_("Extra call to unlockDisplay() for object %s") % self) 881 881 882 882 … … 899 899 # since it is most likely deleted, but the presence of these messages 900 900 # will ensure that possible problems will not be silenced. 901 dabo. errorLog.write(_("Failed to unlock display: %s") % e)901 dabo.log.error(_("Failed to unlock display: %s") % e) 902 902 release = __del__ 903 903 return DisplayLocker(self) … … 2009 2009 self.SetFont(val._nativeFont) 2010 2010 except AttributeError: 2011 dabo. errorLog.write(_("Error setting font for %s") % self.Name)2011 dabo.log.error(_("Error setting font for %s") % self.Name) 2012 2012 val.bindEvent(dabo.dEvents.FontPropertiesChanged, self._onFontPropsChanged) 2013 2013 else: … … 2249 2249 crsName = eval("uic.%s%s" % (prfx, valTitle)) 2250 2250 except AttributeError: 2251 dabo. errorLog.write(_("Invalid MousePointer value: '%s'") % val)2251 dabo.log.error(_("Invalid MousePointer value: '%s'") % val) 2252 2252 return 2253 2253 crs = uic.getStockCursor(crsName) … … 2419 2419 except KeyError: 2420 2420 err = _("Attempt in object '%(self)s' to set duplicate RegID: '%(val)s'") % locals() 2421 dabo. errorLog.write(err)2421 dabo.log.error(err) 2422 2422 raise KeyError(err) 2423 2423 … … 2572 2572 return self.IsShown() 2573 2573 except AttributeError: 2574 dabo. errorLog.write(_("The object %s does not support the Visible property.") % self)2574 dabo.log.error(_("The object %s does not support the Visible property.") % self) 2575 2575 return None 2576 2576 … … 2580 2580 self.Show(bool(val)) 2581 2581 except AttributeError: 2582 dabo. errorLog.write(_("The object %s does not support the Visible property.") % self)2582 dabo.log.error(_("The object %s does not support the Visible property.") % self) 2583 2583 else: 2584 2584 self._properties["Visible"] = val trunk/dabo/ui/uiwx/dRadioList.py
r5860 r5958 248 248 self._items[idx].Enabled = val 249 249 except IndexError: 250 dabo. errorLog.write(_("Could not find a button with Caption of '%s'") % itm)250 dabo.log.error(_("Could not find a button with Caption of '%s'") % itm) 251 251 252 252 trunk/dabo/ui/uiwx/dRichTextBox.py
r5923 r5958 66 66 handler = self._xmlHandler 67 67 filename = "%s.xml" % filename 68 dabo. infoLog.write(_("Forcing to RichText XML format"))68 dabo.log.info(_("Forcing to RichText XML format")) 69 69 handler.SaveFile(self.GetBuffer(), filename) 70 70 trunk/dabo/ui/uiwx/dSizerMixin.py
r5906 r5958 303 303 return pos 304 304 # If we reached here, something's wrong! 305 dabo. errorLog.write(_("Containing sizer did not match item %s") % self.Name)305 dabo.log.error(_("Containing sizer did not match item %s") % self.Name) 306 306 return None 307 307 elif isinstance(sz, wx.GridBagSizer): trunk/dabo/ui/uiwx/dSlidePanelControl.py
r5896 r5958 195 195 if val.lower().strip() not in self._barStylesLow: 196 196 bs = ", ".join(self._barStyles) 197 dabo. errorLog.write(_("Unknown BarStyle passed: %(val)s. BarStyle must be one of: %(bs)s")197 dabo.log.error(_("Unknown BarStyle passed: %(val)s. BarStyle must be one of: %(bs)s") 198 198 % locals()) 199 199 else: trunk/dabo/ui/uiwx/dSlider.py
r5780 r5958 110 110 isHoriz = (val.lower()[:1] == "h") 111 111 if isHoriz and tickpos in ("Left", "Right"): 112 dabo. errorLog.write(_("Cannot set the slider to Horizontal when TickPosition is %s.") % tickpos)112 dabo.log.error(_("Cannot set the slider to Horizontal when TickPosition is %s.") % tickpos) 113 113 elif not isHoriz and tickpos in ("Top", "Bottom"): 114 dabo. errorLog.write(_("Cannot set the slider to Vertical when TickPosition is %s.") % tickpos)114 dabo.log.error(_("Cannot set the slider to Vertical when TickPosition is %s.") % tickpos) 115 115 self._delWindowStyleFlag(wx.SL_HORIZONTAL) 116 116 self._delWindowStyleFlag(wx.SL_VERTICAL) trunk/dabo/ui/uiwx/dSpinner.py
r5919 r5958 351 351 numVal = self._numericStringVal(val) 352 352 if numVal is None: 353 dabo. errorLog.write(_("Spinner values must be numeric. Invalid:'%s'") % val)353 dabo.log.error(_("Spinner values must be numeric. Invalid:'%s'") % val) 354 354 else: 355 355 self._proxy_textbox.Value = val trunk/dabo/ui/uiwx/dTextBoxMixin.py
r5919 r5958 719 719 #PVG: maskedtextedit sometimes fails, on value error..allow the code to continue 720 720 uStrVal = self.Application.str2Unicode(strVal) 721 dabo. errorLog.write(_("Error setting value to '%(uStrVal)s: %(e)s") % locals())721 dabo.log.error(_("Error setting value to '%(uStrVal)s: %(e)s") % locals()) 722 722 723 723 if type(_oldVal) != type(val) or _oldVal != val: trunk/dabo/ui/uiwx/uiApp.py
r5942 r5958 135 135 elif wx.PlatformInfo[0] == "__WXMSW__": 136 136 self._platform = _("Win") 137 dabo. infoLog.write(txt)137 dabo.log.info(txt) 138 138 self.Bind(wx.EVT_ACTIVATE_APP, self._onWxActivate) 139 139 self.Bind(wx.EVT_KEY_DOWN, self._onWxKeyDown) … … 289 289 success = self.dApp._updateFramework() 290 290 except IOError, e: 291 dabo. errorLog.write(_("Cannot update files; Error: %s") % e)291 dabo.log.error(_("Cannot update files; Error: %s") % e) 292 292 dabo.ui.info(_("You do not have permission to update the necessary files. " 293 293 "Please re-run the app with administrator privileges."), title=_("Permission Denied")) … … 771 771 pass 772 772 else: 773 dabo. infoLog.write(_("Stub: dApp.onEditPreferences()"))773 dabo.log.info(_("Stub: dApp.onEditPreferences()")) 774 774 775 775 … … 782 782 win.Undo() 783 783 except AttributeError: 784 dabo. errorLog.write(_("No apparent way to undo."))784 dabo.log.error(_("No apparent way to undo.")) 785 785 786 786 … … 793 793 win.Redo() 794 794 except AttributeError: 795 dabo. errorLog.write(_("No apparent way to redo."))795 dabo.log.error(_("No apparent way to redo.")) 796 796 797 797 … … 1010 1010 value = None 1011 1011 if not isinstance(value, basestring): 1012 dabo. errorLog.write(_("Active control isn't text-based."))1012 dabo.log.error(_("Active control isn't text-based.")) 1013 1013 return 1014 1014 … … 1045 1045 win.ShowPosition(win.GetSelection()[1]) 1046 1046 else: 1047 dabo. infoLog.write(_("Not found"))1047 dabo.log.info(_("Not found")) 1048 1048 return ret 1049 1049 … … 1143 1143 pth = frm._sourceFilePath 1144 1144 except AttributeError: 1145 dabo. errorLog.write(_("Only .cdxml forms can be re-loaded"))1145 dabo.log.error(_("Only .cdxml forms can be re-loaded")) 1146 1146 return 1147 1147 self.dApp.resyncFiles()
