Created
May 24, 2011 06:49
-
-
Save masaki/988228 to your computer and use it in GitHub Desktop.
Trac XmlRpcPlugin and validate_ticket extension point
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tracrpc/ticket.py b/tracrpc/ticket.py | |
index 6224276..3042718 100644 | |
--- a/tracrpc/ticket.py | |
+++ b/tracrpc/ticket.py | |
@@ -237,14 +237,13 @@ class TicketRPC(Component): | |
req.args['comment'] = comment | |
req.args['ts'] = time_changed | |
changes, problems = tm.get_ticket_changes(req, t, action) | |
- for warning in problems: | |
- add_warning(req, "Rpc ticket.update: %s" % warning) | |
- valid = problems and False or tm._validate_ticket(req, t) | |
- if not valid: | |
- raise TracError( | |
- " ".join([warning for warning in req.chrome['warnings']])) | |
+ if problems: | |
+ for warning in problems: | |
+ add_warning(req, "Rpc ticket.update: %s" % warning) | |
+ raise TracError(" ".join([warning for warning in req.chrome['warnings']])) | |
else: | |
tm._apply_ticket_changes(t, changes) | |
+ tm._validate_ticket(req, t) # validate after apply changes | |
self.log.debug("Rpc ticket.update save: %s" % repr(t.values)) | |
t.save_changes(author, comment, when=when) | |
# Apply workflow side-effects |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment