Represent all custom fields in the Change resource in the API.
Review Request #6887 — Created Feb. 1, 2015 and submitted
The Change resource was hard-coding support for a number of built-in fields, and wasn't even getting all of them. It was never updated to take into account any registered fields. Now, instead of using a bunch of custom logic in the resource, it iterates through all change entries, locates a matching field (if any), and serializes that. This also gets rid of some bad, broken caching that could both cause results to contain stale information from the database and could cause memory bloat if traversing a large number of Change resources. It does mean there's a performance hit in the database with repeated calls, but HTTP caching should help with that. Some queries were also optimized to reduce the number of hits to the database. Overall, it should be a performance win.
Unit tests pass.
No longer saw stale payloads.
- Change Summary:
-
Removed some now unused imports and a mapping table.
- Commit:
-
6419c0e2afc6cc69611918d7b302d5c72d897b2650713cd4c3b44ff8c583552fc12dbc560c99933d
-
Tool: Pyflakes Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/webapi/resources/change.py reviewboard/reviews/fields.py Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/webapi/resources/change.py reviewboard/reviews/fields.py
-
- Change Summary:
-
Missed an unused import.
- Commit:
-
50713cd4c3b44ff8c583552fc12dbc560c99933d9cd3d58367cdd1c610afda185c7fc12bb8bbb0bc