[7569] | 1 | ## $Id: utils.py 16805 2022-02-14 10:07:26Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
[7822] | 18 | """Customize general helper utilities for Kofa. |
---|
[7569] | 19 | """ |
---|
[13963] | 20 | |
---|
| 21 | import string |
---|
[15965] | 22 | import grok |
---|
[8823] | 23 | from kofacustom.nigeria.utils.utils import NigeriaKofaUtils |
---|
[15451] | 24 | from waeup.kofa.students.workflow import ALUMNI_STATES |
---|
[7569] | 25 | |
---|
[8823] | 26 | class CustomKofaUtils(NigeriaKofaUtils): |
---|
[7569] | 27 | """A collection of methods subject to customization. |
---|
| 28 | """ |
---|
[7845] | 29 | |
---|
| 30 | PREFERRED_LANGUAGES_DICT = { |
---|
[9755] | 31 | } |
---|
| 32 | |
---|
[14650] | 33 | COURSE_CATEGORY_DICT = { |
---|
| 34 | 'C':'Core Course (C)', |
---|
| 35 | 'R':'Required Courses (R)', |
---|
| 36 | 'E':'Elective Courses (E)', |
---|
| 37 | } |
---|
| 38 | |
---|
[9755] | 39 | PAYMENT_CATEGORIES = { |
---|
| 40 | 'schoolfee': 'School Fee', |
---|
[13512] | 41 | 'schoolfee_1': 'School Fee Plus (1st instalment)', |
---|
| 42 | 'schoolfee_2': 'School Fee (2nd instalment)', |
---|
[13410] | 43 | 'schoolfee_incl': 'School Fee Plus', |
---|
[9755] | 44 | 'clearance': 'Acceptance Fee', |
---|
[13410] | 45 | 'clearance_incl': 'Acceptance Fee Plus', |
---|
[13424] | 46 | 'hostel_maintenance': 'Hostel Accommodation Fee', |
---|
[9755] | 47 | 'application': 'Application Fee', |
---|
[15555] | 48 | 'app_balance': 'Application Fee Balance', |
---|
[9755] | 49 | 'bed_allocation': 'Bed Allocation Fee', |
---|
| 50 | 'transfer': 'Transfer Fee', |
---|
[14296] | 51 | 'transcript_local': 'Local Transcript Fee', |
---|
| 52 | 'transcript_inter': 'International Transcript Fee', |
---|
[13035] | 53 | 'late_registration': 'Late Course Registration Fee', |
---|
[13402] | 54 | 'welfare': 'Student Welfare Assurance Fee', |
---|
[13463] | 55 | 'union': 'Student Union Dues', |
---|
[13402] | 56 | 'lapel': 'Lapel/File Fee', |
---|
[13374] | 57 | 'matric_gown': 'Matriculation Gown Fee', |
---|
| 58 | 'concessional': 'Concessional Fee', |
---|
[14234] | 59 | 'id_card': 'Student ID Card', |
---|
[14355] | 60 | 'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112', |
---|
| 61 | 'gst_text_book_1': 'Text Book Fee GST101 GST102', |
---|
| 62 | 'gst_text_book_2': 'Text Book Fee GST111 GST112', |
---|
[14258] | 63 | 'gst_text_book_3': 'Text Book Fee GST222', |
---|
[16754] | 64 | 'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112', |
---|
| 65 | 'gst_registration_2': 'Registration Fee GST222', |
---|
[14621] | 66 | 'ent_text_book_1': 'Text Book Fee ENT201', |
---|
[16749] | 67 | 'ent_text_book_2': 'Text Book Fee ENT211', |
---|
[16754] | 68 | 'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211', |
---|
[14620] | 69 | 'ent_registration_1': 'Registration Fee ENT201', |
---|
[16749] | 70 | 'ent_registration_2': 'Registration Fee ENT211', |
---|
[16754] | 71 | 'ent_registration_0': 'Registration Fee for ENT201 and ENT211', |
---|
[16805] | 72 | 'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211', |
---|
[15841] | 73 | 'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)', |
---|
[16669] | 74 | 'ict': 'ICT/Affidavit Dues', |
---|
[16181] | 75 | 'affidavit': 'Affidavit Dues', |
---|
[14375] | 76 | 'restitution': 'Restitution Fee', |
---|
[15971] | 77 | 'sports': 'Sports Fee', |
---|
[16124] | 78 | 'library': 'UG Library Fee', |
---|
| 79 | 'library_pg': 'PG Library Fee', |
---|
| 80 | 'sports_library': 'Sports Development and Library Fee', |
---|
[16080] | 81 | 'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)', |
---|
| 82 | 'lab_2': 'Laboratory Due (BIO101/BIO111)', |
---|
[9755] | 83 | } |
---|
| 84 | |
---|
| 85 | SELECTABLE_PAYMENT_CATEGORIES = { |
---|
[13435] | 86 | 'schoolfee': 'School Fee without additional fees', |
---|
[15971] | 87 | 'schoolfee_1': 'School Fee (1st instalment) incl. additional fees', |
---|
[13512] | 88 | 'schoolfee_2': 'School Fee (2nd instalment)', |
---|
[15971] | 89 | 'schoolfee_incl': 'School Fee incl. additional fees', |
---|
[13435] | 90 | 'clearance': 'Acceptance Fee without additional fees', |
---|
[15971] | 91 | 'clearance_incl': 'Acceptance Fee incl. additional fees', |
---|
[13454] | 92 | 'hostel_maintenance': 'Hostel Accommodation Fee', |
---|
[14243] | 93 | #'application': 'Application Fee', |
---|
[11621] | 94 | #'bed_allocation': 'Bed Allocation Fee', |
---|
| 95 | #'transfer': 'Transfer Fee', |
---|
[14296] | 96 | 'transcript_local': 'Local Transcript Fee', |
---|
| 97 | 'transcript_inter': 'International Transcript Fee', |
---|
[13035] | 98 | 'late_registration': 'Late Course Registration Fee', |
---|
[14243] | 99 | #'welfare': 'Student Welfare Assurance Fee', |
---|
| 100 | #'union': 'Student Union Dues', |
---|
| 101 | #'lapel': 'Lapel/File Fee', |
---|
| 102 | #'matric_gown': 'Matriculation Gown Fee', |
---|
[13374] | 103 | 'concessional': 'Concessional Fee', |
---|
[14243] | 104 | #'id_card': 'Student ID Card', |
---|
[14355] | 105 | 'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112', |
---|
| 106 | 'gst_text_book_1': 'Text Book Fee GST101 GST102', |
---|
| 107 | 'gst_text_book_2': 'Text Book Fee GST111 GST112', |
---|
[14258] | 108 | 'gst_text_book_3': 'Text Book Fee GST222', |
---|
[16754] | 109 | 'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112', |
---|
| 110 | 'gst_registration_2': 'Registration Fee GST222', |
---|
[14621] | 111 | 'ent_text_book_1': 'Text Book Fee ENT201', |
---|
[16749] | 112 | 'ent_text_book_2': 'Text Book Fee ENT211', |
---|
[16754] | 113 | 'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211', |
---|
[14620] | 114 | 'ent_registration_1': 'Registration Fee ENT201', |
---|
[16749] | 115 | 'ent_registration_2': 'Registration Fee ENT211', |
---|
[16754] | 116 | 'ent_registration_0': 'Registration Fee for ENT201 and ENT211', |
---|
[16805] | 117 | 'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211', |
---|
[16177] | 118 | #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)', |
---|
[16669] | 119 | 'ict': 'ICT/Affidavit Dues', |
---|
| 120 | #'affidavit': 'Affidavit Dues', |
---|
[14375] | 121 | 'restitution': 'Restitution Fee', |
---|
[16124] | 122 | 'sports': 'Sports Fee', |
---|
| 123 | 'library': 'UG Library Fee', |
---|
| 124 | 'library_pg': 'PG Library Fee', |
---|
| 125 | 'sports_library': 'Sports Development and Library Fee', |
---|
[16080] | 126 | 'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)', |
---|
| 127 | 'lab_2': 'Laboratory Due (BIO101/BIO111)', |
---|
[9755] | 128 | } |
---|
| 129 | |
---|
[15451] | 130 | ALUMNI_PAYMENT_CATS = { |
---|
| 131 | 'transcript_local': 'Transcript Fee Local', |
---|
| 132 | 'transcript_inter': 'Transcript Fee International', |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | REDUCED_PAYMENT_CATS = { |
---|
| 136 | 'clearance': 'Acceptance Fee', |
---|
| 137 | 'schoolfee': 'School Fee', |
---|
[15465] | 138 | 'late_registration': 'Late Course Registration Fee', |
---|
[16124] | 139 | 'sports': 'Sports Fee', |
---|
| 140 | 'library': 'UG Library Fee', |
---|
| 141 | 'library_pg': 'PG Library Fee', |
---|
| 142 | 'sports_library': 'Sports Development and Library Fee', |
---|
[15451] | 143 | } |
---|
| 144 | |
---|
| 145 | IJMBE_PAYMENT_CATS = { |
---|
| 146 | 'clearance': 'Acceptance Fee', |
---|
| 147 | 'schoolfee': 'School Fee', |
---|
| 148 | 'schoolfee_1': 'School Fee (1st instalment)', |
---|
| 149 | 'schoolfee_2': 'School Fee (2nd instalment)', |
---|
[16124] | 150 | 'sports': 'Sports Fee', |
---|
| 151 | 'library': 'UG Library Fee', |
---|
| 152 | 'library_pg': 'PG Library Fee', |
---|
| 153 | 'sports_library': 'Sports Development and Library Fee', |
---|
[15451] | 154 | } |
---|
| 155 | |
---|
| 156 | PT_AND_DSH_PAYMENT_CATS = { |
---|
| 157 | 'clearance_incl': 'Acceptance Fee Plus', |
---|
| 158 | 'schoolfee_incl': 'School Fee Plus', |
---|
[16754] | 159 | 'ent_text_book_1': 'Text Book Fee ENT201', |
---|
| 160 | 'ent_text_book_2': 'Text Book Fee ENT211', |
---|
| 161 | 'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211', |
---|
[15451] | 162 | 'ent_registration_1': 'Registration Fee ENT201', |
---|
[16749] | 163 | 'ent_registration_2': 'Registration Fee ENT211', |
---|
[16754] | 164 | 'ent_registration_0': 'Registration Fee for ENT201 and ENT211', |
---|
[15451] | 165 | 'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112', |
---|
| 166 | 'gst_registration_2': 'Registration Fee GST222', |
---|
| 167 | 'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112', |
---|
| 168 | 'gst_text_book_1': 'Text Book Fee GST101 GST102', |
---|
| 169 | 'gst_text_book_2': 'Text Book Fee GST111 GST112', |
---|
| 170 | 'gst_text_book_3': 'Text Book Fee GST222', |
---|
[16805] | 171 | 'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211', |
---|
[15862] | 172 | 'late_registration': 'Late Course Registration Fee', |
---|
[16124] | 173 | 'sports': 'Sports Fee', |
---|
| 174 | 'library': 'UG Library Fee', |
---|
| 175 | 'library_pg': 'PG Library Fee', |
---|
| 176 | 'sports_library': 'Sports Development and Library Fee', |
---|
[16080] | 177 | 'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)', |
---|
| 178 | 'lab_2': 'Laboratory Due (BIO101/BIO111)', |
---|
[15451] | 179 | } |
---|
| 180 | |
---|
[15433] | 181 | def selectable_payment_categories(self, student): |
---|
[15451] | 182 | if student.state in ALUMNI_STATES: |
---|
| 183 | return self.ALUMNI_PAYMENT_CATS |
---|
| 184 | if student.current_mode in ( |
---|
| 185 | 'special_pg_ft', 'special_pg_pt', 'found', 'bridge'): |
---|
| 186 | return self.REDUCED_PAYMENT_CATS |
---|
| 187 | if student.current_mode in ( |
---|
| 188 | 'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'): |
---|
| 189 | return self.PT_AND_DSH_PAYMENT_CATS |
---|
| 190 | if student.current_mode == 'ijmbe': |
---|
| 191 | return self.IJMBE_PAYMENT_CATS |
---|
[15433] | 192 | return self.SELECTABLE_PAYMENT_CATEGORIES |
---|
| 193 | |
---|
[13451] | 194 | REPORTABLE_PAYMENT_CATEGORIES = { |
---|
| 195 | 'schoolfee': 'School Fee', |
---|
[13452] | 196 | 'schoolfee_incl': 'School Fee Plus', |
---|
[13635] | 197 | 'schoolfee_1': 'School Fee 1 Plus', |
---|
| 198 | 'schoolfee_2': 'School Fee 2', |
---|
[13451] | 199 | 'clearance': 'Acceptance Fee', |
---|
[13452] | 200 | 'clearance_incl': 'Acceptance Fee Plus', |
---|
[13451] | 201 | 'hostel_maintenance': 'Hostel Maintenance Fee', |
---|
| 202 | } |
---|
| 203 | |
---|
[13638] | 204 | BALANCE_PAYMENT_CATEGORIES = { |
---|
| 205 | 'schoolfee': 'School Fee', |
---|
| 206 | 'clearance': 'Acceptance Fee', |
---|
| 207 | 'hostel_maintenance': 'Hostel Maintenance Fee', |
---|
[13750] | 208 | 'late_registration': 'Late Course Registration Fee', |
---|
| 209 | 'welfare': 'Student Welfare Assurance Fee', |
---|
| 210 | 'union': 'Student Union Dues', |
---|
| 211 | 'lapel': 'Lapel/File Fee', |
---|
| 212 | 'matric_gown': 'Matriculation Gown Fee', |
---|
[14234] | 213 | 'id_card': 'Student ID Card', |
---|
[14258] | 214 | 'gst_text_book_1': 'Text Book Fee GST101 GST102', |
---|
| 215 | 'gst_text_book_2': 'Text Book Fee GST111 GST112', |
---|
| 216 | 'gst_text_book_3': 'Text Book Fee GST222', |
---|
[16754] | 217 | 'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112', |
---|
| 218 | 'gst_registration_2': 'Registration Fee GST222', |
---|
[14621] | 219 | 'ent_text_book_1': 'Text Book Fee ENT201', |
---|
[16749] | 220 | 'ent_text_book_2': 'Text Book Fee ENT211', |
---|
[16754] | 221 | 'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211', |
---|
[14620] | 222 | 'ent_registration_1': 'Registration Fee ENT201', |
---|
[16749] | 223 | 'ent_registration_2': 'Registration Fee ENT211', |
---|
[16754] | 224 | 'ent_registration_0': 'Registration Fee for ENT201 and ENT211', |
---|
[16179] | 225 | #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)', |
---|
[16669] | 226 | 'ict': 'ICT/Affidavit Dues', |
---|
| 227 | #'affidavit': 'Affidavit Dues', |
---|
[14375] | 228 | 'restitution': 'Restitution Fee', |
---|
[13638] | 229 | } |
---|
| 230 | |
---|
[14544] | 231 | PREVIOUS_PAYMENT_CATEGORIES = { |
---|
| 232 | 'schoolfee': 'School Fee', |
---|
| 233 | 'clearance': 'Acceptance Fee', |
---|
[16552] | 234 | 'late_registration': 'Late Course Registration Fee', |
---|
[14544] | 235 | } |
---|
| 236 | |
---|
[10304] | 237 | APP_CATS_DICT = { |
---|
| 238 | 'basic': 'PUTME, PUDE, PCE, PRENCE', |
---|
| 239 | 'no': 'No Application', |
---|
| 240 | 'pg_ft': 'Postgraduate Full-Time', |
---|
| 241 | 'pg_pt': 'Postgraduate Part-Time', |
---|
| 242 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
| 243 | 'found': 'Foundation', |
---|
[10893] | 244 | 'ptee': 'Part-Time Entrance Examination', |
---|
[13568] | 245 | 'ioe_dp': 'Institute of Education Diploma', |
---|
[14339] | 246 | 'ijmbe': 'IJMBE Preparation', |
---|
[15224] | 247 | 'bridge': 'Bridge', |
---|
[15385] | 248 | 'dsh': 'Science and Humanities', |
---|
| 249 | |
---|
[10304] | 250 | } |
---|
| 251 | |
---|
[11591] | 252 | STUDY_MODES_DICT = { |
---|
| 253 | 'ug_ft': 'Undergraduate Full Time', |
---|
| 254 | 'ug_pt': 'Undergraduate Part Time', |
---|
[11593] | 255 | 'de_ft': 'Direct Entry Full Time', |
---|
| 256 | 'de_pt': 'Direct Entry Part Time', |
---|
[11591] | 257 | 'dp_pt': 'Diploma Part Time', |
---|
| 258 | 'dp_ft': 'Diploma Full Time', |
---|
[13524] | 259 | 'special_pg_ft': 'Postgraduate Full Time', |
---|
| 260 | 'special_pg_pt': 'Postgraduate Part Time', |
---|
[11591] | 261 | 'found': 'Foundation', |
---|
[13498] | 262 | 'transfer': 'Transfer', |
---|
[13749] | 263 | 'mug_ft': 'Undergraduate Full Time Merit List', |
---|
| 264 | 'mde_ft': 'Direct Entry Full Time Merit List', |
---|
[14339] | 265 | 'ijmbe': 'IJMBE Preparation', |
---|
[15217] | 266 | 'bridge': 'Bridge', |
---|
[15382] | 267 | 'ug_dsh': 'Undergraduate Science and Humanities', |
---|
| 268 | 'de_dsh': 'Direct Entry Science and Humanities', |
---|
[11591] | 269 | } |
---|
| 270 | |
---|
[14700] | 271 | ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT |
---|
| 272 | |
---|
[13127] | 273 | VERDICTS_DICT = { |
---|
| 274 | '0': 'not yet', |
---|
| 275 | 'A': 'Successful student', |
---|
| 276 | 'B': 'Student with carryover courses', |
---|
| 277 | 'C': 'Student on probation', |
---|
[14475] | 278 | 'D': 'Withdrawn from the faculty', |
---|
[13127] | 279 | #'E': 'Student who were previously on probation', |
---|
| 280 | #'F': 'Medical case', |
---|
| 281 | #'G': 'Absent from examination', |
---|
| 282 | #'H': 'Withheld results', |
---|
| 283 | #'I': 'Expelled/rusticated/suspended student', |
---|
| 284 | #'J': 'Temporary withdrawn from the university', |
---|
| 285 | #'K': 'Unregistered student', |
---|
| 286 | #'L': 'Referred student', |
---|
| 287 | #'M': 'Reinstatement', |
---|
| 288 | #'N': 'Student on transfer', |
---|
| 289 | #'O': 'NCE-III repeater', |
---|
| 290 | #'Y': 'No previous verdict', |
---|
| 291 | #'X': 'New 300 level student', |
---|
| 292 | 'Z': 'Successful student (provisional)', |
---|
| 293 | #'A1': 'First Class', |
---|
| 294 | #'A2': 'Second Class Upper', |
---|
| 295 | #'A3': 'Second Class Lower', |
---|
| 296 | #'A4': 'Third Class', |
---|
| 297 | #'A5': 'Pass', |
---|
| 298 | #'A6': 'Distinction', |
---|
| 299 | #'A7': 'Credit', |
---|
| 300 | #'A8': 'Merit', |
---|
[14487] | 301 | 'NER': 'No evidence of registration', |
---|
| 302 | 'NYV': 'Not yet verified', |
---|
[13127] | 303 | 'FRNS': 'Faculty requirements not satisfied', |
---|
| 304 | } |
---|
[13454] | 305 | |
---|
| 306 | DISABLE_PAYMENT_GROUP_DICT = { |
---|
| 307 | 'sf_all': 'School Fee - All Students', |
---|
[14246] | 308 | 'sf_pg': 'School Fee - Postgraduate Students', |
---|
[14571] | 309 | 'sf_ug_pt': 'School Fee - Undergraduate Part-Time Students', |
---|
[14246] | 310 | 'sf_found': 'School Fee - Foundation Students', |
---|
[13454] | 311 | 'maint_all': 'Accommodation Fee - All Students', |
---|
[13794] | 312 | 'cl_regular': 'Acceptance Fee - Regular Students', |
---|
[13454] | 313 | } |
---|
[13870] | 314 | |
---|
| 315 | MODE_GROUPS = { |
---|
| 316 | 'All': ('all',), |
---|
| 317 | 'Undergraduate Full-Time': ('ug_ft', 'mde_ft', 'mug_ft', 'de_ft'), |
---|
| 318 | 'Undergraduate Part-Time': ('ug_pt', 'de_pt'), |
---|
| 319 | 'Postgraduate': ('pg_ft','special_pg_ft', 'special_pg_pt'), |
---|
| 320 | 'Foundation Programme': ('found',), |
---|
| 321 | 'Institute of Education': ('dp_ft'), |
---|
[15242] | 322 | 'IJMBE Preparation': ('ijmbe',), |
---|
| 323 | 'Bridge': ('bridge',), |
---|
[13870] | 324 | } |
---|
[13963] | 325 | |
---|
[15431] | 326 | #: Maximum number of files listed in `finished` subfolder |
---|
| 327 | MAX_FILES = 5000 |
---|
| 328 | |
---|
[13963] | 329 | def fullname(self, firstname, lastname, middlename=None): |
---|
| 330 | """Construct fullname. |
---|
| 331 | """ |
---|
| 332 | try: |
---|
| 333 | lastname = lastname.upper() |
---|
| 334 | except AttributeError: |
---|
| 335 | pass |
---|
[14594] | 336 | # We remove single initial |
---|
| 337 | if firstname and len(firstname) == 1: |
---|
| 338 | firstname = '' |
---|
| 339 | if middlename and len(middlename) == 1: |
---|
| 340 | middlename = '' |
---|
| 341 | if lastname and len(lastname) == 1: |
---|
| 342 | lastname = '' |
---|
| 343 | # We construct givennames |
---|
| 344 | givennames = '' |
---|
| 345 | if middlename and firstname: |
---|
[13963] | 346 | givennames = '%s %s' % (firstname, middlename) |
---|
[14594] | 347 | elif firstname: |
---|
| 348 | givennames = firstname |
---|
| 349 | elif middlename: |
---|
| 350 | givennames = middlename |
---|
[13963] | 351 | givennames = string.capwords( |
---|
| 352 | givennames.replace('-', ' - ')).replace(' - ', '-') |
---|
[14594] | 353 | # We construct fullname |
---|
| 354 | fullname = '' |
---|
| 355 | if lastname and givennames: |
---|
| 356 | fullname = '%s, %s' % (lastname, givennames) |
---|
| 357 | elif lastname: |
---|
| 358 | fullname = lastname |
---|
| 359 | elif givennames: |
---|
| 360 | fullname = givennames |
---|
[13963] | 361 | if '<' in fullname: |
---|
| 362 | return 'XXX' |
---|
| 363 | return fullname |
---|
[15965] | 364 | |
---|
| 365 | def getUsers(self): |
---|
| 366 | users = sorted( |
---|
| 367 | grok.getSite()['users'].items(), key=lambda x: x[0]) |
---|
| 368 | for key, val in users: |
---|
| 369 | yield(dict(name=key, val="%s - %s" % (val.name, val.title))) |
---|