- Timestamp:
- 30 Aug 2026, 11:16:40 (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.unidel/trunk/src/kofacustom/unidel/utils/utils.py
r18313 r18317 18 18 """Customize general helper utilities for Kofa. 19 19 """ 20 import string 20 21 from copy import deepcopy 21 22 from kofacustom.nigeria.utils.utils import NigeriaKofaUtils … … 151 152 'alero': 'Owa-Alero Campus Hostel', 152 153 } 154 155 def fullname(self, firstname, lastname, middlename=None): 156 """Construct fullname. 157 """ 158 try: 159 lastname = lastname.upper() 160 except AttributeError: 161 pass 162 # We remove single initial 163 if firstname and len(firstname) == 1: 164 firstname = '' 165 if middlename and len(middlename) == 1: 166 middlename = '' 167 if lastname and len(lastname) == 1: 168 lastname = '' 169 # We construct givennames 170 givennames = '' 171 if middlename and firstname: 172 givennames = '%s %s' % (firstname, middlename) 173 elif firstname: 174 givennames = firstname 175 elif middlename: 176 givennames = middlename 177 givennames = string.capwords( 178 givennames.replace('-', ' - ')).replace(' - ', '-') 179 # We construct fullname 180 fullname = '' 181 if lastname and givennames: 182 fullname = '%s, %s' % (lastname, givennames) 183 elif lastname: 184 fullname = lastname 185 elif givennames: 186 fullname = givennames 187 if '<' in fullname: 188 return 'XXX' 189 return fullname
Note: See TracChangeset for help on using the changeset viewer.
