dabo Commit
Revision 7064
Date: 2012-01-30 18:23:56 -0800 (Mon, 30 Jan 2012)
Author: Ed
Trac: http://trac.dabodev.com/changeset/7064
Changed:
U trunk/dabo/db/dBackend.py
U trunk/dabo/db/dConnectInfo.py
U trunk/dabo/db/dCursorMixin.py
Log:
Just some minor cleaning up of the code: some formatting and changing methods
that should be static to staticmethods.
Diff:
Modified: trunk/dabo/db/dBackend.py
===================================================================
--- trunk/dabo/db/dBackend.py 2012-01-28 18:37:34 UTC (rev 7063)
+++ trunk/dabo/db/dBackend.py 2012-01-31 02:23:56 UTC (rev 7064)
@@ -234,14 +234,15 @@
return True
- def addWithSep(self, base, new, sep=",\n\t"):
+ @staticmethod
+ def addWithSep(base, new, sep=",\n\t"):
"""
Convenient method of adding to an expression that
may or may not have an existing value. If there is a value,
the separator is inserted between the two.
"""
if base:
- ret = sep.join( (base, new) )
+ ret = sep.join((base, new))
else:
ret = new
return ret
Modified: trunk/dabo/db/dConnectInfo.py
===================================================================
--- trunk/dabo/db/dConnectInfo.py 2012-01-28 18:37:34 UTC (rev 7063)
+++ trunk/dabo/db/dConnectInfo.py 2012-01-31 02:23:56 UTC (rev 7064)
@@ -56,24 +56,23 @@
self.setConnInfo(connInfo)
- def lowerKeys(self, dct):
- """
- Takes a dict, and returns another dict identical except
- for the fact that all the keys that were string types are now
- lower case.
- """
- ret = {}
- for kk, vv in dct.items():
- if isinstance(kk, basestring):
- kk = kk.lower()
- ret[kk] = vv
- return ret
-
-
def setConnInfo(self, connInfo, nm=""):
+ def lowerKeys(dct):
+ """
+ Takes a dict, and returns another dict identical except
+ for the fact that all the keys that were string types
are now
+ lower case.
+ """
+ ret = {}
+ for kk, vv in dct.items():
+ if isinstance(kk, basestring):
+ kk = kk.lower()
+ ret[kk] = vv
+ return ret
+
if isinstance(connInfo, dict):
# The info is already in dict format
- connDict = self.lowerKeys(connInfo)
+ connDict = lowerKeys(connInfo)
else:
# They've passed the info in XML format. Either this is
the actual
# XML, or it is a path to the XML file. Either way, the
parser
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py 2012-01-28 18:37:34 UTC (rev 7063)
+++ trunk/dabo/db/dCursorMixin.py 2012-01-31 02:23:56 UTC (rev 7064)
@@ -675,6 +675,15 @@
self.RowNumber = 0
+ @staticmethod
+ def getType(val):
+ try:
+ ret = re.search("type '([^']+)'",
ustr(type(val))).groups()[0]
+ except (IndexError, AttributeError):
+ ret = "-unknown-"
+ return ret
+
+
def cursorToXML(self):
"""
Returns an XML string containing the information necessary to
@@ -719,14 +728,6 @@
return "\n".join(recInfo)
- def getType(self, val):
- try:
- ret = re.search("type '([^']+)'",
ustr(type(val))).groups()[0]
- except (IndexError, AttributeError):
- ret = "-unknown-"
- return ret
-
-
def escape(self, val):
"""Provides the proper escaping of values in XML output"""
ret = val
_______________________________________________
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]