Add publishing signals
Review Request #5723 — Created April 21, 2014 and submitted — Latest diff uploaded
This adds "publishing" signals, executed before any data is saved. The intention is that an extension can block publishing if, for example, there's a problem communicating with an outside system, by raising an exception.
I added a PublishError class and made web API publish functions turn them into WebAPIErrors. This is the part I'm least certain about. I want to allow extension to define the errors, but it doesn't make sense for the publishing signal handlers to be throwing WebAPIErrors directly. The compromise I came up with was to just put the PublishError string into a generic WebAPIError with a special user code of 999. Other ideas welcome; I just wanted something to start a conversation.
The ReviewRequestEditor model already had some basic error handling (a simple alert dialog). I added similar error handling to DraftReviewBannerView and ReviewReplyDraftBannerView. As far as I can tell, that covers all interfaces to updating (publishing) reviews, review requests, and review replies.
All tests pass except some VCS-specific ones, which were skipped. I also did some manual verification of the full system by throwing PublishError exceptions in an extension and verifying that the message appeared in an alert box in the UI.