Changeset 5815 for main


Ignore:
Timestamp:
7 Mar 2011, 13:35:22 (14 years ago)
Author:
uli
Message:

Fix get_applicant_data to reflect new structure of applicant
containers, applicants root and the like.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py

    r5813 r5815  
    108108        return
    109109
    110 def get_applicant_data(reg_no, ac):
    111     """Validate credentials and return applicant data.
    112    
    113     Returns tuple ``(<APPLICANT_ENTRY>, <ACCESSCODE>) on
    114     successful validation and ``None`` else.
     110def get_applicant_data(identifier):
     111    """Get applicant data associated with `identifier`.
    115112
    116     We expect a JAMB registration number and an access code in format
     113    Returns the applicant object if successful and ``None`` else.
     114
     115    As `identifier` we expect an access code in format
    117116    like ``PREFIX-XXX-YYYYYYYY`` where ``PREFIX`` is something like
    118117    ``APP`` or ``PUDE``, ``XXX`` the access code series and
     
    120119    """
    121120    site = grok.getSite()
    122     if reg_no is not None:
    123         applicant_data = site['applications'].get(reg_no, None)
    124     else:
    125         # Non-JAMB-screened applicants are stored by ac as key...
    126         applicant_data = site['applications'].get(ac, None)
    127     access_code = get_access_code(ac)
    128     return (applicant_data, access_code)
     121    for container in site['applicants'].values():
     122        applicant_data = container.get(identifier, None)
     123        if applicant_data is not None:
     124            return applicant_data
     125    return None
    129126
    130127def application_exists(identifier):
Note: See TracChangeset for help on using the changeset viewer.