schema_valid_service.py 571 B

12345678910111213141516171819202122232425
  1. from service.base_service import BaseService
  2. from schema import SchemaUnexpectedTypeError
  3. class SchemaValidService(BaseService):
  4. @staticmethod
  5. def parse_integer_list(value):
  6. print("11111")
  7. if value is None:
  8. return
  9. else:
  10. try:
  11. return [int(item if item != "" else 0) for item in value]
  12. except Exception:
  13. raise MyCustomError("11111")
  14. @staticmethod
  15. def parse_str_list(value):
  16. return [str(item) for item in value]
  17. class MyCustomError(Exception):
  18. pass