You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/12/16 18:09:50 UTC

[11/36] git commit: [#6381] ticket:491 fixed reply error

[#6381] ticket:491 fixed reply error

If a reply violates the antispam protection (e.g. form had been open > 24hr)
then previously the index method would "handle" the error and mark the parent
message as edited.  This prevents that.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fcf2e465
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fcf2e465
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fcf2e465

Branch: refs/heads/cj/6821
Commit: fcf2e465939e947bfee9a9b85811e32f14161527
Parents: 9a0faf0
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Sun Dec 1 01:06:20 2013 +0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Dec 10 18:20:22 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fcf2e465/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 74879ad..b80b4e9 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -186,10 +186,13 @@ class ThreadController(BaseController, FeedController):
                     limit=int(limit),
                     show_moderate=kw.get('show_moderate'))
 
+    def error_handler(self, *args, **kwargs):
+        redirect(request.referer)
+
     @h.vardec
     @expose()
     @require_post()
-    @validate(pass_validator, error_handler=index)
+    @validate(pass_validator, error_handler=error_handler)
     @utils.AntiSpam.validate('Spambot protection engaged')
     def post(self, **kw):
         require_access(self.thread, 'post')
@@ -310,10 +313,13 @@ class PostController(BaseController):
             return dict(discussion=self.post.discussion,
                         post=post)
 
+    def error_handler(self, *args, **kwargs):
+        redirect(request.referer)
+
     @h.vardec
     @expose()
     @require_post()
-    @validate(pass_validator, error_handler=index)
+    @validate(pass_validator, error_handler=error_handler)
     @utils.AntiSpam.validate('Spambot protection engaged')
     @require_post(redir='.')
     def reply(self, file_info=None, **kw):
@@ -326,7 +332,7 @@ class PostController(BaseController):
     @h.vardec
     @expose()
     @require_post()
-    @validate(pass_validator, error_handler=index)
+    @validate(pass_validator, error_handler=error_handler)
     def moderate(self, **kw):
         require_access(self.post.thread, 'moderate')
         if kw.pop('delete', None):
@@ -342,7 +348,7 @@ class PostController(BaseController):
     @h.vardec
     @expose()
     @require_post()
-    @validate(pass_validator, error_handler=index)
+    @validate(pass_validator, error_handler=error_handler)
     def flag(self, **kw):
         self.W.flag_post.to_python(kw, None)
         if c.user._id not in self.post.flagged_by: