webdav.py 886B

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