Refactor queries for the review request page.
Review Request #8347 — Created Aug. 25, 2016 and submitted
This change moves all the data querying logic out of the review_detail view
into a newReviewRequestPageData
object. The view itself is now primarily
concerned with computation of the etag, creation of the entries, and rendering
of the template--as it should be. This new object documents its attributes, and
is passed into the builtin fields which wish to use it to optimize their
queries, rather than the oldlocals_vars
hack, which I believe was possibly
literally one of the gateways to hell.As I was doing this I cleaned up some code which was no longer used and moved
some of the work from pre-etag to post-etag. This also changes some of the
timestamp comparisons to work off of integers (ctimes) instead of datetimes,
since before we had a few instances where we were comparing datetimes to 0.
- Did lots of testing with a few different review requests with lots of change
description and review boxes. - Ran unit tests.
Description | From | Last Updated |
---|---|---|
Col: 80 E501 line too long (117 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (81 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (113 > 79 characters) |
reviewbot | |
'GeneralComment' imported but unused |
reviewbot | |
'ScreenshotComment' imported but unused |
reviewbot | |
'FileAttachmentComment' imported but unused |
reviewbot | |
Col: 80 E501 line too long (117 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (81 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (113 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (117 > 79 characters) |
reviewbot | |
I know this was here before, but while updating this code, maybe move to a try/except KeyError, to reduce this … |
chipx86 | |
"great number more queries" sounds kinda odd. Maybe just "many more queries than necessary?" |
chipx86 | |
Col: 80 E501 line too long (81 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (113 > 79 characters) |
reviewbot | |
Let's say "The HTTP request object," just to help differentiate it from "review request" for those newer to the concepts. |
chipx86 | |
Missing period. |
chipx86 | |
Can you go into the details of the ctime additions in the description? I'm assuming they fix some bug. |
chipx86 | |
Col: 80 E501 line too long (117 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (117 > 79 characters) |
reviewbot |
-
Tool: Pyflakes Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/reviews/detail.py Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/reviews/detail.py
-
-
-
- Change Summary:
-
Fix ordering of replies to body-top and body-bottom (since reviews are now fetched in reverse order to make timestamp calculation faster for the ETag).
- Commit:
-
5327eed055df4f6cfafce51d91d28261a4d9b95c22cd0ef90be84b8d515eadf14262f6bf61d4d96a
-
Tool: Pyflakes Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/reviews/detail.py Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/reviews/detail.py
-
-
-
- Change Summary:
-
Fix some issues that somehow snuck through my previous unit test runs.
- Commit:
-
22cd0ef90be84b8d515eadf14262f6bf61d4d96ad32282d1e72c72b9f81fdadfb3c8ebb828686be0
-
Tool: Pyflakes Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/reviews/detail.py Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/reviews/detail.py
-
-
Very nice.
-
I know this was here before, but while updating this code, maybe move to a
try/except KeyError
, to reduce this from two lookups to one? -
-
Let's say "The HTTP request object," just to help differentiate it from "review request" for those newer to the concepts.
-
-
Can you go into the details of the ctime additions in the description? I'm assuming they fix some bug.
- Change Summary:
-
Requested changes.
- Description:
-
This change moves all the data querying logic out of the review_detail view
into a new ReviewRequestPageData
object. The view itself is now primarilyconcerned with computation of the etag, creation of the entries, and rendering of the template--as it should be. This new object documents its attributes, and is passed into the builtin fields which wish to use it to optimize their queries, rather than the old locals_vars
hack, which I believe was possiblyliterally one of the gateways to hell. As I was doing this I cleaned up some code which was no longer used and moved
~ some of the work from pre-etag to post-etag. ~ some of the work from pre-etag to post-etag. This also changes some of the + timestamp comparisons to work off of integers (ctimes) instead of datetimes, + since before we had a few instances where we were comparing datetimes to 0. - Commit:
-
d32282d1e72c72b9f81fdadfb3c8ebb828686be01179d6c69c86c023d69eba1054738d8408d4b377