Validate XLS rows count before exporting.#612
Conversation
e404fcb to
f318d0b
Compare
f318d0b to
64da1ed
Compare
genglert
left a comment
There was a problem hiding this comment.
Target the branch "v2.5-rc5" please.
| # Prevent an error when reaching 65535 rows during an .XLS file export, which is a hard limit defined by the .XLS | ||
| format specs. Display a clear error message prior to the export. |
There was a problem hiding this comment.
In the changelog, I try to write sentences with more literal style, something like "The export for .XLS file now displays an error when...".
| def validate(self, **kwargs): | ||
| pass |
There was a problem hiding this comment.
Maybe should we add a doc-string with classical "keys" (how to know if we should use "count", "total", "total_count" or "total_number" ?
Or add keywords only arguments with default values like def validate(self, *, total_count=None): (which would be IDE friendly).
I prefer the second solution.
| from ...backends import export_backend_registry | ||
| from ...backends.base import ExportBackend | ||
| from ...core.exceptions import ConflictError |
There was a problem hiding this comment.
I try to avoid ... in the code base (I use only . & ..).
| self.assertIsNone(export_backend_registry.get_backend_class(TestExportBackend.id)) | ||
| export_backend_registry._backend_classes[TestExportBackend.id] = TestExportBackend | ||
| response = self.assertGET409(self._build_contact_dl_url(doc_type=TestExportBackend.id)) | ||
| self.assertContains(response, 'TestExportBackend.validate fail', status_code=409) | ||
| export_backend_registry._backend_classes = None |
There was a problem hiding this comment.
It would be more straightforward to copy the original _backend_classes value & restore the value in a finally block.
A better solution would be to store the registry in an attribute of the class view, to set our own registry in setupClass() & restore the original one in tearDownClass().
64da1ed to
7213414
Compare
7213414 to
1956d32
Compare
1956d32 to
b2a5418
Compare
…g when you change password for another user).
… latest focused item obviously not reset it on frame update
b2a5418 to
91d82cf
Compare
Prevent an error when reaching 65535 rows during an .XLS file export, which is a hard limit defined by the .XLS format specs.
Display a clear error message prior to the export, returning an http 409 error code.