Mercurial > libervia-website
diff tasks/task_social_contract.py @ 7:b5fc67c97c50
tasks: updated tasks following changes in Libervia
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 26 May 2020 12:38:56 +0200 |
parents | 9ce41ef66dfa |
children | 5fd933e238bb |
line wrap: on
line diff
--- a/tasks/task_social_contract.py Sat Oct 05 01:26:51 2019 +0200 +++ b/tasks/task_social_contract.py Tue May 26 12:38:56 2020 +0200 @@ -1,21 +1,26 @@ #!/ur/bin/env python2 import glob +import os.path import markdown -import os.path from sat.core.i18n import _ from sat.core.log import getLogger +from libervia.server.tasks import task + + log = getLogger(__name__) -def start(self): - sat_path = self.getConfig("sat_repos_path") - for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")): - filename = os.path.basename(filepath) - with open(filepath) as f: - md = markdown.markdown(f.read()) - build_path = os.path.join(self.build_path, filename + '.html') - with open(build_path, 'w') as f: - f.write(md) +class Task(task.Task): - log.info(_("social contract has been converted to HTML")) + def start(self): + sat_path = self.getConfig("sat_repos_path") + for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")): + filename = os.path.basename(filepath) + with open(filepath) as f: + md = markdown.markdown(f.read()) + build_path = os.path.join(self.build_path, filename + '.html') + with open(build_path, 'w') as f: + f.write(md) + + log.info(_("social contract has been converted to HTML"))