Revision 2613
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
14 | 14 |
def add_suffix(str_, suffix): |
15 | 15 |
'''Preserves version so that it won't be truncated off the string, leading |
16 | 16 |
to collisions.''' |
17 |
if len(str_) == identifier_max_len: # preserve version |
|
18 |
str_, sep, version = str_.partition('#') |
|
17 |
# Preserve version |
|
18 |
before, sep, version = str_.rpartition('#') |
|
19 |
if sep != '': # found match |
|
20 |
str_ = before |
|
19 | 21 |
suffix = sep+version+suffix |
22 |
|
|
20 | 23 |
return strings.add_suffix(str_, suffix, identifier_max_len) |
21 | 24 |
|
22 | 25 |
def is_safe_name(name): |
Also available in: Unified diff
sql_gen.py: add_suffix(): Fixed bug where only strings already at the max length had the version preserved, even though appending the suffix could bring it past the max length and still cause the version to be overwritten. Fixed bug where last # in str, not first, should be considered to precede the version.