Only force first letter of fullname to be upper

This change enforce the first and last component
of a fullname to start with an uppercase letter.
This is to keep user's custom capitalisation such as:

* middle name should be lower-case
* keep in-middle uppercase such as "McGinnis"

Change-Id: Ifdad9f05c0d74d18396e9b06bd57c1c0f391be8d
This commit is contained in:
Tristan Cacqueray 2016-09-26 00:34:14 +00:00
parent 54c26df7d8
commit d461c157af
3 changed files with 11 additions and 5 deletions

View File

@ -13,7 +13,7 @@ Ocata PTL Candidates
* Cinder
* `Sean Mcginnis (smcginnis) <https://git.openstack.org/cgit/openstack/election/plain/candidates/ocata/Cinder/smcginnis.txt>`_
* `Sean McGinnis (smcginnis) <https://git.openstack.org/cgit/openstack/election/plain/candidates/ocata/Cinder/smcginnis.txt>`_
* Cloudkitty
@ -83,7 +83,7 @@ Ocata PTL Candidates
* Keystone
* `Samuel De Medeiros Queiroz (samueldmq) <https://git.openstack.org/cgit/openstack/election/plain/candidates/ocata/Keystone/samueldmq.txt>`_
* `Samuel de Medeiros Queiroz (samueldmq) <https://git.openstack.org/cgit/openstack/election/plain/candidates/ocata/Keystone/samueldmq.txt>`_
* `Steve Martinelli (stevemar) <https://git.openstack.org/cgit/openstack/election/plain/candidates/ocata/Keystone/stevemar.txt>`_
* Kolla

View File

@ -15,7 +15,7 @@ Ocata PTL
* Cinder
* `Sean Mcginnis (smcginnis) <https://git.openstack.org/cgit/openstack/election/plain/candidates/ocata/Cinder/smcginnis.txt>`_
* `Sean McGinnis (smcginnis) <https://git.openstack.org/cgit/openstack/election/plain/candidates/ocata/Cinder/smcginnis.txt>`_
* Cloudkitty

View File

@ -102,8 +102,14 @@ def get_fullname(filepath):
# Strip double space and trailing spaces
fullname = re.sub(r" ", " ", fullname).strip()
# Return capitalized name
return u" ".join(map(unicode.capitalize, fullname.split()))
# Make sure first letter of first and last component are upper-case
s = fullname.split()
fullname = (
[s[0][0].upper() + s[0][1:]] +
s[1:-1] +
[s[-1][0].upper() + s[-1][1:]]
)
return u" ".join(fullname)
def get_reviews(query):