]> git.ipfire.org Git - thirdparty/patchwork.git/commit
REST: Don't iterate through models at class level
authorStephen Finucane <stephen@that.guru>
Tue, 7 Feb 2017 10:59:11 +0000 (10:59 +0000)
committerStephen Finucane <stephen@that.guru>
Wed, 8 Feb 2017 10:03:14 +0000 (10:03 +0000)
commit078357058987509265f69f0e71aee242575ba0af
tree4dbff37de534d661295010f254c6c5341b0d4422
parent265040867d5da2726b712c3decb8641c650598db
REST: Don't iterate through models at class level

This causes two issues. Firstly, on fresh installs you see the following
error message:

  "Table 'patchwork.patchwork_state' doesn't exist"

Secondly, any new states created when the process is running will not be
reflected in the API until the server process is restarted.

Resolve this issue by moving the step into a method, thus ensuring it's
continuously refreshed. It doesn't seem possible to add tests to prevent
this regressing but some similarly useful tests are included to at least
validate the behavior of that field.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Tested-By: Denis Laxalde <denis@laxalde.org>
Fixes: a2993505 ("REST: Make 'Patch.state' editable")
Closes-bug: #67
Closes-bug: #80
patchwork/api/base.py
patchwork/api/patch.py
patchwork/tests/test_rest_api.py