X-Git-Url: https://harishankar.org/repos/?p=biacv.git;a=blobdiff_plain;f=biacv_exporter.py;fp=biacv_exporter.py;h=2f9b522c6ecbe9c9bc61873757cca1bafece6811;hp=8ba3c247acfd0eb238636c697fbaab872f9b44c5;hb=db696bd1b54b7daf56d6d3d3049e8a35394536aa;hpb=2bc518c09ac38090c6f5cf5fb3562231f2e99468 diff --git a/biacv_exporter.py b/biacv_exporter.py index 8ba3c24..2f9b522 100644 --- a/biacv_exporter.py +++ b/biacv_exporter.py @@ -21,6 +21,9 @@ class BiaCVExporter: # fill education data template bit str_education = self._get_education () + # fill the profile highlight template bit + str_profile = self._get_profile () + # fill the professional history template bit str_profession = self._get_profession () @@ -35,6 +38,7 @@ class BiaCVExporter: # fill the main template str_main = self._get_main ( + str_profile, str_education, str_profession, str_shorttermobjectives, @@ -46,7 +50,7 @@ class BiaCVExporter: codecs.open (self.file_output, "w", "utf-8").write (str_main) # fill up the main template - def _get_main (self, education, profession, shortterm, longterm, skills, languages): + def _get_main (self, profile, education, profession, shortterm, longterm, skills, languages): # main template tpl_main = string.Template (codecs.open (self.fil_main, "r", "utf-8").read ()) @@ -64,6 +68,7 @@ class BiaCVExporter: lastname = self.data["lastname"], dateofbirth = self.data["dateofbirth"], maritalstatus = str_marital, + profile = profile, shortterm = shortterm, longterm = longterm, skills = skills, @@ -85,6 +90,20 @@ class BiaCVExporter: return str_main + # get the profile highlights list + def _get_profile (self): + tpl_profile = string.Template (codecs.open (self.fil_profile, "r", "utf-8").read ()) + + lst_profile = [] + # loop through each item + for item in self.data["profile"]: + str_profile = tpl_profile.safe_substitute ( + profile_item = item + ) + lst_profile.append (str_profile) + + return u'\n'.join (lst_profile) + # get the language list def _get_languages (self): tpl_language = string.Template (codecs.open (self.fil_language, "r", "utf-8").read ()) @@ -106,7 +125,7 @@ class BiaCVExporter: ) lst_languages.append (str_lang) - return "\n".join (lst_languages) + return u'\n'.join (lst_languages) # get the skills def _get_skills (self): @@ -122,7 +141,7 @@ class BiaCVExporter: ) lst_skills.append (str_skill) - return "\n".join (lst_skills) + return u'\n'.join (lst_skills) # get short term career objectives def _get_career (self): @@ -144,7 +163,7 @@ class BiaCVExporter: ) lst_longtermgoals.append (str_career) - return "\n".join (lst_shorttermcareer), "\n".join (lst_longtermgoals) + return u'\n'.join (lst_shorttermcareer), u'\n'.join (lst_longtermgoals) # fill the professional history template def _get_profession (self): @@ -167,7 +186,7 @@ class BiaCVExporter: ) lst_profession.append (str_profession) - return "\n".join (lst_profession) + return u'\n'.join (lst_profession) # fill the education template def _get_education (self): @@ -187,7 +206,7 @@ class BiaCVExporter: ) lst_education.append (str_education) - return "\n".join (lst_education) + return u'\n'.join (lst_education) # set the template directory and the files within def set_template_directory (self, templatedir): @@ -205,6 +224,8 @@ class BiaCVExporter: self.fil_skills = os.path.join (templatedir, "skill_bit.tpl") # languages learned bit self.fil_language = os.path.join (templatedir, "language_bit.tpl") + # profile bit + self.fil_profile = os.path.join (templatedir, "profile_bit.tpl") # load language strings lang_str = codecs.open (os.path.join (templatedir, "misc_strings.txt"), "r", "utf-8").read ()