Add publishing signals
Review Request #5723 — Created April 21, 2014 and submitted
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.
Description | From | Last Updated |
---|---|---|
Can you define a new error type for this in reviewboard/webapi/errors.py ? You can probably use the same error code/definition … |
david | |
We've switched over to the new-style except PublishError as e |
david | |
except PublishError as e |
david | |
except PublishError as e |
david | |
Alignment isn't quite right here. |
david |
- Change Summary:
-
Use proper PUBLISH_ERROR.
- Branch:
-
release-2.0.xmaster
- Commit:
-
1cd78fe0bdf9d5becd583e27d3bdb10149d3d0a75015671668b45205e113256f2ad8343afda15ad0
- Diff:
-
Revision 2 (+70 -8)
- Change Summary:
-
Fixed exception-handling style. I also noticed that there is no information in the "review_request" object at the time the publishing signal is sent. So I moved the fetching of the review_request_draft object up and changed the publishing signal to pass that instead.
- Commit:
-
5015671668b45205e113256f2ad8343afda15ad063567fd97558c8dbf36dc66cdfae34aae0643b25
- Diff:
-
Revision 3 (+73 -9)
- Change Summary:
-
Fixed alignment.
- Commit:
-
63567fd97558c8dbf36dc66cdfae34aae0643b250acef8982c62b0575406a9d89793aa849fe98a80
- Diff:
-
Revision 4 (+73 -9)