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 2014/03/03 16:47:57 UTC
[1/2] git commit: [#7229] Handle errors in profile sections
gracefully, and log
Repository: incubator-allura
Updated Branches:
refs/heads/cj/7229 [created] adf92cf18
[#7229] Handle errors in profile sections gracefully, and log
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d26d6e56
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d26d6e56
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d26d6e56
Branch: refs/heads/cj/7229
Commit: d26d6e56cfe8f06084e5d7277acfd2107db8d6a0
Parents: 44751e6
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon Mar 3 15:43:52 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Mar 3 15:46:07 2014 +0000
----------------------------------------------------------------------
Allura/allura/ext/user_profile/user_main.py | 28 +++++++++++++++---------
1 file changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d26d6e56/Allura/allura/ext/user_profile/user_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/user_main.py b/Allura/allura/ext/user_profile/user_main.py
index 7065a32..9a9e5f1 100644
--- a/Allura/allura/ext/user_profile/user_main.py
+++ b/Allura/allura/ext/user_profile/user_main.py
@@ -29,6 +29,7 @@ from webob import exc
from jinja2 import Markup
from pytz import timezone
from datetime import datetime
+from paste.deploy.converters import asbool
from allura import version
from allura.app import Application, SitemapEntry
@@ -258,16 +259,23 @@ class ProfileSectionBase(object):
"""
if not self.check_display():
return ''
- tmpl = g.jinja2_env.get_template(self.template)
- context = self.prepare_context({
- 'h': h,
- 'c': c,
- 'g': g,
- 'user': self.user,
- 'config': tg.config,
- 'auth': AuthenticationProvider.get(request),
- })
- return Markup(tmpl.render(context))
+ try:
+ tmpl = g.jinja2_env.get_template(self.template)
+ context = self.prepare_context({
+ 'h': h,
+ 'c': c,
+ 'g': g,
+ 'user': self.user,
+ 'config': tg.config,
+ 'auth': AuthenticationProvider.get(request),
+ })
+ return Markup(tmpl.render(context))
+ except Exception as e:
+ log.exception('Error rendering profile section %s: %s', type(self).__name__, e)
+ if asbool(tg.config.get('debug')):
+ raise
+ else:
+ return ''
class PersonalDataSection(ProfileSectionBase):
[2/2] git commit: [#7229] Handle activity objects not having project
attribute gracefully on user profile
Posted by jo...@apache.org.
[#7229] Handle activity objects not having project attribute gracefully on user profile
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/adf92cf1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/adf92cf1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/adf92cf1
Branch: refs/heads/cj/7229
Commit: adf92cf18c2ac332ad41865d684a8bb7c9506938
Parents: d26d6e5
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon Mar 3 15:47:35 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Mar 3 15:47:35 2014 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/adf92cf1/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 6af2da8..37c7ff5 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -265,7 +265,7 @@ class ForgeActivityProfileSection(ProfileSectionBase):
# calls are made by perm_check() above.
session(activity).expunge(activity)
activity_obj = get_activity_object(activity.obj)
- activity.obj.project = activity_obj.project if activity_obj else None
+ activity.obj.project = getattr(activity_obj, 'project', None)
context.update({
'follow_toggle': W.follow_toggle,