From f4f6fa0b00ec4dffc7714bb48bacaf6e4e18b926 Mon Sep 17 00:00:00 2001 From: Harishankar Date: Wed, 7 Dec 2011 19:08:09 +0530 Subject: [PATCH] Removed a hardcoded string from code Removed a hardcoded string "current" from the code. --- biacv_exporter.py | 6 +++++- biacv_mainwindow.py | 10 +++++----- templates/default_xhtml/misc_strings.txt | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/biacv_exporter.py b/biacv_exporter.py index d027e71..3900c76 100644 --- a/biacv_exporter.py +++ b/biacv_exporter.py @@ -153,9 +153,13 @@ class BiaCVExporter: lst_profession = [] # loop through each item for item in self.data["professionalhistory"]: + if item["leavedate"] == "": + leavedate_str = self.lang_strings[6] + else: + leavedate_str = item["leavedate"] str_profession = tpl_profession.safe_substitute ( joindate = item["joindate"], - leavedate= item["leavedate"], + leavedate = leavedate_str, organization = item["organization"], jobtitle = item["jobtitle"], additionalinfo = item["additionalinfo"] diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index 09bf77d..8e4eb5f 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -609,9 +609,9 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): PyQt4.QtGui.QMessageBox.critical (self, lang.ERROR_UPDATE, lang.ERROR_REQ_MISSING) return # if currently employed in that position, leaving date is to be disabled - # and set to "current" + # and set to empty if self.currentemployment.isChecked (): - leavedatestr = "current" + leavedatestr = "" else: # if the leaving date is < join date if self.leavedate.date () < self.joindate.date (): @@ -651,9 +651,9 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): PyQt4.QtGui.QMessageBox.critical (self, lang.ERROR_ADD, lang.ERROR_REQ_MISSING) return # if currently employed in that position, leaving date is to be disabled - # and set to "current" + # and set to "" if self.currentemployment.isChecked (): - leavedatestr = "current" + leavedatestr = "" else: # if the leaving date is < join date if self.leavedate.date () < self.joindate.date (): @@ -689,7 +689,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): selitem = selitems[0] self.designation.setText (selitem.text (0)) self.joindate.setDate (PyQt4.QtCore.QDate.fromString (selitem.text(1), "dd MMM, yyyy")) - if selitem.text (2) == "current": + if selitem.text (2) == "": self.leavedate.setEnabled (False) self.currentemployment.setChecked (True) else: diff --git a/templates/default_xhtml/misc_strings.txt b/templates/default_xhtml/misc_strings.txt index 97014f7..7fc600b 100644 --- a/templates/default_xhtml/misc_strings.txt +++ b/templates/default_xhtml/misc_strings.txt @@ -3,4 +3,5 @@ can read/write; proficient; Married Single -Unspecified \ No newline at end of file +Unspecified +present \ No newline at end of file -- 2.20.1