Ignore:
Timestamp:
19 Aug 2007, 15:10:14 (17 years ago)
Author:
joachim
Message:

fix state lga in formatLGA

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Students.py

    r2124 r2125  
    1616from Products.CPSCore.CPSMembershipTool import CPSUnrestrictedUser
    1717from Products.WAeUP_SRP.Academics import makeCertificateCode
     18
    1819from Products.AdvancedQuery import Eq, Between, Le,In
    1920import DateTime
     
    9798###)
    9899
    99 def formatLGA(lga):
    100     if lga.find('_') > -1:
    101         lgadic = lga.split('_')
    102         return lgadic[0].upper(),lgadic[1].upper()
    103     if lga.find('/') > -1:
    104         lgadic = lga.split('/')
    105         return lgadic[0].upper(),lgadic[1].upper()
    106     return "",lga
     100def formatLGA(lga,voc=None):
     101    if voc is not None:
     102        if voc.has_key(lga):
     103            state,lga = voc[lga].split(' / ')
     104        elif lga.find(' / ') > -1:
     105            state,lga = lga.split(' / ')
     106        else:
     107            state,lga = "",lga
     108    return state.upper(),lga.upper()
    107109
    108110class StudentsFolder(CPSDocument): ###(
     
    9991001                continue
    10001002            if with_lga:
    1001                 d['state'],d['lga'] = formatLGA(d['lga'])
     1003                d['state'],d['lga'] = formatLGA(d['lga'],voc = self.portal_vocabularies.local_gov_areas)
    10021004            lines.append(format % d)
    10031005            total += 1
     
    10611063            not_all = False
    10621064            d = self.getFormattedStudentEntry(student)
    1063             d['state'],d['lga'] = formatLGA(d['lga'])
     1065            d['state'],d['lga'] = formatLGA(d['lga'],voc = self.portal_vocabularies.local_gov_areas)
    10641066            lines.append(format % d)
    10651067            total += 1
Note: See TracChangeset for help on using the changeset viewer.