Change Summary:
Added screenshot
Added Files: |
---|
Review Request #5810 — Created May 12, 2014 and submitted
Information | |
---|---|
volodymyr | |
Review Board | |
3033 | |
Reviewers | |
reviewboard, students | |
When adding a new repository, having %s in the base URL of a non-custom bug tracker breaks things. That's because we don't have an error checking for that, and once the complete URL gets generated out of it, the problem is detected, but that leaves the form in a broken state, where you cannot save the form anymore.
We decided to address this by letting the user know of the error and tell him/her that % character can be escaped if there is a need. The appropriate error message is presented if this error happens.
Tested locally: * Entering invalid URL for bugzilla, trac or redmine will result in an error that you must fix before submitting. * Other things work as expected.
Description | From | Last Updated |
---|---|---|
For docstrings, the first line should a short summary on the same line as the initial """, and should be … |
|
|
I think we should test this using the actual format operation instead of checking whether the string contains '%s', because … |
|
|
This string is a bit dense, and not really in character with the rest of our validation errors. How about … |
|
|
The first part of a docstring should fit on one line. In this cane you could just move "Note that … |
|
|
I'm not sure what this means. |
|
|
typo ('th') |
|
|
"have error present" read clumsy. |
|
|
I think you should assign the field to a variable. You also don't need to prefix strings with 'u' because … |
|
|
The text should be shortened a tad and this should be all one line. """Check that hosting service bug URLs … |
|
|
This is no longer necessary (the format operation will handle escaped % sequences itself). |
|
|
Blank line between these two. |
|
|
Period at the end of the sentence. |
|
Full implementation of the approach where user will get notified about using %s for the base URL. Error message might br modified to mention that they can escape '%s' in order to still have it. Either way, this solves the problem with broken state and inability to make further changes.
Summary: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Testing Done: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 2 (+53 -3) |
reviewboard/admin/validation.py (Diff revision 2) |
---|
For docstrings, the first line should a short summary on the same line as the initial """, and should be < 80 columns total.
There should then be a blank line, followed by a longer explanation (if appropriate).
This is because the first line is often pulled out for documentation or help() purposes. In this case, because the """ is followed by a newline, the first line would be blank.
reviewboard/admin/validation.py (Diff revision 2) |
---|
I think we should test this using the actual format operation instead of checking whether the string contains '%s', because there are other format characters which could cause the same issue.
# Try formatting the URL using an empty tuple to verify that it # doesn't contain any format characters. try: input_url % () except TypeError: raise ValidationError(...)
reviewboard/admin/validation.py (Diff revision 2) |
---|
This string is a bit dense, and not really in character with the rest of our validation errors. How about something like this?
The URL "%s" is not valid because it contains a format character. For bug trackers other than "Custom Bug Tracker", use the base URL of the server. If you need a "%" character, escape it using "%%".
The
input_url
line is also misaligned.
reviewboard/scmtools/forms.py (Diff revision 2) |
---|
The first part of a docstring should fit on one line. In this cane you could just move "Note that ..." into another paragraph.
reviewboard/scmtools/forms.py (Diff revision 2) |
---|
I think you should assign the field to a variable. You also don't need to prefix strings with 'u' because the first line of this file uses the unicode_literals future, which makes every string literal a unicode object.
field = self.bug_tracker_forms[bug_tracker_type]['default'] self.bug_tracker_host_error = ( hasattr(field, 'errors') and len(field.errors) > 0)
reviewboard/admin/validation.py (Diff revision 3) |
---|
The text should be shortened a tad and this should be all one line.
"""Check that hosting service bug URLs don't contain %s."""
reviewboard/admin/validation.py (Diff revision 3) |
---|
This is no longer necessary (the format operation will handle escaped % sequences itself).
The code looks good now, but I'd like you to rewrite the description to represent the more final state of the change (so it's more appropriate as a commit message).
Description: |
|
||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Removed Files: |