(self, detail=None, code=None)
| 146 | default_code = 'invalid' |
| 147 | |
| 148 | def __init__(self, detail=None, code=None): |
| 149 | if detail is None: |
| 150 | detail = self.default_detail |
| 151 | if code is None: |
| 152 | code = self.default_code |
| 153 | |
| 154 | # For validation failures, we may collect many errors together, |
| 155 | # so the details should always be coerced to a list if not already. |
| 156 | if isinstance(detail, tuple): |
| 157 | detail = list(detail) |
| 158 | elif not isinstance(detail, dict) and not isinstance(detail, list): |
| 159 | detail = [detail] |
| 160 | |
| 161 | self.detail = _get_error_details(detail, code) |
| 162 | |
| 163 | |
| 164 | class ParseError(APIException): |
nothing calls this directly
no test coverage detected