Fix of issue 3111, string.lowercase on Windows.
svn: r12831
This commit is contained in:
parent
b59199e3c3
commit
6294c0b1b3
@ -74,14 +74,14 @@ class Citation(object):
|
|||||||
@return: The key of the added reference among all the references.
|
@return: The key of the added reference among all the references.
|
||||||
@rtype: char
|
@rtype: char
|
||||||
"""
|
"""
|
||||||
letter_count = len(string.lowercase)
|
letter_count = len(string.ascii_lowercase)
|
||||||
ref_count = len(self.__ref_list)
|
ref_count = len(self.__ref_list)
|
||||||
x_ref_count = ref_count
|
x_ref_count = ref_count
|
||||||
# Return "a" for ref_count = 0, otherwise log(0) does not work
|
# Return "a" for ref_count = 0, otherwise log(0) does not work
|
||||||
if ref_count == 0:
|
if ref_count == 0:
|
||||||
self.__ref_list.append(("a", source_ref))
|
self.__ref_list.append(("a", source_ref))
|
||||||
return "a"
|
return "a"
|
||||||
last_letter = string.lowercase[ ref_count % letter_count ]
|
last_letter = string.ascii_lowercase[ ref_count % letter_count ]
|
||||||
key = ""
|
key = ""
|
||||||
# Calculate prek number of digits.
|
# Calculate prek number of digits.
|
||||||
number_of_letters = int(math.log(float(ref_count),float(letter_count)))+1
|
number_of_letters = int(math.log(float(ref_count),float(letter_count)))+1
|
||||||
@ -94,7 +94,7 @@ class Citation(object):
|
|||||||
x_ref_count = x_ref_count - pow(letter_count, n)
|
x_ref_count = x_ref_count - pow(letter_count, n)
|
||||||
for letter in range(1, number_of_letters):
|
for letter in range(1, number_of_letters):
|
||||||
index = x_ref_count / pow(letter_count, letter) % letter_count
|
index = x_ref_count / pow(letter_count, letter) % letter_count
|
||||||
key += string.lowercase[ index ]
|
key += string.ascii_lowercase[ index ]
|
||||||
key = key + last_letter
|
key = key + last_letter
|
||||||
self.__ref_list.append((key, source_ref))
|
self.__ref_list.append((key, source_ref))
|
||||||
return key
|
return key
|
||||||
|
Loading…
Reference in New Issue
Block a user