Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a371f18

Browse files
committed
Minor patch (previous combination is not working well with oriental characters - 0 length normalized unicode string is being returned)
1 parent e1ffdde commit a371f18

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/core/dump.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def dbTables(self, dbTables):
212212
if table and isListLike(table):
213213
table = table[0]
214214

215-
maxlength = max(maxlength, len(unsafeSQLIdentificatorNaming(normalizeUnicode(table) or str(table))))
215+
maxlength = max(maxlength, len(unsafeSQLIdentificatorNaming(normalizeUnicode(table) or unicode(table))))
216216

217217
lines = "-" * (int(maxlength) + 2)
218218

@@ -233,7 +233,7 @@ def dbTables(self, dbTables):
233233
table = table[0]
234234

235235
table = unsafeSQLIdentificatorNaming(table)
236-
blank = " " * (maxlength - len(normalizeUnicode(table) or str(table)))
236+
blank = " " * (maxlength - len(normalizeUnicode(table) or unicode(table)))
237237
self._write("| %s%s |" % (table, blank))
238238

239239
self._write("+%s+\n" % lines)
@@ -328,7 +328,7 @@ def dbTablesCount(self, dbTables):
328328
for ctables in dbTables.values():
329329
for tables in ctables.values():
330330
for table in tables:
331-
maxlength1 = max(maxlength1, len(normalizeUnicode(table) or str(table)))
331+
maxlength1 = max(maxlength1, len(normalizeUnicode(table) or unicode(table)))
332332

333333
for db, counts in dbTables.items():
334334
self._write("Database: %s" % unsafeSQLIdentificatorNaming(db) if db else "Current database")
@@ -354,7 +354,7 @@ def dbTablesCount(self, dbTables):
354354
tables.sort(key=lambda x: x.lower() if isinstance(x, basestring) else x)
355355

356356
for table in tables:
357-
blank1 = " " * (maxlength1 - len(normalizeUnicode(table) or str(table)))
357+
blank1 = " " * (maxlength1 - len(normalizeUnicode(table) or unicode(table)))
358358
blank2 = " " * (maxlength2 - len(str(count)))
359359
self._write("| %s%s | %d%s |" % (table, blank1, count, blank2))
360360

0 commit comments

Comments
 (0)