Merge pull request #162 from luoliyan/master

Handle invalid delimiters more gracefully
This commit is contained in:
Damien Elmes 2017-02-15 13:42:21 +10:00 committed by GitHub
commit 41dc837712

View file

@ -112,6 +112,11 @@ you can enter it here. Use \\t to represent tab."""),
self, help="importing") or "\t"
str = str.replace("\\t", "\t")
str = str.encode("ascii")
if len(str) > 1:
showWarning(_(
"Multi-character separators are not supported. "
"Please enter one character only."))
return
self.hideMapping()
def updateDelim():
self.importer.delimiter = str
@ -140,7 +145,7 @@ you can enter it here. Use \\t to represent tab."""),
d = repr(d)
txt = _("Fields separated by: %s") % d
self.frm.autoDetect.setText(txt)
def accept(self):
self.importer.mapping = self.mapping
if not self.importer.mappingOk():