You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2012/12/04 15:26:15 UTC

[22/29] git commit: [#5354] general error handling on project registration, rather than show a 500 page

[#5354] general error handling on project registration, rather than show a 500 page


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

Branch: refs/heads/tv/5382
Commit: 2751e0eef83764df582362cffe07826cb16dbbc0
Parents: f5a220f
Author: Dave Brondsema <db...@geek.net>
Authored: Wed Nov 28 21:46:28 2012 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Mon Dec 3 21:56:29 2012 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py               |    4 ++++
 .../allura/tests/functional/test_neighborhood.py   |    8 ++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2751e0ee/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 7a1cfdd..ef88b51 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -185,6 +185,10 @@ class NeighborhoodController(object):
         except exceptions.ProjectRatelimitError:
             flash("Project creation rate limit exceeded.  Please try again later.", 'error')
             redirect('add_project')
+        except Exception as e:
+            log.warn('error registering project %s', project_unixname, exc_info=True)
+            flash('Internal Error. Please try again later.', 'error')
+            redirect('add_project')
 
         if project_description:
             c.project.short_description = project_description

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2751e0ee/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index b6b6ac4..2999dc0 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -1,8 +1,7 @@
 import json
 import os
 from cStringIO import StringIO
-from nose.tools import assert_raises, assert_equal
-from datetime import datetime, timedelta
+import urllib2
 
 import Image
 from tg import config
@@ -448,8 +447,7 @@ class TestNeighborhood(TestController):
         r = self.app.get('/p/add_project', extra_environ=dict(username='root'))
         assert 'private_project' not in r
 
-        assert_raises(ValueError,
-            self.app.post,
+        r = self.app.post(
             '/p/register',
             params=dict(
                 project_unixname='myprivate1',
@@ -459,6 +457,8 @@ class TestNeighborhood(TestController):
                 private_project='on'),
             antispam=True,
             extra_environ=dict(username='root'))
+        flash_msg_cookie = urllib2.unquote(r.headers['Set-Cookie'])
+        assert 'Internal Error.' in flash_msg_cookie
 
         proj = M.Project.query.get(shortname='myprivate1', neighborhood_id=neighborhood._id)
         assert proj is None