none.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # This file is part of Radicale - CalDAV and CardDAV server
  2. # Copyright © 2017-2018 Unrud <unrud@outlook.com>
  3. #
  4. # This library is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with Radicale. If not, see <http://www.gnu.org/licenses/>.
  16. """
  17. A dummy web backend that shows a simple message.
  18. """
  19. from http import client
  20. from radicale import httputils, pathutils, types, web
  21. class Web(web.BaseWeb):
  22. def get(self, environ: types.WSGIEnviron, base_prefix: str, path: str,
  23. user: str) -> types.WSGIResponse:
  24. assert path == "/.web" or path.startswith("/.web/")
  25. assert pathutils.sanitize_path(path) == path
  26. if path != "/.web":
  27. return httputils.NOT_FOUND
  28. return client.OK, {"Content-Type": "text/plain"}, "Radicale works!"