Ignore:
Timestamp:
7 Sep 2022, 08:39:42 (2 years ago)
Author:
Henrik Bettermann
Message:

Import polling units, wards, lgas and states from csv files.

Location:
main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants
Files:
4 added
1 edited

Legend:

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

    r17073 r17086  
    2020
    2121from zope import schema
     22import unicodecsv
     23import os
    2224from zope.interface import Interface, Attribute, implements, directlyProvides
    2325from waeup.kofa.applicants.interfaces import (
     
    3840    INigeriaApplicantOnlinePayment,)
    3941
     42def make_dict(filename, depth):
     43    wards = unicodecsv.reader(
     44        open(os.path.dirname(__file__)  + '/%s'%filename, 'rb'))
     45    result = dict()
     46    for row in wards:
     47        result['_'.join(row[0:depth])] = row[depth]
     48    return result
     49
     50STATES = make_dict('states.csv', 1)
     51LGAS = make_dict('lgas.csv', 2)
     52WARDS = make_dict('wards.csv', 3)
     53PUNITS = make_dict('punits.csv', 4)
     54   
    4055class IApplicantBaseData(IKofaObject):
    4156    """This is a base interface of an applicant with no field
Note: See TracChangeset for help on using the changeset viewer.