(self)
| 115 | self._upload_handlers = upload_handlers |
| 116 | |
| 117 | def parse(self): |
| 118 | # Call the actual parse routine and close all open files in case of |
| 119 | # errors. This is needed because if exceptions are thrown the |
| 120 | # MultiPartParser will not be garbage collected immediately and |
| 121 | # resources would be kept alive. This is only needed for errors because |
| 122 | # the Request object closes all uploaded files at the end of the |
| 123 | # request. |
| 124 | try: |
| 125 | return self._parse() |
| 126 | except Exception: |
| 127 | if hasattr(self, "_files"): |
| 128 | for _, files in self._files.lists(): |
| 129 | for fileobj in files: |
| 130 | fileobj.close() |
| 131 | raise |
| 132 | |
| 133 | def _parse(self): |
| 134 | """ |
no test coverage detected