Ignore:
Timestamp:
25 Jul 2021, 21:56:36 (3 years ago)
Author:
Henrik Bettermann
Message:

Change regular expression for JAMB reg number validation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/interfaces.py

    r16553 r16558  
    2020"""
    2121
     22import re
    2223from zope import schema
    2324from zope.component import getUtility
     
    5152from kofacustom.iuokada.payments.interfaces import ICustomOnlinePayment
    5253
     54# Define a validation method for JAMB reg numbers
     55class NotJAMBRegNumber2(schema.ValidationError):
     56    __doc__ = u"Your JAMB detail is not valid for this admission session, contact admission office for details."
     57
     58#: Regular expression to check jamb_reg_number formats.
     59check_jamb_reg_number_2 = re.compile(r"^1\d{7}[A-Z]{2}$").match
     60
     61def validate_jamb_reg_number_2(value):
     62    if not check_jamb_reg_number_2(value):
     63        raise NotJAMBRegNumber2(value)
     64    return True
     65
     66
    5367sponsors_vocab = SimpleKofaVocabulary(
    5468    (_('Bauchi Government'), 'bauchi'),
     
    691705        title = _(u'JAMB Registration Number'),
    692706        required = True,
    693         constraint=validate_jamb_reg_number,
     707        constraint=validate_jamb_reg_number_2, # temporarily in 2021
    694708        description = _(u'Use all CAPS when entering the field.'),
    695709        )
Note: See TracChangeset for help on using the changeset viewer.