internal.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. The default web backend.
  18. Features:
  19. - Create and delete address books and calendars.
  20. - Edit basic metadata of existing address books and calendars.
  21. - Upload address books and calendars from files.
  22. """
  23. import pkg_resources
  24. from radicale import config, httputils, types, web
  25. MIMETYPES = httputils.MIMETYPES # deprecated
  26. FALLBACK_MIMETYPE = httputils.FALLBACK_MIMETYPE # deprecated
  27. class Web(web.BaseWeb):
  28. folder: str
  29. def __init__(self, configuration: config.Configuration) -> None:
  30. super().__init__(configuration)
  31. self.folder = pkg_resources.resource_filename(
  32. __name__, "internal_data")
  33. def get(self, environ: types.WSGIEnviron, base_prefix: str, path: str,
  34. user: str) -> types.WSGIResponse:
  35. return httputils.serve_folder(self.folder, base_prefix, path)