m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
723 B

6 months ago
  1. import sys
  2. try:
  3. from collections.abc import OrderedDict
  4. except ImportError:
  5. from collections import OrderedDict
  6. from werkzeug.http import HTTP_STATUS_CODES
  7. PY3 = sys.version_info > (3,)
  8. def http_status_message(code):
  9. """Maps an HTTP status code to the textual status"""
  10. return HTTP_STATUS_CODES.get(code, '')
  11. def unpack(value):
  12. """Return a three tuple of data, code, and headers"""
  13. if not isinstance(value, tuple):
  14. return value, 200, {}
  15. try:
  16. data, code, headers = value
  17. return data, code, headers
  18. except ValueError:
  19. pass
  20. try:
  21. data, code = value
  22. return data, code, {}
  23. except ValueError:
  24. pass
  25. return value, 200, {}