From a371f182acb0d6c4a2ba6b5c3958ae846454791a Mon Sep 17 00:00:00 2001 From: stamparm Date: Thu, 28 Mar 2013 15:37:14 +0100 Subject: [PATCH] Minor patch (previous combination is not working well with oriental characters - 0 length normalized unicode string is being returned) --- lib/core/dump.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/dump.py b/lib/core/dump.py index 996d17669..977cb3c4e 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -212,7 +212,7 @@ class Dump(object): if table and isListLike(table): table = table[0] - maxlength = max(maxlength, len(unsafeSQLIdentificatorNaming(normalizeUnicode(table) or str(table)))) + maxlength = max(maxlength, len(unsafeSQLIdentificatorNaming(normalizeUnicode(table) or unicode(table)))) lines = "-" * (int(maxlength) + 2) @@ -233,7 +233,7 @@ class Dump(object): table = table[0] table = unsafeSQLIdentificatorNaming(table) - blank = " " * (maxlength - len(normalizeUnicode(table) or str(table))) + blank = " " * (maxlength - len(normalizeUnicode(table) or unicode(table))) self._write("| %s%s |" % (table, blank)) self._write("+%s+\n" % lines) @@ -328,7 +328,7 @@ class Dump(object): for ctables in dbTables.values(): for tables in ctables.values(): for table in tables: - maxlength1 = max(maxlength1, len(normalizeUnicode(table) or str(table))) + maxlength1 = max(maxlength1, len(normalizeUnicode(table) or unicode(table))) for db, counts in dbTables.items(): self._write("Database: %s" % unsafeSQLIdentificatorNaming(db) if db else "Current database") @@ -354,7 +354,7 @@ class Dump(object): tables.sort(key=lambda x: x.lower() if isinstance(x, basestring) else x) for table in tables: - blank1 = " " * (maxlength1 - len(normalizeUnicode(table) or str(table))) + blank1 = " " * (maxlength1 - len(normalizeUnicode(table) or unicode(table))) blank2 = " " * (maxlength2 - len(str(count))) self._write("| %s%s | %d%s |" % (table, blank1, count, blank2))