flake8
-
reviewboard/attachments/managers.py (Diff revision 1)
Review Request #13532 — Created Feb. 12, 2024 and submitted
It turns out that having a FileAttachment for a diff that does not have
the review request set will cause the review UI instantiation to fail.
This change fixes thecreate_from_filediff
method to set the review
request and local site fields correctly based on the given FileDiff's
review request.
Summary | ID |
---|---|
03af6a5de80fa01c8dce9b878cb73e6cb6b5b899 |
Description | From | Last Updated |
---|---|---|
'django.core.exceptions.ObjectDoesNotExist' imported but unused Column: 1 Error code: F401 |
reviewbot | |
By default, .set() will query for existing objects, compare to what's in there, remove any old ones, and then set … |
chipx86 | |
This is missing a Version Added. |
chipx86 | |
Do we want to cache the None locally, or check again the next time this is called? I feel like … |
chipx86 |
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+244 -50) |
reviewboard/attachments/managers.py (Diff revision 2) |
---|
By default,
.set()
will query for existing objects, compare to what's in there, remove any old ones, and then set new ones. That's minimum 2, max 3 queries.That can be reduced to a guaranteed 2 if we pass
clear=True
, which will just delete what's in there and replace it.However, we know this model is new and that we're adding to it for the first time, so we can avoid all that and just use
.add()
to get 1 query.
reviewboard/diffviewer/models/filediff.py (Diff revision 2) |
---|
Do we want to cache the
None
locally, or check again the next time this is called? I feel like the former avoids unexpected behavior, since this is only during the lifetime of a request.In either case, we should document this.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+260 -50) |