comparison tasks/task_social_contract.py @ 6:9ce41ef66dfa

python 3 port
author Goffi <goffi@goffi.org>
date Sat, 05 Oct 2019 01:26:51 +0200
parents 09d66acc7c73
children b5fc67c97c50
comparison
equal deleted inserted replaced
5:9ab2f5b872c7 6:9ce41ef66dfa
11 def start(self): 11 def start(self):
12 sat_path = self.getConfig("sat_repos_path") 12 sat_path = self.getConfig("sat_repos_path")
13 for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")): 13 for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")):
14 filename = os.path.basename(filepath) 14 filename = os.path.basename(filepath)
15 with open(filepath) as f: 15 with open(filepath) as f:
16 md = markdown.markdown(f.read().decode('utf-8')) 16 md = markdown.markdown(f.read())
17 build_path = os.path.join(self.build_path, filename + '.html') 17 build_path = os.path.join(self.build_path, filename + '.html')
18 with open(build_path, 'w') as f: 18 with open(build_path, 'w') as f:
19 f.write(md.encode('utf-8')) 19 f.write(md)
20 20
21 log.info(_(u"social contract has been converted to HTML")) 21 log.info(_("social contract has been converted to HTML"))