-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support new supplementary lists property (#213)
* Support new supplementary lists property * Enforce unique supplementary lists * Improve list collector error message
- Loading branch information
1 parent
eaf7b4d
commit cf3286d
Showing
11 changed files
with
1,896 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from app.error_messages import FOR_LIST_NEVER_POPULATED | ||
from app.validators.blocks.block_validator import BlockValidator | ||
|
||
|
||
class ListCollectorContentValidator(BlockValidator): | ||
def validate(self): | ||
super().validate() | ||
self.validate_for_list_is_valid() | ||
return self.errors | ||
|
||
def validate_for_list_is_valid(self): | ||
""" | ||
Verifies that the list for the list collector content block is either: | ||
1) Populated by a standard list collector - OR | ||
2) In the supplementary data lists property so populated by supplementary data | ||
""" | ||
list_name = self.block["for_list"] | ||
if list_name not in self.questionnaire_schema.list_names: | ||
self.add_error( | ||
FOR_LIST_NEVER_POPULATED, | ||
list_name=list_name, | ||
) |
This file contains 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 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 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.