# HG changeset patch # User catherine@localhost # Date 1213029246 14400 # Node ID 1e69f3a26216cb33beb16d7a9d81891bad34b4d4 # Parent fd1f06e700ea42eecd03001bc97dd6e6dad05630 fixed python2.4 compat diff -r fd1f06e700ea -r 1e69f3a26216 sqlpyPlus.py --- a/sqlpyPlus.py Mon Jun 09 12:14:16 2008 -0400 +++ b/sqlpyPlus.py Mon Jun 09 12:34:06 2008 -0400 @@ -393,6 +393,10 @@ if needsquotes: return "'%s'" % str(itm) return str(itm) + def str_or_empty(self, itm): + if itm is None: + return '' + return str(itm) def output_as_insert_statements(self): usequotes = [d[1] != cx_Oracle.NUMBER for d in self.curs.description] def formatRow(row): @@ -405,7 +409,7 @@ def output_row_as_xml(self, row): result = [' <%s>\n %s\n %s>' % - (colname.lower(), str('' if (itm is None) else itm), colname.lower()) + (colname.lower(), self.str_or_empty(itm), colname.lower()) for (itm, colname) in zip(row, self.colnames)] return '\n'.join(result) def output_as_xml(self): @@ -420,7 +424,7 @@ for row in self.rows: result.append('