Return-Path: X-Original-To: apmail-allura-commits-archive@www.apache.org Delivered-To: apmail-allura-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B602E1791C for ; Fri, 17 Oct 2014 12:25:18 +0000 (UTC) Received: (qmail 9569 invoked by uid 500); 17 Oct 2014 12:25:18 -0000 Delivered-To: apmail-allura-commits-archive@allura.apache.org Received: (qmail 9550 invoked by uid 500); 17 Oct 2014 12:25:18 -0000 Mailing-List: contact commits-help@allura.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@allura.apache.org Delivered-To: mailing list commits@allura.apache.org Received: (qmail 9539 invoked by uid 99); 17 Oct 2014 12:25:18 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2014 12:25:18 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1DCD293983A; Fri, 17 Oct 2014 12:25:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jetmind@apache.org To: commits@allura.apache.org Message-Id: <4b87d95be0c943e38ee42228f4631976@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [#7752] ticket:670 Fix error when indexing users Date: Fri, 17 Oct 2014 12:25:18 +0000 (UTC) Repository: allura Updated Branches: refs/heads/je/7752 [created] 4615e22aa [#7752] ticket:670 Fix error when indexing users Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/4615e22a Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/4615e22a Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/4615e22a Branch: refs/heads/je/7752 Commit: 4615e22aa25c7e1c0203c2a3357dec363019bbdf Parents: 10472d1 Author: Igor Bondarenko Authored: Fri Oct 17 14:18:47 2014 +0300 Committer: Igor Bondarenko Committed: Fri Oct 17 15:24:31 2014 +0300 ---------------------------------------------------------------------- Allura/allura/model/auth.py | 6 +++--- Allura/allura/tests/model/test_auth.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/allura/blob/4615e22a/Allura/allura/model/auth.py ---------------------------------------------------------------------- diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py index 32f9b17..439c3d2 100644 --- a/Allura/allura/model/auth.py +++ b/Allura/allura/model/auth.py @@ -297,7 +297,7 @@ class User(MappedClass, ActivityNode, ActivityObject, SearchIndexable): url_s=self.url(), type_s=self.type_s, username_s=self.username, - email_addresses_t=' '.join(self.email_addresses), + email_addresses_t=' '.join([e for e in self.email_addresses if e]), last_password_updated_dt=self.last_password_updated, disabled_b=self.disabled, results_per_page_i=self.get_pref('results_per_page'), @@ -310,9 +310,9 @@ class User(MappedClass, ActivityNode, ActivityObject, SearchIndexable): localization_s=localization, timezone_s=self.get_pref('timezone'), socialnetworks_t=socialnetworks, - telnumbers_t=' '.join(self.get_pref('telnumbers')), + telnumbers_t=' '.join([t for t in self.get_pref('telnumbers') if t]), skypeaccount_s=self.get_pref('skypeaccount'), - webpages_t=' '.join(self.get_pref('webpages')), + webpages_t=' '.join([p for p in self.get_pref('webpages') if p]), skills_t=' '.join([s['skill'].fullpath for s in self.get_skills() if s.get('skill')]), last_access_login_date_dt=self.last_access['login_date'], last_access_login_ip_s=self.last_access['login_ip'], http://git-wip-us.apache.org/repos/asf/allura/blob/4615e22a/Allura/allura/tests/model/test_auth.py ---------------------------------------------------------------------- diff --git a/Allura/allura/tests/model/test_auth.py b/Allura/allura/tests/model/test_auth.py index 3d6b69e..2b05672 100644 --- a/Allura/allura/tests/model/test_auth.py +++ b/Allura/allura/tests/model/test_auth.py @@ -326,3 +326,13 @@ def test_user_index(): assert_in('last_access_session_ua_t', idx) # provided bby auth provider assert_in('user_registration_date_dt', idx) + +@with_setup(setUp) +def test_user_index_none_values(): + c.user.email_addresses = [None] + c.user.set_pref('telnumbers', [None]) + c.user.set_pref('webpages', [None]) + idx = c.user.index() + assert_equal(idx['email_addresses_t'], '') + assert_equal(idx['telnumbers_t'], '') + assert_equal(idx['webpages_t'], '')