[kupfer/maint] grouping: Check that values exist before merging groups



commit 3f0eb36ae63a3d62b41872da220dda0c991d8daf
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Fri Feb 5 18:00:23 2010 +0100

    grouping: Check that values exist before merging groups
    
    It may be that we have a key according to which we want to merge
    contacts, but no contacts have a value in this group. Check for this
    case.
    
    This fixes: https://bugs.launchpad.net/kupfer/+bug/517548

 kupfer/obj/grouping.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/obj/grouping.py b/kupfer/obj/grouping.py
index e61ad12..65adc5c 100644
--- a/kupfer/obj/grouping.py
+++ b/kupfer/obj/grouping.py
@@ -108,6 +108,8 @@ class GroupingSource (Source):
 			for leaf in list(leaves):
 				for slot2 in leaf.grouping_slots:
 					for value2 in leaf.all(slot2):
+						if not value2:
+							continue
 						merge_groups((slot, value), (slot2, value2))
 		if self.should_sort_lexically():
 			sort_func = utils.locale_sort



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]