dabo Commit
Revision 5426
Date: 2009-09-26 10:25:53 -0700 (Sat, 26 Sep 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5426
Changed:
U trunk/dabo/__init__.py
U trunk/dabo/dObject.py
U trunk/dabo/dPref.py
Log:
Fixed several (potential) bugs revealed by pychecker.
Diff:
Modified: trunk/dabo/__init__.py
===================================================================
--- trunk/dabo/__init__.py 2009-09-26 17:24:02 UTC (rev 5425)
+++ trunk/dabo/__init__.py 2009-09-26 17:25:53 UTC (rev 5426)
@@ -122,6 +122,8 @@
dAppRef = None
# Import global settings (do this first, as other imports may rely on it):
+# NOTE: Yeah, it's namespace pollution, but in this case it is deliberate:
+# we want to make them part of the dabo namespace.
from settings import *
# Install localization service for dabo. dApp will install localization service
@@ -130,8 +132,9 @@
dLocalize.install("dabo")
# On some platforms getfilesystemencoding() and even getdefaultlocale()
# can return None, so we make sure we always set a reasonable encoding:
+# NOTE: 'defaultEncoding' is imported from 'from settings import *' line above.
fileSystemEncoding = (sys.getfilesystemencoding()
- or locale.getdefaultlocale()[1] or settings.defaultEncoding)
+ or locale.getdefaultlocale()[1] or defaultEncoding)
# Instantiate the logger object, which will send messages to user-overridable
# locations. Do this before any other imports.
Modified: trunk/dabo/dObject.py
===================================================================
--- trunk/dabo/dObject.py 2009-09-26 17:24:02 UTC (rev 5425)
+++ trunk/dabo/dObject.py 2009-09-26 17:25:53 UTC (rev 5426)
@@ -185,10 +185,10 @@
def getAbsoluteName(self):
"""Return the fully qualified name of the object."""
names = [self.Name, ]
- object = self
+ obj = self
while True:
try:
- parent = object.Parent
+ parent = obj.Parent
except AttributeError:
# Parent not necessarily defined
parent = None
@@ -198,7 +198,7 @@
except AttributeError:
name = "?"
names.append(name)
- object = parent
+ obj = parent
else:
break
names.reverse()
@@ -242,7 +242,6 @@
compiled successfully, an error message will be added
to the Dabo ErrorLog, and the method will not be added.
"""
- cls = self.__class__
for nm, code in cd.items():
try:
code = code.replace("\n]", "]")
Modified: trunk/dabo/dPref.py
===================================================================
--- trunk/dabo/dPref.py 2009-09-26 17:24:02 UTC (rev 5425)
+++ trunk/dabo/dPref.py 2009-09-26 17:25:53 UTC (rev 5426)
@@ -390,7 +390,6 @@
key = self._getKey()
if spec is not None:
key = ".".join((key, spec))
- keylen = len(key) + 1
keydots = len(key.split("."))
sql = "select ckey from daboprefs where ckey like ?"
crs.execute(sql, ("%s.%%" % key, ))
@@ -434,8 +433,6 @@
key = self._getKey()
if spec is not None:
key = ".".join((key, spec))
- keylen = len(key) + 1
- keydots = len(key.split("."))
sql = "select ckey from daboprefs where ckey like ? order by
ckey"
if key:
param = "%s.%%" % key
@@ -453,7 +450,6 @@
# Get all the first-tier keys
# get all the first level values
lev0 = [val.split(".", 1) for val in vals]
- lev0keys = [itm[0] for itm in lev0]
keys = {}
[uniqKeys(keys, itm[0]) for itm in lev0]
for key in sorted(keys):
_______________________________________________
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]