options.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # This file is part of Radicale Server - Calendar Server
  2. # Copyright © 2008 Nicolas Kandel
  3. # Copyright © 2008 Pascal Halter
  4. # Copyright © 2008-2017 Guillaume Ayoub
  5. # Copyright © 2017-2018 Unrud <unrud@outlook.com>
  6. #
  7. # This library is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This library is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with Radicale. If not, see <http://www.gnu.org/licenses/>.
  19. """
  20. Radicale WSGI application.
  21. Can be used with an external WSGI server or the built-in server.
  22. """
  23. from http import client
  24. from radicale import httputils
  25. class ApplicationOptionsMixin:
  26. def do_OPTIONS(self, environ, base_prefix, path, user):
  27. """Manage OPTIONS request."""
  28. headers = {
  29. "Allow": ", ".join(
  30. name[3:] for name in dir(self) if name.startswith("do_")),
  31. "DAV": httputils.DAV_HEADERS}
  32. return client.OK, headers, None