From cb27515459d016a33498bb6b3393f2f24f314dfd Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Thu, 27 May 2010 19:45:07 +0100 Subject: [PATCH] Add check that custom field begins with a letter --- src/calibre/gui2/dialogs/config/create_custom_column.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/dialogs/config/create_custom_column.py b/src/calibre/gui2/dialogs/config/create_custom_column.py index 693f079d12..5ff048ed0a 100644 --- a/src/calibre/gui2/dialogs/config/create_custom_column.py +++ b/src/calibre/gui2/dialogs/config/create_custom_column.py @@ -92,8 +92,10 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn): def accept(self): col = unicode(self.column_name_box.text()).lower() - if not col.isalnum(): - return self.simple_error('', _('The label must contain only letters and digits')) + if not col: + return self.simple_error('', _('No lookup name was provided')) + if not col.isalnum() or not col[0].isalpha(): + return self.simple_error('', _('The label must contain only letters and digits, and start with a letter')) col_heading = unicode(self.column_heading_box.text()) col_type = self.column_types[self.column_type_box.currentIndex()]['datatype'] if col_type == '*text': @@ -101,8 +103,6 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn): is_multiple = True else: is_multiple = False - if not col: - return self.simple_error('', _('No lookup name was provided')) if not col_heading: return self.simple_error('', _('No column heading was provided')) bad_col = False