Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 93C6D1025A for ; Mon, 3 Mar 2014 15:48:02 +0000 (UTC) Received: (qmail 9747 invoked by uid 500); 3 Mar 2014 15:48:02 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 9703 invoked by uid 500); 3 Mar 2014 15:48:01 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 9651 invoked by uid 99); 3 Mar 2014 15:47:57 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Mar 2014 15:47:57 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5A6E2933A34; Mon, 3 Mar 2014 15:47:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: johnsca@apache.org To: allura-commits@incubator.apache.org Date: Mon, 03 Mar 2014 15:47:57 -0000 Message-Id: <44e0ac8d3cb14d71955748420eb9f281@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 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 Authored: Mon Mar 3 15:43:52 2014 +0000 Committer: Cory Johns 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):