Ignore:
Timestamp:
16 Jun 2014, 08:29:22 (11 years ago)
Author:
Henrik Bettermann
Message:

Remove dependencies on kofacustom.nigeria.

Location:
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni
Files:
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/applicant.py

    r10765 r11687  
    2121from waeup.kofa.applicants.applicant import ApplicantFactory
    2222from waeup.kofa.utils.helpers import attrs_to_fields
    23 from kofacustom.nigeria.applicants.applicant import NigeriaApplicant
    24 from kofacustom.skeleton.applicants.interfaces import(
    25     ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit, IPUTMEApplicantEdit)
     23from waeup.kofa.applicants.applicant import Applicant
     24from kofacustom.sampleuni.applicants.interfaces import(
     25    ICustomApplicant, ICustomApplicantEdit)
    2626
    27 class CustomApplicant(NigeriaApplicant):
     27class CustomApplicant(Applicant):
    2828
    29     grok.implements(ICustomApplicant, ICustomUGApplicantEdit,
    30         ICustomPGApplicantEdit, IPUTMEApplicantEdit)
     29    grok.implements(ICustomApplicant, ICustomApplicantEdit)
    3130    grok.provides(ICustomApplicant)
    3231
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/batching.py

    r11543 r11687  
    2020from waeup.kofa.utils.batching import BatchProcessor
    2121from waeup.kofa.applicants.batching import ApplicantProcessor
    22 from kofacustom.skeleton.applicants.interfaces import (
    23     ICustomApplicant, ICustomApplicantUpdateByRegNo)
     22from kofacustom.sampleuni.applicants.interfaces import ICustomApplicant
    2423
    2524class CustomApplicantProcessor(ApplicantProcessor):
     
    3635    """
    3736    iface = ICustomApplicant
    38     iface_byregnumber = ICustomApplicantUpdateByRegNo
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/browser.py

    r10765 r11687  
    2121from waeup.kofa.applicants.browser import (
    2222    ApplicantRegistrationPage, ApplicantsContainerPage)
    23 from kofacustom.nigeria.applicants.browser import (
    24     NigeriaApplicantDisplayFormPage,
    25     NigeriaPDFApplicationSlip)
     23from kofacustom.sampleuni.interfaces import MessageFactory as _
    2624
    27 from kofacustom.skeleton.interfaces import MessageFactory as _
    28 
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/export.py

    r11543 r11687  
    2020import grok
    2121from waeup.kofa.applicants.interfaces import IApplicantBaseData
    22 from kofacustom.nigeria.applicants.export import NigeriaApplicantsExporter
    23 from kofacustom.nigeria.applicants.interfaces import (
    24     INigeriaUGApplicant, INigeriaPGApplicant)
    25 from kofacustom.skeleton.applicants.interfaces import (
    26     ICustomUGApplicant, ICustomPGApplicant)
     22from waeup.kofa.applicants.export import ApplicantsExporter
     23from kofacustom.sampleuni.applicants.interfaces import ICustomApplicant
    2724
    28 class CustomApplicantsExporter(NigeriaApplicantsExporter):
     25class CustomApplicantsExporter(ApplicantsExporter):
    2926    """Exporter for Custom Applicants.
    3027    """
    3128
    3229    fields = tuple(sorted(set(
    33         ICustomUGApplicant.names() +
    34         ICustomPGApplicant.names() +
    35         INigeriaUGApplicant.names() +
    36         INigeriaPGApplicant.names() +
     30        ICustomApplicant.names() +
    3731        IApplicantBaseData.names()
    3832        ))) + ('container_code',)
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/interfaces.py

    r10765 r11687  
    1919"""
    2020
    21 from zope import schema
    2221from waeup.kofa.applicants.interfaces import (
    2322    IApplicantBaseData,
    24     AppCatCertificateSource, CertificateSource)
    25 from waeup.kofa.schoolgrades import ResultEntryField
    26 from waeup.kofa.interfaces import (
    27     SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
    28 from waeup.kofa.schema import FormattedDate, TextLineChoice
    29 from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
    30 from waeup.kofa.applicants.interfaces import contextual_reg_num_source
    31 from kofacustom.nigeria.applicants.interfaces import (
    32     LGASource, high_qual, high_grade, exam_types,
    33     INigeriaUGApplicant, INigeriaPGApplicant,
    34     INigeriaApplicantOnlinePayment,
    35     INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
    36     INigeriaApplicantUpdateByRegNo,
    37     IPUTMEApplicantEdit,
     23    IApplicantOnlinePayment,
     24    IApplicantEdit,
    3825    )
    39 from kofacustom.skeleton.interfaces import MessageFactory as _
    40 from kofacustom.skeleton.payments.interfaces import ICustomOnlinePayment
     26from kofacustom.sampleuni.interfaces import MessageFactory as _
    4127
    42 class ICustomUGApplicant(INigeriaUGApplicant):
    43     """An undergraduate applicant.
     28class ICustomApplicant(IApplicantBaseData):
     29    """A custom applicant.
    4430
    45     This interface defines the least common multiple of all fields
    46     in ug application forms. In customized forms, fields can be excluded by
    47     adding them to the UG_OMIT* tuples.
    4831    """
    4932
    50 class ICustomPGApplicant(INigeriaPGApplicant):
    51     """A postgraduate applicant.
    52 
    53     This interface defines the least common multiple of all fields
    54     in pg application forms. In customized forms, fields can be excluded by
    55     adding them to the PG_OMIT* tuples.
    56     """
    57 
    58 
    59 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
    60     """An interface for both types of applicants.
    61 
    62     Attention: The ICustomPGApplicant field seetings will be overwritten
    63     by ICustomPGApplicant field settings. If a field is defined
    64     in both interfaces zope.schema validates only against the
    65     constraints in ICustomUGApplicant. This does not affect the forms
    66     since they are build on either ICustomUGApplicant or ICustomPGApplicant.
    67     """
    68 
    69     def writeLogMessage(view, comment):
    70         """Adds an INFO message to the log file
    71         """
    72 
    73     def createStudent():
    74         """Create a student object from applicant data
    75         and copy applicant object.
    76         """
    77 
    78 class ICustomUGApplicantEdit(INigeriaUGApplicantEdit):
    79     """An undergraduate applicant interface for edit forms.
     33class ICustomApplicantEdit(IApplicantEdit):
     34    """A custom applicant interface for editing.
    8035
    8136    Here we can repeat the fields from base data and set the
     
    8843    """
    8944
    90 class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
    91     """A postgraduate applicant interface for editing.
    92 
    93     Here we can repeat the fields from base data and set the
    94     `required` and `readonly` attributes to True to further restrict
    95     the data access. Or we can allow only certain certificates to be
    96     selected by choosing the appropriate source.
    97 
    98     We cannot omit fields here. This has to be done in the
    99     respective form page.
    100     """
    101 
    102 class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
    103     """An applicant payment via payment gateways.
     45class ICustomApplicantOnlinePayment(IApplicantOnlinePayment):
     46    """A custom applicant payment via payment gateways.
    10447
    10548    """
    10649
    107 class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
    108     """An undergraduate applicant interface for editing.
    109 
    110     Here we can repeat the fields from base data and set the
    111     `required` and `readonly` attributes to True to further restrict
    112     the data access. Or we can allow only certain certificates to be
    113     selected by choosing the appropriate source.
    114 
    115     We cannot omit fields here. This has to be done in the
    116     respective form page.
    117     """
    118 
    119 class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
    120     """Representation of an applicant.
    121 
    122     Skip regular reg_number validation if reg_number is used for finding
    123     the applicant object.
    124     """
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/payment.py

    r10765 r11687  
    2424from waeup.kofa.applicants.payment import ApplicantOnlinePayment
    2525from waeup.kofa.utils.helpers import attrs_to_fields
    26 from kofacustom.skeleton.applicants.interfaces import ICustomApplicantOnlinePayment
     26from kofacustom.sampleuni.applicants.interfaces import ICustomApplicantOnlinePayment
    2727
    2828class CustomApplicantOnlinePayment(ApplicantOnlinePayment):
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/tests/test_applicant.py

    r10765 r11687  
    3030from waeup.kofa.interfaces import IFileStoreHandler, IFileStoreNameChooser
    3131from waeup.kofa.testing import FunctionalTestCase
    32 from kofacustom.skeleton.applicants.applicant import (
     32from kofacustom.sampleuni.applicants.applicant import (
    3333    CustomApplicant, CustomApplicantFactory,
    3434    )
    35 from kofacustom.skeleton.applicants.interfaces import ICustomApplicant
    36 from kofacustom.skeleton.testing import FunctionalLayer
     35from kofacustom.sampleuni.applicants.interfaces import ICustomApplicant
     36from kofacustom.sampleuni.testing import FunctionalLayer
    3737
    3838class CustomApplicantTest(FunctionalTestCase):
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/tests/test_browser.py

    r11543 r11687  
    2424from zope.catalog.interfaces import ICatalog
    2525from zope.intid.interfaces import IIntIds
    26 from kofacustom.skeleton.testing import FunctionalLayer
     26from kofacustom.sampleuni.testing import FunctionalLayer
     27from waeup.kofa.schoolgrades import ResultEntry
     28from waeup.kofa.utils.utils import KofaUtils
    2729from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup
    2830from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup
    29 from kofacustom.skeleton.applicants.export import CustomApplicantsExporter
    30 from kofacustom.skeleton.applicants.batching import CustomApplicantProcessor
     31from kofacustom.sampleuni.applicants.export import CustomApplicantsExporter
     32from kofacustom.sampleuni.applicants.batching import CustomApplicantProcessor
    3133
    3234class CustomApplicantUITests(ApplicantsFullSetup):
     
    5355        applicant.lastname = u'Tester'
    5456        applicant.middlename = u'M.'
    55         applicant.nationality = u'NG'
    5657        applicant.date_of_birth = datetime.date(1981, 2, 4)
    5758        applicant.sex = 'f'
     
    6263        applicant.course_admitted = self.certificate
    6364        applicant.notice = u'Some notice\nin lines.'
    64         applicant.screening_score = 98
    65         applicant.screening_venue = u'Exam Room'
    66         applicant.screening_date = u'Saturday, 16th June 2012 2:00:00 PM'
    6765        applicant.password = 'any password'
     66        result_entry = ResultEntry(
     67            KofaUtils.EXAM_SUBJECTS_DICT.keys()[0],
     68            KofaUtils.EXAM_GRADES[0][0]
     69            )
     70        applicant.school_grades = [
     71            result_entry]
    6872        return applicant
    6973
     
    7579        exporter.export_all(self.app, self.outfile)
    7680        result = open(self.outfile, 'rb').read()
    77         self.assertMatches(result,
    78             'aggregate,applicant_id,application_date,application_number,'
    79             'course1,course2,course_admitted,date_of_birth,display_fullname,'
    80             'email,emp2_end,emp2_position,emp2_reason,emp2_start,emp_end,'
    81             'emp_position,emp_reason,emp_start,employer,employer2,'
    82             'firstname,history,hq_degree,hq_disc,hq_matric_no,hq_school,'
    83             'hq_session,hq_type,jamb_score,jamb_subjects,lastname,lga,'
    84             'locked,middlename,nationality,notice,nysc_lga,nysc_year,'
    85             'password,phone,pp_school,presently_inst,reg_number,'
    86             'result_uploaded,screening_date,screening_score,'
    87             'screening_venue,sex,special_application,'
    88             'state,student_id,suspended,container_code\r\n'
    89             ',dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,'
    90             'Anna M. Tester,anna@sample.com,,,,,,,,,,,Anna,'
    91             '[u\'2012-10-28 21:27:52 WAT - Application initialized by system\']'
    92             ',,,,,,,,,Tester,,0,M.,NG,"Some notice\nin lines.",,,'
    93             'any password,+234-123-12345#,,,123456,,'
    94             '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,,initialized,,'
    95             '0,dp2011\r\n')
     81        self.assertTrue(
     82            'applicant_id,application_date,application_number,course1,course2,'
     83            'course_admitted,date_of_birth,display_fullname,email,firstname,'
     84            'history,lastname,locked,middlename,notice,password,phone,'
     85            'reg_number,sex,special_application,state,'
     86            'student_id,suspended,container_code\r\n'
     87            'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,'
     88            'Anna M. Tester,anna@sample.com,Anna,'
     89            in result)
     90        self.assertTrue(
     91            'Application initialized by system\'],'
     92            'Tester,0,M.,"Some notice\nin lines.",any password,'
     93            '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n'
     94            in result)
    9695        # We can import the same file if we ignore some columns.
    9796        # Since the applicants_catalog hasn't been notified, the same
     
    10099        result = processor.doImport(
    101100            self.outfile,
    102             ['aggreagate','ignore_applicant_id','application_date',
     101            ['ignore_applicant_id','application_date',
    103102            'ignore_application_number','course1','course2',
    104             'course_admitted','date_of_birth','ignore3','email','emp2_end',
    105             'emp2_position','emp2_reason','emp2_start','emp_end','emp_position',
    106             'emp_reason','emp_start','employer','employer2','firstname','ignore4',
    107             'hq_degree','hq_disc','hq_matric_no','hq_school','hq_session','hq_type',
    108             'jamb_score','jamb_subjects','lastname','lga','locked','middlename',
    109             'nationality','notice','nysc_lga',
    110             'nysc_year','password','phone','pp_school','presently_inst',
    111             'reg_number','result_uploaded',
    112             'screening_date','screening_score','screening_venue','sex',
    113             'special_application',
    114             'state','student_id','suspended','container_code'],
     103            'course_admitted','date_of_birth',
     104            'ignore_display_fullname','email','firstname',
     105            'ignore_history','lastname','locked','middlename',
     106            'notice','password','phone',
     107            'reg_number','sex','special_application','state',
     108            'student_id','suspended','container_code'],
    115109            mode='create')
    116110        num_succ, num_fail, finished_path, failed_path = result
     
    118112        self.assertEqual(num_succ,1)
    119113        self.assertEqual(num_fail,0)
    120         # Now we ignore also the container_code and import the same file
    121         # in update mode which means that INigeriaApplicantUpdateByRegNo
    122         # is used for field conversion. applicant_id must be ignored
    123         # too since the previous import has notified the applicants_catalog
    124         # so that the portal 'knows' that reg_number is in use.
    125         processor = CustomApplicantProcessor()
    126         result = processor.doImport(
    127             self.outfile,
    128             ['aggregate','ignore_applicant_id','application_date',
    129             'ignore_application_number','course1','course2',
    130             'course_admitted','date_of_birth','ignore3','email','emp2_end',
    131             'emp2_position','emp2_reason','emp2_start','emp_end','emp_position',
    132             'emp_reason','emp_start','employer','employer2','firstname','ignore4',
    133             'hq_degree','hq_disc','hq_matric_no','hq_school','hq_session','hq_type',
    134             'jamb_score','jamb_subjects','lastname','lga','locked','middlename',
    135             'nationality','notice','nysc_lga',
    136             'nysc_year','password','phone','pp_school','presently_inst',
    137             'reg_number','result_uploaded','screening_date','screening_score',
    138             'screening_venue','sex','special_application',
    139             'state','student_id','suspended','ignore_container_code'],
    140             mode='update')
    141         num_succ, num_fail, finished_path, failed_path = result
    142         self.assertEqual(num_succ,1)
    143         self.assertEqual(num_fail,0)
    144114        return
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/utils.py

    r10765 r11687  
    1919"""
    2020
    21 from kofacustom.nigeria.applicants.utils import NigeriaApplicantsUtils
    22 from waeup.kofa.applicants.workflow import (INITIALIZED,
    23     STARTED, PAID, ADMITTED, NOT_ADMITTED, SUBMITTED, CREATED)
    24 from kofacustom.skeleton.interfaces import MessageFactory as _
     21from waeup.kofa.applicants.utils import ApplicantsUtils
     22from kofacustom.sampleuni.interfaces import MessageFactory as _
    2523
    26 
    27 
    28 class ApplicantsUtils(NigeriaApplicantsUtils):
     24class ApplicantsUtils(ApplicantsUtils):
    2925    """A collection of parameters and methods subject to customization.
    3026    """
Note: See TracChangeset for help on using the changeset viewer.