From 7aa7acb3558b7c4ea2e266282e020cb62cb5e773 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Sun, 23 Dec 2007 22:20:51 +0000 Subject: [PATCH] Fix 0001393: Detailed descendant report crash on too many references. svn: r9569 --- ChangeLog | 4 ++++ src/ReportBase/_Bibliography.py | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8e8ea1671..ee8358704 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-12-23 Brian Matherly + * src/ReportBase/_Bibliography.py: + Fix 0001393: Detailed descendant report crash on too many references. + 2007-12-23 Raphael Ackermann * src/plugins/ExtractCity.py: Fix #0001160: Regular expressions, dash/separator and non-ASCII characters on ExtractCity diff --git a/src/ReportBase/_Bibliography.py b/src/ReportBase/_Bibliography.py index 176f1b7dd..b8aebfe7b 100644 --- a/src/ReportBase/_Bibliography.py +++ b/src/ReportBase/_Bibliography.py @@ -72,7 +72,17 @@ class Citation: @return: The key of the added reference among all the references. @rtype: char """ - key = string.lowercase[ len(self.__ref_list) ] + first_letter = '' + second_letter = '' + letter_count = len(string.lowercase) + ref_count = len(self.__ref_list) + if ref_count > letter_count: + # If there are more than 26 references, we need to use two + # characters to uniquely identify them all. + first_letter = string.lowercase[ ref_count / letter_count ] + second_letter = string.lowercase[ ref_count % letter_count ] + + key = first_letter + second_letter self.__ref_list.append((key,source_ref)) return key