Validation Messages: Add <strong> for missing_wheel and forbidden_filepaths #200

Open
Dalai Felinto wants to merge 1 commits from pr-error-messages-safe into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

Note that in order to do this I need to sanitize the parameters separately from the error string.

Note that in order to do this I need to sanitize the parameters separately from the error string.
Dalai Felinto added 1 commit 2024-07-02 23:48:06 +02:00
Oleg-Komarov reviewed 2024-07-04 13:03:52 +02:00
@ -42,2 +45,2 @@
'missing_wheel': _('Python wheel missing: %(path)s'), # TODO <strong>%(path)s</strong>
'forbidden_filepaths': _('Archive contains forbidden files or directories: %(paths)s'), #TODO <strong>%(paths)s</strong>
'missing_wheel': _('Python wheel missing: <strong>%(path)s</strong>'),
'forbidden_filepaths': mark_safe(
Owner

this line and the line above look inconsistent: both of them have parameters, but only one is wrapped into mark_safe inside the error_messages declaration
this is confusing and doesn't establish a consistent pattern for further use: if it's possible it's better to make them the same

it seems that the code below (in clean) already takes care of mark_safe for cases when params are passed, so I would expect that mark_safe in this line is not needed. if this is not true, then the code structure is surprising - we should think how to make it more transparent.

this line and the line above look inconsistent: both of them have parameters, but only one is wrapped into `mark_safe` inside the `error_messages` declaration this is confusing and doesn't establish a consistent pattern for further use: if it's possible it's better to make them the same it seems that the code below (in `clean`) already takes care of `mark_safe` for cases when params are passed, so I would expect that `mark_safe` in this line is not needed. if this is not true, then the code structure is surprising - we should think how to make it more transparent.
@ -151,3 +153,1 @@
params=code['params'],
)
)
error_message = str(self.error_messages[code['code']])
Owner

why is str cast needed here?

why is `str` cast needed here?
This pull request has changes conflicting with the target branch.
  • extensions/tests/test_submit.py
  • files/forms.py

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin pr-error-messages-safe:pr-error-messages-safe
git checkout pr-error-messages-safe
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: infrastructure/extensions-website#200
No description provided.