-
Notifications
You must be signed in to change notification settings - Fork 6
Fixed: Generic errors.ForbiddenError raised when election closed #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b06ed68
Improved: add a CustomError base class and its handler
chriscool 594cb11
Refactor: Add error checking helper and standardize 404 responses
chriscool 17381b3
Fixed: A generic errors.ForbiddenError is raised when an election is …
chriscool 6bbe83c
Fixed: wrong comments before update date tests
chriscool 2b64549
Improved: use INVALID_DATE_CONFIGURATION for some date issues
chriscool 0108ea5
Improved: use SCHEMA_VALIDATION_ERROR for some date issues
chriscool a587c6f
Improved: use UNAUTHORIZED for unauthorization issues
chriscool 8de11a9
Improved: use VALIDATION_ERROR for ballot validation errors
chriscool f6506fb
Improved: standardize error checks in unrestricted ballot test
chriscool 74ed2e5
Improved: use specific error codes for unstarted and restricted elect…
chriscool 1cccc9a
Improved: use specific error code and better name for ballot stuffing…
chriscool f568014
Improved: use specific error code for hidden results
chriscool be7343c
Improved: use specific error codes for update election failures
chriscool eb7e235
Feature: prevent start_date change on active elections and add test
chriscool 210a5a3
Improved: the BadRequestError response now uses the new error format
chriscool 6e7bfc3
Improved: the NoRecordedVotes response now uses the new error format
chriscool f4f9cc9
Improved: the InconsistentDatabaseError response now uses the new err…
chriscool 326fd28
Fixed: make checking for 'admin' in 'payload' safe
chriscool f11028f
Improved: the generic ForbiddenError response now uses the new error …
chriscool File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est la même chose que
not playload["admin"]non? 👀Si ça perturbe et que tu préfères, il y a également la synthaxe:
"admin" not in payload(pareil en dessous)Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non, ce n'est pas tout à fait la même chose. Quand la clé n'est pas définie dans un cas on a une KeyError et dans l'autre ça marche:
En particulier dans le test
test_update_election_as_non_adminje crois bien que ça plante le test sans cette modif."admin" not in payloadmarcherait probablement aussi dans l'application telle qu'elle est actuellement, mais si un jour on peut avoirpayload["admin"] == Falsealors il faudrait soitnot payload.get("admin")soit"admin" not in payload or not payload["admin"], donc je pense qu'utilisernot payload.get("admin")tout de suite est légèrement mieux.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouki, ça marche 👍
Merci pour les explications ;)