comparison 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
comparison
equal deleted inserted replaced
6:9ce41ef66dfa 7:b5fc67c97c50
1 #!/ur/bin/env python2 1 #!/ur/bin/env python2
2 2
3 import glob 3 import glob
4 import os.path
4 import markdown 5 import markdown
5 import os.path
6 from sat.core.i18n import _ 6 from sat.core.i18n import _
7 from sat.core.log import getLogger 7 from sat.core.log import getLogger
8 from libervia.server.tasks import task
9
10
8 log = getLogger(__name__) 11 log = getLogger(__name__)
9 12
10 13
11 def start(self): 14 class Task(task.Task):
12 sat_path = self.getConfig("sat_repos_path")
13 for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")):
14 filename = os.path.basename(filepath)
15 with open(filepath) as f:
16 md = markdown.markdown(f.read())
17 build_path = os.path.join(self.build_path, filename + '.html')
18 with open(build_path, 'w') as f:
19 f.write(md)
20 15
21 log.info(_("social contract has been converted to HTML")) 16 def start(self):
17 sat_path = self.getConfig("sat_repos_path")
18 for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")):
19 filename = os.path.basename(filepath)
20 with open(filepath) as f:
21 md = markdown.markdown(f.read())
22 build_path = os.path.join(self.build_path, filename + '.html')
23 with open(build_path, 'w') as f:
24 f.write(md)
25
26 log.info(_("social contract has been converted to HTML"))