Make ResourceClass.normalize_name handle sharp S
Fixes ResourceClass.normalize_name to produce the same result in py2 and py3 even when sharp S ('ß') is part of the input. We do this by waiting until after replacing non-alphanumerics to upcase. Change-Id: I431fa29d36d0d633374973fc25168344042d6c1a Closes-Bug: #1762789
This commit is contained in:
parent
37d3101d54
commit
377f1454e2
@ -58,11 +58,11 @@ class ResourceClass(fields.StringField):
|
||||
def normalize_name(cls, rc_name):
|
||||
if rc_name is None:
|
||||
return None
|
||||
norm_name = rc_name.upper()
|
||||
cust_prefix = cls.CUSTOM_NAMESPACE
|
||||
norm_name = cust_prefix + norm_name
|
||||
# Replace some punctuation characters with underscores
|
||||
norm_name = re.sub('[^0-9A-Z]+', '_', norm_name)
|
||||
# Replace non-alphanumeric characters with underscores
|
||||
norm_name = re.sub('[^0-9A-Za-z]+', '_', rc_name)
|
||||
# Bug #1762789: Do .upper after replacing non alphanumerics.
|
||||
norm_name = norm_name.upper()
|
||||
norm_name = cls.CUSTOM_NAMESPACE + norm_name
|
||||
return norm_name
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user