httputils.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. from http import client
  20. NOT_ALLOWED = (
  21. client.FORBIDDEN, (("Content-Type", "text/plain"),),
  22. "Access to the requested resource forbidden.")
  23. FORBIDDEN = (
  24. client.FORBIDDEN, (("Content-Type", "text/plain"),),
  25. "Action on the requested resource refused.")
  26. BAD_REQUEST = (
  27. client.BAD_REQUEST, (("Content-Type", "text/plain"),), "Bad Request")
  28. NOT_FOUND = (
  29. client.NOT_FOUND, (("Content-Type", "text/plain"),),
  30. "The requested resource could not be found.")
  31. CONFLICT = (
  32. client.CONFLICT, (("Content-Type", "text/plain"),),
  33. "Conflict in the request.")
  34. WEBDAV_PRECONDITION_FAILED = (
  35. client.CONFLICT, (("Content-Type", "text/plain"),),
  36. "WebDAV precondition failed.")
  37. METHOD_NOT_ALLOWED = (
  38. client.METHOD_NOT_ALLOWED, (("Content-Type", "text/plain"),),
  39. "The method is not allowed on the requested resource.")
  40. PRECONDITION_FAILED = (
  41. client.PRECONDITION_FAILED,
  42. (("Content-Type", "text/plain"),), "Precondition failed.")
  43. REQUEST_TIMEOUT = (
  44. client.REQUEST_TIMEOUT, (("Content-Type", "text/plain"),),
  45. "Connection timed out.")
  46. REQUEST_ENTITY_TOO_LARGE = (
  47. client.REQUEST_ENTITY_TOO_LARGE, (("Content-Type", "text/plain"),),
  48. "Request body too large.")
  49. REMOTE_DESTINATION = (
  50. client.BAD_GATEWAY, (("Content-Type", "text/plain"),),
  51. "Remote destination not supported.")
  52. DIRECTORY_LISTING = (
  53. client.FORBIDDEN, (("Content-Type", "text/plain"),),
  54. "Directory listings are not supported.")
  55. INTERNAL_SERVER_ERROR = (
  56. client.INTERNAL_SERVER_ERROR, (("Content-Type", "text/plain"),),
  57. "A server error occurred. Please contact the administrator.")
  58. DAV_HEADERS = "1, 2, 3, calendar-access, addressbook, extended-mkcol"