Pyflakes
-
reviewboard/notifications/webhooks.py (Diff revision 1)
Review Request #8916 — Created April 27, 2017 and submitted
Sometimes, a user may need to dispatch a webhook to an authenticated endpoint.
Django (somewhat sensibly) does not allow inline credentials inURLFields
, both
in forms and models, but in this case we want to allow it.This change makes use of a new backport of Django 1.8's URLValidator, which
supports credentials. The URL is then split and credentials (if included) are
pulled out and added to aHTTPBasicAuthHandler
for the url open.
Description | From | Last Updated |
---|---|---|
'django.utils.six.moves.urllib.request.urlopen' imported but unused |
reviewbot | |
*args |
chipx86 | |
**kwargs |
chipx86 | |
Shouldn't you be able to just set this on the field itself above using validators=? |
chipx86 | |
This file's missing a file docstring. (Should also be in in docs/manual/coderef/index.rst). |
chipx86 | |
Hmm, I don't know how else we'd handle this, but I sure wish we didn't have to copy this... This … |
chipx86 | |
This will be more readable using the attribute names instead of indexes. |
chipx86 | |
F811 redefinition of unused 'URLValidator' from line 7 |
reviewbot | |
E501 line too long (80 > 79 characters) |
reviewbot | |
E501 line too long (80 > 79 characters) |
reviewbot | |
you can use url_parts.hostname and urlparts.port instead of splitting this. |
brennie | |
This raises an exception: AttributeError: 'SplitResult' object has no attribute 'params' Instead of url_parts.params there should have been a url_params.fragment: … |
YX yxejamir |
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+85 -20) |
reviewboard/notifications/models.py (Diff revision 2) |
---|
Shouldn't you be able to just set this on the field itself above using
validators=
?
reviewboard/notifications/validators.py (Diff revision 2) |
---|
This file's missing a file docstring. (Should also be in in
docs/manual/coderef/index.rst
).
reviewboard/notifications/validators.py (Diff revision 2) |
---|
Hmm, I don't know how else we'd handle this, but I sure wish we didn't have to copy this... This regex has come up a few times now in Django security updates. Is there any way we can do a pass to parse out credentials and then let the parent validate the rest?
reviewboard/notifications/webhooks.py (Diff revision 2) |
---|
This will be more readable using the attribute names instead of indexes.
Description: |
|
|||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
|||||||||||||||||||||||||||||||||
Diff: |
Revision 3 (+63 -20) |
reviewboard/notifications/forms.py (Diff revision 3) |
---|
F811 redefinition of unused 'URLValidator' from line 7
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+64 -20) |
reviewboard/notifications/webhooks.py (Diff revision 4) |
---|
you can use
url_parts.hostname
andurlparts.port
instead of splitting this.
reviewboard/notifications/webhooks.py (Diff revision 4) |
---|
This raises an exception:
AttributeError: 'SplitResult' object has no attribute 'params'
Instead of
url_parts.params
there should have been aurl_params.fragment
:url = urlunsplit( (url_parts.scheme, netloc, url_parts.path, url_parts.query, url_parts.fragment))