view tasks/task_social_contract.py @ 35:347d32030451 default tip

presentation (docker): add info on how to connect
author Goffi <goffi@goffi.org>
date Tue, 12 Dec 2023 17:01:20 +0100
parents e7c7327f9f25
children
line wrap: on
line source

#!/ur/bin/env python2

import glob
import os.path
import markdown
from libervia.backend.core.i18n import _
from libervia.backend.core.log import getLogger
from libervia.web.server.tasks import task


log = getLogger(__name__)


class Task(task.Task):

    def start(self):
        sat_path = self.config_get("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"))