webdav.py 944B

123456789101112131415161718192021222324252627282930
  1. # -*- coding: utf-8 -*-
  2. import argparse
  3. import plaster_pastedeploy
  4. from waitress import serve
  5. from tracim.command import AppContextCommand
  6. from tracim.lib.webdav import WebdavAppFactory
  7. class WebdavRunnerCommand(AppContextCommand):
  8. auto_setup_context = False
  9. def get_description(self) -> str:
  10. return "run webdav server"
  11. def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
  12. parser = super().get_parser(prog_name)
  13. return parser
  14. def take_action(self, parsed_args: argparse.Namespace) -> None:
  15. super(WebdavRunnerCommand, self).take_action(parsed_args)
  16. tracim_config = parsed_args.config_file
  17. # TODO - G.M - 16-04-2018 - Allow specific webdav config file
  18. app_factory = WebdavAppFactory(
  19. tracim_config_file_path=tracim_config,
  20. )
  21. app = app_factory.get_wsgi_app()
  22. serve(app, port=app.config['port'], host=app.config['host'])