dabo Commit
Revision 4966
Date: 2009-01-25 13:03:57 -0800 (Sun, 25 Jan 2009)
Author: Cito
Trac: http://trac.dabodev.com/changeset/4966
Changed:
U trunk/dabo/biz/dBizobj.py
U trunk/dabo/dApp.py
U trunk/dabo/lib/RemoteConnector.py
U trunk/dabo/lib/autosuper/setup.py
Log:
Remove the now unnecessary tarcets in the except clauses as well.
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2009-01-25 20:41:01 UTC (rev 4965)
+++ trunk/dabo/biz/dBizobj.py 2009-01-25 21:03:57 UTC (rev 4966)
@@ -272,7 +272,7 @@
def beginTransaction(self):
"""Attempts to begin a transaction at the database level, and
returns
- True/False depending on its success.
+ True/False depending on its success.
"""
rp = self._RemoteProxy
if rp:
@@ -285,7 +285,7 @@
def commitTransaction(self):
"""Attempts to commit a transaction at the database level, and
returns
- True/False depending on its success.
+ True/False depending on its success.
"""
rp = self._RemoteProxy
if rp:
@@ -298,7 +298,7 @@
def rollbackTransaction(self):
"""Attempts to rollback a transaction at the database level,
and returns
- True/False depending on its success.
+ True/False depending on its success.
"""
rp = self._RemoteProxy
if rp:
@@ -310,7 +310,7 @@
def _getTransactionToken(self):
- """Ask the Application for the transaction token. If the token
is granted,
+ """Ask the Application for the transaction token. If the token
is granted,
then this bizobj has the ability to begin and end transactions.
"""
try:
@@ -323,7 +323,7 @@
def _hasTransactionToken(self):
- """Returns True/False, depending on whether this bizobj
+ """Returns True/False, depending on whether this bizobj
currently "holds" the transaction token.
"""
try:
@@ -334,7 +334,7 @@
def _releaseTransactionToken(self):
- """Ask the Application to give up the transaction token. Once
this is done,
+ """Ask the Application to give up the transaction token. Once
this is done,
other bizobjs can receive the token to begin and end
transactions.
"""
try:
@@ -359,17 +359,17 @@
if startTransaction:
self.commitTransaction()
- except dException.ConnectionLostException, e:
+ except dException.ConnectionLostException:
self.RowNumber = current_row
raise
- except dException.DBQueryException, e:
+ except dException.DBQueryException:
# Something failed; reset things.
if startTransaction:
self.rollbackTransaction()
# Pass the exception to the UI
self.RowNumber = current_row
raise
- except dException.dException, e:
+ except dException.dException:
if startTransaction:
self.rollbackTransaction()
self.RowNumber = current_row
@@ -434,14 +434,14 @@
except dException.NoRecordsException, e:
raise
- except dException.DBQueryException, e:
+ except dException.DBQueryException:
# Something failed; reset things.
if startTransaction:
self.rollbackTransaction()
# Pass the exception to the UI
raise
- except dException.dException, e:
+ except dException.dException:
# Something failed; reset things.
if startTransaction:
self.rollbackTransaction()
@@ -499,11 +499,11 @@
if startTransaction:
self.commitTransaction()
- except dException.DBQueryException, e:
+ except dException.DBQueryException:
if startTransaction:
self.rollbackTransaction()
raise
- except StandardError, e:
+ except StandardError:
if startTransaction:
self.rollbackTransaction()
raise
@@ -555,11 +555,11 @@
self.afterPointerMove()
self.afterChange()
self.afterDelete()
- except dException.DBQueryException, e:
+ except dException.DBQueryException:
if startTransaction:
self.rollbackTransaction()
raise
- except StandardError, e:
+ except StandardError:
if startTransaction:
self.rollbackTransaction()
raise
@@ -582,11 +582,11 @@
self.afterPointerMove()
self.afterChange()
self.afterDelete()
- except dException.DBQueryException, e:
+ except dException.DBQueryException:
if startTransaction:
self.rollbackTransaction()
raise
- except StandardError, e:
+ except StandardError:
if startTransaction:
self.rollbackTransaction()
raise
@@ -611,7 +611,7 @@
def getDataDiff(self, allRows=False):
"""Get a dict that is keyed on the hash value of this bizobj,
with the value
being a list of record changes. Default behavior is to only
consider the
- current row; you can change that by passing allRows=True. Each
changed
+ current row; you can change that by passing allRows=True. Each
changed
row will be present in the diff, with its PK and any columns
whose values
have changed. If there are any related child bizobjs, their
diffs will be
added to the dict under the key 'children' so that they can be
processed
@@ -902,7 +902,7 @@
""" If this is a child bizobj, its record set is dependent on
its parent's
current PK value. This will add the appropriate WHERE clause to
filter the child records. If the parent is a new, unsaved
record, or if
- there is no parent record, there cannot be any child records
saved yet,
+ there is no parent record, there cannot be any child records
saved yet,
so an empty query is built.
"""
currWhere = self.getWhereClause()
@@ -1354,7 +1354,7 @@
def getParentPK(self):
- """ Return the value of the parent bizobjs' PK field.
Alternatively,
+ """ Return the value of the parent bizobjs' PK field.
Alternatively,
user code can just call self.Parent.getPK().
"""
try:
@@ -1373,13 +1373,13 @@
def changeRowNumCallback(row):
# dCursorMixin is requesting a rowchange, which we must
do here so that
# child bizobjs get requeried. This is especially
important (and only
- # currenty happens) for virtual fields, in case they
rely on values
+ # currenty happens) for virtual fields, in case they
rely on values
# gotten from children.
self._moveToRowNum(row)
for ch in self.__children:
if ch.RowCount == 0:
ch.requery()
-
+
if cursor is not None:
try:
ret = cursor.getFieldVal(fld, row,
_rowChangeCallback=changeRowNumCallback)
@@ -1417,8 +1417,8 @@
except dException.NoRecordsException:
ret = False
return ret
-
+
_baseXML = """<?xml version="1.0" encoding="%s"?>
<dabocursor xmlns="http://www.dabodev.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -1443,7 +1443,7 @@
def dataToXML(self):
"""Returns XML representing the data set. If there are child
bizobjs,
- the data for the related child records will be nested inside of
the
+ the data for the related child records will be nested inside of
the
parent record; this nesting can go as many levels deep as there
are
child/grandchild/etc. bizobjs.
"""
@@ -1465,7 +1465,7 @@
if rows is None:
self.scan(self._xmlForRow, level=level+1,
callback=addToBody)
else:
- self.scanRows(self._xmlForRow, self.RowNumber,
level=level+1,
+ self.scanRows(self._xmlForRow, self.RowNumber,
level=level+1,
callback=addToBody)
return self._xmlBody
@@ -1557,7 +1557,7 @@
def getDataTypeForField(self, fld):
- """Given a field name, returns its Python type, or None if no
+ """Given a field name, returns its Python type, or None if no
DataStructure information is available.
"""
ds = self.getDataStructure()
@@ -1632,7 +1632,7 @@
def getWordMatchFormat(self):
- """Returns the backend's SQL format for creating queries that
are based
+ """Returns the backend's SQL format for creating queries that
are based
on matching words in a given column.
"""
return self._CurrentCursor.getWordMatchFormat()
@@ -1702,7 +1702,7 @@
return self._CurrentCursor.setWhereClause(clause)
def prepareWhere(self, clause):
"""Calls the backend's pre-processing routine for improving
efficiency
- of filter expressions. If the backend does not have this
capability,
+ of filter expressions. If the backend does not have this
capability,
nothing is done.
"""
return self._CurrentCursor.prepareWhere(clause)
@@ -1758,19 +1758,19 @@
beforeNext = _makeHookMethod("beforeNext", "navigating to the next
record")
beforeFirst = _makeHookMethod("beforeFirst", "navigating to the next
record")
beforeLast = _makeHookMethod("beforeLast", "navigating to the last
record")
- beforePointerMove = _makeHookMethod("beforePointerMove",
+ beforePointerMove = _makeHookMethod("beforePointerMove",
"the record pointer moves")
- beforeDeleteAllChildren = _makeHookMethod("beforeDeleteAllChildren",
+ beforeDeleteAllChildren = _makeHookMethod("beforeDeleteAllChildren",
"all child records are deleted")
- beforeSetRowNumber = _makeHookMethod("beforeSetRowNumber",
+ beforeSetRowNumber = _makeHookMethod("beforeSetRowNumber",
"the RowNumber property is set")
beforeSave = _makeHookMethod("beforeSave", "the changed records are
saved.")
- beforeCancel = _makeHookMethod("beforeCancel",
+ beforeCancel = _makeHookMethod("beforeCancel",
"the changed records are canceled.")
beforeRequery = _makeHookMethod("beforeRequery", "the cursor is
requeried")
beforeChildRequery = _makeHookMethod("beforeChildRequery",
"the child bizobjs are requeried")
- beforeCreateCursor = _makeHookMethod("beforeCreateCursor",
+ beforeCreateCursor = _makeHookMethod("beforeCreateCursor",
"the underlying cursor object is created")
@@ -1789,14 +1789,14 @@
afterNext = _makeHookMethod("afterNext", "navigating to the next
record")
afterFirst = _makeHookMethod("afterFirst", "navigating to the next
record")
afterLast = _makeHookMethod("afterLast", "navigating to the last
record")
- afterPointerMove = _makeHookMethod("afterPointerMove",
+ afterPointerMove = _makeHookMethod("afterPointerMove",
"the record pointer moves")
- afterDeleteAllChildren = _makeHookMethod("afterDeleteAllChildren",
+ afterDeleteAllChildren = _makeHookMethod("afterDeleteAllChildren",
"all child records are deleted")
- afterSetRowNumber = _makeHookMethod("afterSetRowNumber",
+ afterSetRowNumber = _makeHookMethod("afterSetRowNumber",
"the RowNumber property is set")
afterSave = _makeHookMethod("afterSave", "the changed records are
saved.")
- afterCancel = _makeHookMethod("afterCancel",
+ afterCancel = _makeHookMethod("afterCancel",
"the changed records are canceled.")
afterRequery = _makeHookMethod("afterRequery", "the cursor is
requeried")
afterChildRequery = _makeHookMethod("afterChildRequery",
@@ -1804,8 +1804,8 @@
afterChange = _makeHookMethod("afterChange", "a record is changed",
additionalDoc=\
"""This hook will be called after a successful save() or delete(). Contrast
-with the afterSave() hook which only gets called after a save(), and the
-afterDelete() which is only called after a delete().""")
+with the afterSave() hook which only gets called after a save(), and the
+afterDelete() which is only called after a delete().""")
def afterCreateCursor(self, crs):
@@ -1821,8 +1821,8 @@
"""
for crs in self.__cursors.values():
self._syncCursorProps(crs)
-
-
+
+
def _syncCursorProps(self, crs):
"""This method ensures that the passed cursor's properties
are in sync with this bizobj.
@@ -1841,9 +1841,9 @@
def _cursorDictReference(self):
- """In rare situations, bizobj subclasses may need to reference
the
- internal __cursors attribute. This provides a way to do that,
but
- it should be stressed that this is potentially dangerous and
could
+ """In rare situations, bizobj subclasses may need to reference
the
+ internal __cursors attribute. This provides a way to do that,
but
+ it should be stressed that this is potentially dangerous and
could
lead to lost data if not handled correctly.
"""
return self.__cursors
@@ -2236,7 +2236,7 @@
_("The friendly title of the cursor, used in messages
to the end user. (str)"))
ChildCacheInterval = property(_getChildCacheInterval,
_setChildCacheInterval, None,
- _("""If this is a child bizobj, this represents the
length of time in seconds that a
+ _("""If this is a child bizobj, this represents the
length of time in seconds that a
subsequent requery request will be ignored. (int)"""))
CurrentSQL = property(_getCurrentSQL, None, None,
@@ -2311,7 +2311,7 @@
columns by referring to 'self.Record.fieldName'
(read-only) (no type)"""))
_RemoteProxy = property(_getRemoteProxy, None, None,
- _("""If this bizobj is being run remotely, returns a
reference to the RemoteConnector
+ _("""If this bizobj is being run remotely, returns a
reference to the RemoteConnector
object that will handle communication with the server.
(read-only) (RemoteConnector)"""))
RequeryChildOnSave = property(_getRequeryChildOnSave,
_setRequeryChildOnSave, None,
Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py 2009-01-25 20:41:01 UTC (rev 4965)
+++ trunk/dabo/dApp.py 2009-01-25 21:03:57 UTC (rev 4966)
@@ -38,8 +38,8 @@
def add(self, objRef):
"""Add the object reference to the collection."""
self.append(objRef)
-
+
def remove(self, objRef):
"""Delete the object reference from the collection."""
try:
@@ -52,7 +52,7 @@
class TempFileHolder(object):
- """Utility class to get temporary file names and to make sure they are
+ """Utility class to get temporary file names and to make sure they are
deleted when the Python session ends.
"""
def __init__(self):
@@ -61,8 +61,8 @@
def __del__(self):
self._eraseTempFiles()
-
-
+
+
def _eraseTempFiles(self):
# Try to erase all temp files created during life.
# Need to re-import the os module here for some reason.
@@ -80,10 +80,10 @@
except StandardError, e:
# In these rare cases, Python has already 'gone away',
so just bail
pass
-
-
+
+
def release(self):
- self._eraseTempFiles()
+ self._eraseTempFiles()
def append(self, f):
@@ -127,13 +127,13 @@
Normally, dApp gets instantiated from the client app's main Python
script,
and lives through the life of the application.
- -- set up an empty data connections object which holds
- -- connectInfo objects connected to pretty names. If there
+ -- set up an empty data connections object which holds
+ -- connectInfo objects connected to pretty names. If there
-- is a file named 'default.cnxml' present, it will import the
-- connection definitions contained in that. If no file of that
-- name exists, it will import any .cnxml file it finds. If
there
-- are no such files, it will then revert to the old behavior
- -- of importing a file in the current directory called
+ -- of importing a file in the current directory called
-- 'dbConnectionDefs.py', which contains connection
-- definitions in python code format instead of XML.
@@ -143,8 +143,8 @@
-- decide which ui to use (wx) and gets that ball rolling
- -- look for a MainForm in an expected place, otherwise use
default dabo
- -- dMainForm, and instantiate that.
+ -- look for a MainForm in an expected place, otherwise use
default dabo
+ -- dMainForm, and instantiate that.
-- maintain a forms collection and provide interfaces for
-- opening dForms, closing them, and iterating through them.
@@ -156,11 +156,11 @@
"""
_call_beforeInit, _call_afterInit, _call_initProperties = False, False,
True
# Behaviors which are normal in the framework may need to
- # be modified when run as the Designer. This flag will
+ # be modified when run as the Designer. This flag will
# distinguish between the two states.
isDesigner = False
-
+
def __init__(self, selfStart=False, properties=None, *args, **kwargs):
if dabo.settings.loadUserLocale:
locale.setlocale(locale.LC_ALL, '')
@@ -168,7 +168,7 @@
self._uiAlreadySet = False
dabo.dAppRef = self
self._beforeInit()
-
+
# If we are displaying a splash screen, these attributes control
# its appearance. Extract them before the super call.
self.showSplashScreen = self._extractKey(kwargs,
"showSplashScreen", False)
@@ -177,7 +177,7 @@
self.splashImage = self._extractKey(kwargs, "splashImage", img)
self.splashMaskColor = self._extractKey(kwargs,
"splashMaskColor", None)
self.splashTimeout = self._extractKey(kwargs, "splashTimeout",
5000)
-
+
super(dApp, self).__init__(properties, *args, **kwargs)
# egl: added the option of keeping the main form hidden
# initially. The default behavior is for it to be shown, as
usual.
@@ -192,7 +192,7 @@
self.getTempFile = self._tempFileHolder.getTempFile
# Create the framework-level preference manager
self._frameworkPrefs = dabo.dPref(key="dabo_framework")
- # Hold a reference to the bizobj and connection, if any,
controlling
+ # Hold a reference to the bizobj and connection, if any,
controlling
# the current database transaction
self._transactionTokens = {}
# Holds update check times in case of errors.
@@ -221,12 +221,12 @@
"dabodemo": "demo"}
# List of form classes to open on App Startup
- self.formsToOpen = []
+ self.formsToOpen = []
# Form to open if no forms were passed as a parameter
self.default_form = None
# Dict of "Last-Modified" values for dynamic web resources
self._sourceLastModified = {}
-
+
# For simple UI apps, this allows the app object to be created
# and started in one step. It also suppresses the display of
# the main form.
@@ -275,14 +275,14 @@
def __del__(self):
"""Make sure that temp files are removed"""
self._tempFileHolder.release()
-
+
def setup(self, initUI=True):
"""Set up the application object."""
# dabo is going to want to import various things from the Home
Directory
if self.HomeDirectory not in sys.path:
sys.path.append(self.HomeDirectory)
-
+
def initAppInfo(item, default):
if not self.getAppInfo(item):
self.setAppInfo(item, default)
@@ -330,8 +330,8 @@
def startupForms(self):
- """Open one or more of the defined forms. The default one is
specified
- in .default_form. If form names were passed on the command
line,
+ """Open one or more of the defined forms. The default one is
specified
+ in .default_form. If form names were passed on the command line,
they will be opened instead of the default one as long as they
exist.
"""
form_names = [class_name[3:] for class_name in dir(self.ui) if
class_name[:3] == "Frm"]
@@ -346,7 +346,7 @@
frm(self.MainForm).show()
def initUIApp(self):
- """Callback from the initial app setup. Used to allow the
+ """Callback from the initial app setup. Used to allow the
splash screen, if any, to be shown quickly.
"""
self.uiApp.setup()
@@ -362,21 +362,21 @@
self._finished = False
if (not self.SecurityManager or not
self.SecurityManager.RequireAppLogin
or self.SecurityManager.login()):
-
+
userName = self.getUserCaption()
if userName:
userName = " (%s)" % userName
else:
userName = ""
-
+
self._retrieveMRUs()
self.uiApp.start(self)
if not self._finished:
self.finish()
-
-
+
+
def finish(self):
- """Called when the application event loop has ended. You may
also
+ """Called when the application event loop has ended. You may
also
call this explicitly to exit the application event loop.
"""
self.uiApp.exit()
@@ -390,16 +390,16 @@
def afterFinish(self):
- """Stub method. When this is called, the app has already
terminated, and you have
+ """Stub method. When this is called, the app has already
terminated, and you have
one last chance to execute code by overriding this method.
"""
pass
def _setProjInfo(self):
- """Create a 2-tuple containing the project location and project
name, if any.
+ """Create a 2-tuple containing the project location and project
name, if any.
The location is always the directory containing the initial
startup program; the
- name is either None (default), or, if this is a Web Update-able
app, the
+ name is either None (default), or, if this is a Web Update-able
app, the
descriptive name.
"""
relpth = inspect.stack()[-1][1]
@@ -417,8 +417,8 @@
if "wizards" in pth:
nm ="Wizards"
self._projectInfo = (pth, nm)
-
-
+
+
def getLoginInfo(self, message=None):
"""Return a tuple of (user, password) to
dSecurityManager.login(). The default is to display the standard login dialog,
and return the user/password as entered by the user, but subclasses can
override to get the information from whereever is appropriate. You can
customize the default dialog by adding your own code to the loginDialogHook()
method, which will receive a reference to the login dialog.
@@ -432,23 +432,23 @@
ld.show()
user, password = ld.user, ld.password
return user, password
-
-
+
+
def loginDialogHook(self, dlg):
"""Hook method; modify the dialog as needed."""
pass
-
-
+
+
def _persistMRU(self):
"""Persist any MRU lists to disk."""
base = "MRU.%s" % self.getAppInfo("appName")
- self.deleteAllUserSettings(base)
+ self.deleteAllUserSettings(base)
for cap in self._persistentMRUs.keys():
mruList = self.uiApp.getMRUListForMenu(cap)
setName = ".".join((base, cap))
self.setUserSetting(setName, mruList)
-
-
+
+
def _retrieveMRUs(self):
"""Retrieve any saved MRU lists."""
base = "MRU.%s" % self.getAppInfo("appName")
@@ -458,8 +458,8 @@
# Should be a list of items. Add 'em in reverse
order
for itm in itms:
self.uiApp.addToMRU(cap, itm, fcn)
-
+
def getAppInfo(self, item):
"""Look up the item, and return the value."""
try:
@@ -486,10 +486,10 @@
else:
ret = self.PreferenceManager.getValue("current_version")
if ret is None:
- ret = 0
+ ret = 0
return ret
-
+
def _resetWebUpdateCheck(self):
"""Sets the time that Web Update was last checked to the passed
value. Used
in cases where errors prevent an update from succeeding.
@@ -500,7 +500,7 @@
def checkForUpdates(self, evt=None):
"""Public interface to the web updates mechanism. Returns a
2-tuple
- consisting of a boolean and a list of projects available for
update. The boolean
+ consisting of a boolean and a list of projects available for
update. The boolean
indicates whether this is the first time that the framework is
being run and the list
contains the updatable project names; e.g., if both project
'Foo' and the framework
have updates, it will return ["Dabo", "Foo"]; if only the
framework has updates, it will
@@ -587,7 +587,7 @@
def _updateFramework(self, projNames=None):
- """Get any changed files from the dabodev.com server, and
replace
+ """Get any changed files from the dabodev.com server, and
replace
the local copies with them. Return the new revision number"""
fileurl =
"http://dabodev.com/frameworkVersions/changedFiles/%s/%s"
if projNames is None:
@@ -643,10 +643,10 @@
if vers:
self.PreferenceManager.setValue("current_version", vers)
return vers
-
+
def _setWebUpdate(self, auto, interval=None):
- """Sets the web update settings for the entire framework. If
set to True, the
+ """Sets the web update settings for the entire framework. If
set to True, the
interval is expected to be in minutes between checks.
"""
prf = self._frameworkPrefs
@@ -656,8 +656,8 @@
# They want it checked every time
interval = 0
prf.setValue("update_interval", interval)
-
-
+
+
def getWebUpdateInfo(self):
"""Returns a 2-tuple that reflects the current settings for web
updates.
The first position is a boolean that reflects whether
auto-checking is turned
@@ -669,8 +669,8 @@
def urlFetch(self, pth, errorOnNotFound=False):
"""Fetches the specified resource from the internet using the
SourceURL value
as the base for the resource URL. If a newer version is found,
the local copy
- is updated with the retrieved resource. If the resource isn't
found, nothing
- happens by default. If you want the error to be raised, pass
True for the
+ is updated with the retrieved resource. If the resource isn't
found, nothing
+ happens by default. If you want the error to be raised, pass
True for the
parameter 'errorOnNotFound'.
"""
base = self.SourceURL
@@ -679,7 +679,7 @@
return
u2 = urllib2
# os.path.join works great for this; just make sure that any
Windows
- # paths are converted to forward slashes, and that the
+ # paths are converted to forward slashes, and that the
# pth value doesn't begin with a slash
pth = pth.lstrip(os.path.sep)
urlparts = base.split(os.path.sep) + pth.split(os.path.sep)
@@ -745,13 +745,13 @@
def getUserSettingKeys(self, spec):
"""Return a list of all keys underneath <spec> in the user
settings table.
-
+
For example, if spec is "appWizard.dbDefaults", and there are
userSettings entries for:
appWizard.dbDefaults.pkm.Host
appWizard.dbDefaults.pkm.User
appWizard.dbDefaults.egl.Host
-
+
The return value would be ["pkm", "egl"]
"""
usp = self.UserSettingProvider
@@ -773,8 +773,8 @@
usp = self.UserSettingProvider
if usp:
usp.setUserSetting(item, value)
-
-
+
+
def setUserSettings(self, setDict):
"""Convenience method for setting several settings with one
call. Pass a dict containing {settingName: settingValue} pairs.
@@ -782,22 +782,22 @@
usp = self.UserSettingProvider
if usp:
usp.setUserSettings(setDict)
-
-
+
+
def deleteUserSetting(self, item):
"""Removes the given item from the user settings file."""
usp = self.UserSettingProvider
if usp:
usp.deleteUserSetting(item)
-
-
+
+
def deleteAllUserSettings(self, spec):
"""Deletes all settings that begin with the supplied spec."""
usp = self.UserSettingProvider
if usp:
usp.deleteAllUserSettings(spec)
-
-
+
+
def getUserCaption(self):
""" Return the full name of the currently logged-on user."""
if self.SecurityManager:
@@ -817,7 +817,7 @@
return strVal
try:
ret = unicode(strVal, self.Encoding)
- except UnicodeDecodeError, e:
+ except UnicodeDecodeError:
# Try some common encodings:
for enc in ("utf-8", "iso8859-1", "cp1252"):
if enc != self.Encoding:
@@ -834,24 +834,24 @@
# These two methods pass encryption/decryption requests
# to the Crypto object
def encrypt(self, val):
- """Return the encrypted string value. The request is passed
+ """Return the encrypted string value. The request is passed
to the Crypto object for processing.
"""
return self.Crypto.encrypt(val)
-
+
def decrypt(self, val):
- """Return decrypted string value. The request is passed to
+ """Return decrypted string value. The request is passed to
the Crypto object for processing.
"""
return self.Crypto.decrypt(val)
-
+
def getCharset(self):
"""Returns one of 'unicode' or 'ascii'."""
return self.uiApp.charset
-
-
+
+
def _initProperties(self):
""" Initialize the public properties of the app object."""
self.uiType = None # ("wx", "qt", "curses", "http", etc.)
@@ -871,11 +871,11 @@
self._appInfo = {}
super(dApp, self)._initProperties()
-
+
def _initDB(self, pth=None):
- """Set the available connection definitions for use by the app.
First, read in
- all .cnxml files in the specified directory, or the current
directory if none is
- specified. If no such XML definition files exist, check for a
python code
+ """Set the available connection definitions for use by the app.
First, read in
+ all .cnxml files in the specified directory, or the current
directory if none is
+ specified. If no such XML definition files exist, check for a
python code
definition file named 'dbConnectionDefs.py'.
"""
connDefs = {}
@@ -889,8 +889,8 @@
# pth
# pth/db
# pth/data
-
- dbDirs = set((hd, os.path.join(hd, "db"), os.path.join(hd,
"data"),
+
+ dbDirs = set((hd, os.path.join(hd, "db"), os.path.join(hd,
"data"),
pth, os.path.join(pth, "db"), os.path.join(pth,
"data")))
for dbDir in dbDirs:
if os.path.exists(dbDir) and os.path.isdir(dbDir):
@@ -909,23 +909,23 @@
self.dbConnectionNameToFiles[kk] =
os.abspath("dbConnectionDefs.py")
except ImportError:
pass
-
- # For each connection definition, add an entry to
- # self.dbConnectionDefs that contains a key on the
+
+ # For each connection definition, add an entry to
+ # self.dbConnectionDefs that contains a key on the
# name, and a value of a dConnectInfo object.
for k,v in connDefs.items():
ci = dabo.db.dConnectInfo()
ci.setConnInfo(v)
self.dbConnectionDefs[k] = ci
- dabo.infoLog.write(_("%s database connection definition(s)
loaded.")
+ dabo.infoLog.write(_("%s database connection definition(s)
loaded.")
% (len(self.dbConnectionDefs)))
def _initModuleNames(self):
"""Import the common application-level module names into
attributes
of this application object, so that the app code can easily
reference them.
- Example: f there is a 'biz' directory that can be imported,
other objects in
+ Example: f there is a 'biz' directory that can be imported,
other objects in
the system can reference bizobjs using the
'self.Application.biz' syntax
"""
currdir = self.HomeDirectory
@@ -949,7 +949,7 @@
def _initUI(self):
- """ Set the user-interface library for the application. Ignored
+ """ Set the user-interface library for the application. Ignored
if the UI was already explicitly set by user code.
"""
if self.UI is None and not self._uiAlreadySet:
@@ -959,7 +959,7 @@
self.UI = "wx"
else:
# Custom app code or the dabo.ui module already set
this: don't touch
- dabo.infoLog.write(_("User interface already set to
'%s', so dApp didn't touch it.")
+ dabo.infoLog.write(_("User interface already set to
'%s', so dApp didn't touch it.")
% self.UI)
@@ -980,20 +980,20 @@
raise dException.ConnectionNotFoundException(
_("No connection named '%s' is
defined") % connName)
return ret
-
-
+
+
def getConnectionNames(self):
"""Returns a list of all defined connection names"""
return self.dbConnectionDefs.keys()
-
-
+
+
def closeConnections(self):
"""Cleanup as the app is exiting."""
for key, conn in self.dbConnections.items():
conn.close()
del self.dbConnections[key]
-
+
def addConnectInfo(self, ci, name=None):
if name is None:
try:
@@ -1003,8 +1003,8 @@
name = "%...@%s" % (ci.User, ci.Host)
self.dbConnectionDefs[name] = ci
self.dbConnectionNameToFiles[name] = None
-
+
def addConnectFile(self, connFile):
"""Accepts a cnxml file path, and reads in the connections
defined in it, adding them to self.dbConnectionDefs.
@@ -1022,8 +1022,8 @@
break
if os.path.exists(connFile):
connDefs = importConnections(connFile)
- # For each connection definition, add an entry to
- # self.dbConnectionDefs that contains a key on the
+ # For each connection definition, add an entry to
+ # self.dbConnectionDefs that contains a key on the
# name, and a value of a dConnectInfo object.
for k,v in connDefs.items():
ci = dabo.db.dConnectInfo()
@@ -1034,7 +1034,7 @@
def getStandardAppDirectory(self, dirname, start=None):
"""Return the path to one of the standard Dabo application
directories.
- If a starting file path is provided, use that first. If not,
use the
+ If a starting file path is provided, use that first. If not,
use the
HomeDirectory as the starting point.
"""
stdDirs = ("biz", "cache", "db", "main.py", "reports",
"resources", "test", "ui")
@@ -1061,11 +1061,11 @@
def getTransactionToken(self, biz):
- """Only one bizobj at a time can begin and end transactions per
connection.
- This allows the bizobj to query the app for the 'token', which
is simply an
- acknowledgement that there is no other transaction pending for
that connection.
+ """Only one bizobj at a time can begin and end transactions per
connection.
+ This allows the bizobj to query the app for the 'token', which
is simply an
+ acknowledgement that there is no other transaction pending for
that connection.
If the bizobj gets the token, further requests for the token
from bizobjs using the
- same transaction will receive a reply of False, meaning that
they should not be
+ same transaction will receive a reply of False, meaning that
they should not be
handling the transaction.
"""
cn = biz._connection
@@ -1085,10 +1085,10 @@
def releaseTransactionToken(self, biz):
- """When a process that would normally close a transaction
happens, the
- bizobj that is holding the transaction token for its connection
calls this
- method to return the token. A check is run to ensure that the
releasing bizobj
- is the one currently holding the token for its connection; if
it is, the item is
+ """When a process that would normally close a transaction
happens, the
+ bizobj that is holding the transaction token for its connection
calls this
+ method to return the token. A check is run to ensure that the
releasing bizobj
+ is the one currently holding the token for its connection; if
it is, the item is
removed from the _transactionTokens dict.
"""
cn = biz._connection
@@ -1104,12 +1104,12 @@
self._language, self._charset = lang, charset
dLocalize.setLanguage(lang, charset)
-
+
def showCommandWindow(self, context=None):
"""Shows a command window with a full Python interpreter.
This is great for debugging during development, but you should
turn off
- app.ShowCommandWindowMenu in production, perhaps leaving
backdoor
+ app.ShowCommandWindowMenu in production, perhaps leaving
backdoor
access to this function.
The context argument tells dShell what object becomes 'self'.
If not
@@ -1119,8 +1119,8 @@
def toggleDebugWindow(self, context=None):
- """Shows/hodes a debug output window. It will
- display the output of the debugging commands
+ """Shows/hodes a debug output window. It will
+ display the output of the debugging commands
from your program.
"""
self.uiApp.toggleDebugWindow(context)
@@ -1186,27 +1186,27 @@
def beforeEditPreferences(self): pass
def afterEditPreferences(self): pass
- ############################
+ ############################
# These handle MRU menu requests
def addToMRU(self, menu, prmpt, bindfunc=None, *args, **kwargs):
self.uiApp.addToMRU(menu, prmpt, bindfunc, *args, **kwargs)
def onMenuOpenMRU(self, menu):
self.uiApp.onMenuOpenMRU(menu)
- ############################
+ ############################
# These methods handle AppleEvents (on Mac) and possibly other
# similar system events caught by the uiApp object
def onUiOpenFile(self, filename, *args, **kwargs): pass
def onUiPrintFile(self, filename, *args, **kwargs): pass
def onUiNewFile(self, filename, *args, **kwargs): pass
def onUiReopenApp(self, filename, *args, **kwargs): pass
- ############################
+ ############################
def copyToClipboard(self, txt):
"""Place the passed text onto the clipboard."""
self.uiApp.copyToClipboard(txt)
-
+
def onHelpAbout(self, evt):
about = self.AboutFormClass
if about is None:
@@ -1220,20 +1220,20 @@
frm = None
dlg = about(frm)
dlg.show()
-
-
+
+
def addToAbout(self):
"""Adds additional app-specific information to the About form.
This is just a stub method; override in subclasses if needed."""
pass
-
-
+
+
def clearActiveForm(self, frm):
"""Called by the form when it is deactivated."""
if frm is self.ActiveForm:
self.uiApp.ActiveForm = None
-
+
def _getAboutFormClass(self):
return getattr(self, "_aboutFormClass", None)
@@ -1246,14 +1246,14 @@
return self.uiApp.ActiveForm
else:
return None
-
+
def _setActiveForm(self, frm):
if hasattr(self, "uiApp") and self.uiApp is not None:
self.uiApp._setActiveForm(frm)
else:
dabo.errorLog.write(_("Can't set ActiveForm: no
uiApp."))
-
+
def _getBasePrefKey(self):
try:
ret = self._basePrefKey
@@ -1262,7 +1262,7 @@
if not ret:
try:
ret = self.ActiveForm.BasePrefKey
- except AttributeError:
+ except AttributeError:
pass
if not ret:
try:
@@ -1322,22 +1322,22 @@
def _setDefaultMenuBarClass(self, val):
self._defaultMenuBarClass = val
-
+
def _getDrawSizerOutlines(self):
return self.uiApp.DrawSizerOutlines
-
+
def _setDrawSizerOutlines(self, val):
self.uiApp.DrawSizerOutlines = val
-
+
def _getEncoding(self):
ret = locale.getlocale()[1]
if ret is None:
ret = dabo.defaultEncoding
return ret
-
+
def _getHomeDirectory(self):
try:
hd = self._homeDirectory
@@ -1356,7 +1356,7 @@
return False
d1 = os.path.split(d1)[0]
if d1 == d2:
- return True
+ return True
if issubdir(scriptDir, appDir):
# The directory where the main script is
executing is a subdirectory of the
@@ -1366,7 +1366,7 @@
else:
# The directory where the main script is
executing is *not* a subdirectory
# of the location of the app object in use. The
app object is likely an
- # instance of a raw dApp. So the only thing we
can really do is make the
+ # instance of a raw dApp. So the only thing we
can really do is make the
# HomeDirectory the location of the main
script, since we can't guess at
# the application's directory structure.
hd = scriptDir
@@ -1375,9 +1375,9 @@
# mangle HomeDirectory to not be the py2exe
library.zip file,
# but the containing directory (the directory
where the exe lives)
hd = os.path.split(hd)[0]
- self._homeDirectory = hd
+ self._homeDirectory = hd
return hd
-
+
def _setHomeDirectory(self, val):
if os.path.exists(val):
self._homeDirectory = os.path.abspath(val)
@@ -1391,7 +1391,7 @@
def _setIcon(self, val):
self._icon = val
-
+
def _getMainForm(self):
try:
frm = self._mainForm
@@ -1399,12 +1399,12 @@
frm = None
self._mainForm = None
return frm
-
+
def _setMainForm(self, val):
self.uiApp.setMainForm(val)
self._mainForm = val
-
+
def _getMainFormClass(self):
try:
cls = self._mainFormClass
@@ -1412,11 +1412,11 @@
cls = dabo.ui.dFormMain
self._mainFormClass = cls
return cls
-
+
def _setMainFormClass(self, val):
self._mainFormClass = val
-
-
+
+
def _getNoneDisp(self):
v = self._noneDisplay = getattr(self, "_noneDisplay", _("< None
>"))
return v
@@ -1424,8 +1424,8 @@
def _setNoneDisp(self, val):
assert isinstance(val, basestring)
self._noneDisplay = val
-
+
def _getPlatform(self):
try:
uiApp = self.uiApp
@@ -1465,20 +1465,20 @@
return self._searchDelay
except AttributeError:
## I've found that a value of 300 isn't too fast nor
too slow:
- # egl: 2006-11-16 - based on feedback from others, I'm
+ # egl: 2006-11-16 - based on feedback from others, I'm
# lengthening this to 500 ms.
return 500
-
+
def _setSearchDelay(self, value):
- self._searchDelay = int(value)
+ self._searchDelay = int(value)
-
+
def _getSecurityManager(self):
try:
return self._securityManager
except AttributeError:
return None
-
+
def _setSecurityManager(self, value):
if isinstance(value, dSecurityManager.dSecurityManager):
if self.SecurityManager:
@@ -1486,30 +1486,30 @@
self._securityManager = value
else:
raise TypeError(_("SecurityManager must descend from
dSecurityManager."))
-
-
+
+
def _getShowCommandWindowMenu(self):
try:
v = self._showCommandWindowMenu
except AttributeError:
v = self._showCommandWindowMenu = True
return v
-
+
def _setShowCommandWindowMenu(self, val):
self._showCommandWindowMenu = bool(val)
-
+
def _getShowSizerLinesMenu(self):
(12725 bytes were truncated as it was too long for the email (max 40000 bytes.)
_______________________________________________
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]