- Timestamp:
- 16 Jun 2014, 08:29:22 (11 years ago)
- 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 21 21 from waeup.kofa.applicants.applicant import ApplicantFactory 22 22 from waeup.kofa.utils.helpers import attrs_to_fields 23 from kofacustom.nigeria.applicants.applicant import NigeriaApplicant24 from kofacustom.s keleton.applicants.interfaces import(25 ICustomApplicant, ICustom UGApplicantEdit, ICustomPGApplicantEdit, IPUTMEApplicantEdit)23 from waeup.kofa.applicants.applicant import Applicant 24 from kofacustom.sampleuni.applicants.interfaces import( 25 ICustomApplicant, ICustomApplicantEdit) 26 26 27 class CustomApplicant( NigeriaApplicant):27 class CustomApplicant(Applicant): 28 28 29 grok.implements(ICustomApplicant, ICustomUGApplicantEdit, 30 ICustomPGApplicantEdit, IPUTMEApplicantEdit) 29 grok.implements(ICustomApplicant, ICustomApplicantEdit) 31 30 grok.provides(ICustomApplicant) 32 31 -
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/batching.py
r11543 r11687 20 20 from waeup.kofa.utils.batching import BatchProcessor 21 21 from waeup.kofa.applicants.batching import ApplicantProcessor 22 from kofacustom.skeleton.applicants.interfaces import ( 23 ICustomApplicant, ICustomApplicantUpdateByRegNo) 22 from kofacustom.sampleuni.applicants.interfaces import ICustomApplicant 24 23 25 24 class CustomApplicantProcessor(ApplicantProcessor): … … 36 35 """ 37 36 iface = ICustomApplicant 38 iface_byregnumber = ICustomApplicantUpdateByRegNo -
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/browser.py
r10765 r11687 21 21 from waeup.kofa.applicants.browser import ( 22 22 ApplicantRegistrationPage, ApplicantsContainerPage) 23 from kofacustom.nigeria.applicants.browser import ( 24 NigeriaApplicantDisplayFormPage, 25 NigeriaPDFApplicationSlip) 23 from kofacustom.sampleuni.interfaces import MessageFactory as _ 26 24 27 from kofacustom.skeleton.interfaces import MessageFactory as _28 -
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/export.py
r11543 r11687 20 20 import grok 21 21 from 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) 22 from waeup.kofa.applicants.export import ApplicantsExporter 23 from kofacustom.sampleuni.applicants.interfaces import ICustomApplicant 27 24 28 class CustomApplicantsExporter( NigeriaApplicantsExporter):25 class CustomApplicantsExporter(ApplicantsExporter): 29 26 """Exporter for Custom Applicants. 30 27 """ 31 28 32 29 fields = tuple(sorted(set( 33 ICustomUGApplicant.names() + 34 ICustomPGApplicant.names() + 35 INigeriaUGApplicant.names() + 36 INigeriaPGApplicant.names() + 30 ICustomApplicant.names() + 37 31 IApplicantBaseData.names() 38 32 ))) + ('container_code',) -
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/interfaces.py
r10765 r11687 19 19 """ 20 20 21 from zope import schema22 21 from waeup.kofa.applicants.interfaces import ( 23 22 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, 38 25 ) 39 from kofacustom.skeleton.interfaces import MessageFactory as _ 40 from kofacustom.skeleton.payments.interfaces import ICustomOnlinePayment 26 from kofacustom.sampleuni.interfaces import MessageFactory as _ 41 27 42 class ICustom UGApplicant(INigeriaUGApplicant):43 """A n undergraduateapplicant.28 class ICustomApplicant(IApplicantBaseData): 29 """A custom applicant. 44 30 45 This interface defines the least common multiple of all fields46 in ug application forms. In customized forms, fields can be excluded by47 adding them to the UG_OMIT* tuples.48 31 """ 49 32 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. 33 class ICustomApplicantEdit(IApplicantEdit): 34 """A custom applicant interface for editing. 80 35 81 36 Here we can repeat the fields from base data and set the … … 88 43 """ 89 44 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. 45 class ICustomApplicantOnlinePayment(IApplicantOnlinePayment): 46 """A custom applicant payment via payment gateways. 104 47 105 48 """ 106 49 107 class IPUTMEApplicantEdit(IPUTMEApplicantEdit):108 """An undergraduate applicant interface for editing.109 110 Here we can repeat the fields from base data and set the111 `required` and `readonly` attributes to True to further restrict112 the data access. Or we can allow only certain certificates to be113 selected by choosing the appropriate source.114 115 We cannot omit fields here. This has to be done in the116 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 finding123 the applicant object.124 """ -
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/payment.py
r10765 r11687 24 24 from waeup.kofa.applicants.payment import ApplicantOnlinePayment 25 25 from waeup.kofa.utils.helpers import attrs_to_fields 26 from kofacustom.s keleton.applicants.interfaces import ICustomApplicantOnlinePayment26 from kofacustom.sampleuni.applicants.interfaces import ICustomApplicantOnlinePayment 27 27 28 28 class CustomApplicantOnlinePayment(ApplicantOnlinePayment): -
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/tests/test_applicant.py
r10765 r11687 30 30 from waeup.kofa.interfaces import IFileStoreHandler, IFileStoreNameChooser 31 31 from waeup.kofa.testing import FunctionalTestCase 32 from kofacustom.s keleton.applicants.applicant import (32 from kofacustom.sampleuni.applicants.applicant import ( 33 33 CustomApplicant, CustomApplicantFactory, 34 34 ) 35 from kofacustom.s keleton.applicants.interfaces import ICustomApplicant36 from kofacustom.s keleton.testing import FunctionalLayer35 from kofacustom.sampleuni.applicants.interfaces import ICustomApplicant 36 from kofacustom.sampleuni.testing import FunctionalLayer 37 37 38 38 class CustomApplicantTest(FunctionalTestCase): -
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/tests/test_browser.py
r11543 r11687 24 24 from zope.catalog.interfaces import ICatalog 25 25 from zope.intid.interfaces import IIntIds 26 from kofacustom.skeleton.testing import FunctionalLayer 26 from kofacustom.sampleuni.testing import FunctionalLayer 27 from waeup.kofa.schoolgrades import ResultEntry 28 from waeup.kofa.utils.utils import KofaUtils 27 29 from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup 28 30 from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup 29 from kofacustom.s keleton.applicants.export import CustomApplicantsExporter30 from kofacustom.s keleton.applicants.batching import CustomApplicantProcessor31 from kofacustom.sampleuni.applicants.export import CustomApplicantsExporter 32 from kofacustom.sampleuni.applicants.batching import CustomApplicantProcessor 31 33 32 34 class CustomApplicantUITests(ApplicantsFullSetup): … … 53 55 applicant.lastname = u'Tester' 54 56 applicant.middlename = u'M.' 55 applicant.nationality = u'NG'56 57 applicant.date_of_birth = datetime.date(1981, 2, 4) 57 58 applicant.sex = 'f' … … 62 63 applicant.course_admitted = self.certificate 63 64 applicant.notice = u'Some notice\nin lines.' 64 applicant.screening_score = 9865 applicant.screening_venue = u'Exam Room'66 applicant.screening_date = u'Saturday, 16th June 2012 2:00:00 PM'67 65 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] 68 72 return applicant 69 73 … … 75 79 exporter.export_all(self.app, self.outfile) 76 80 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) 96 95 # We can import the same file if we ignore some columns. 97 96 # Since the applicants_catalog hasn't been notified, the same … … 100 99 result = processor.doImport( 101 100 self.outfile, 102 [' aggreagate','ignore_applicant_id','application_date',101 ['ignore_applicant_id','application_date', 103 102 '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'], 115 109 mode='create') 116 110 num_succ, num_fail, finished_path, failed_path = result … … 118 112 self.assertEqual(num_succ,1) 119 113 self.assertEqual(num_fail,0) 120 # Now we ignore also the container_code and import the same file121 # in update mode which means that INigeriaApplicantUpdateByRegNo122 # is used for field conversion. applicant_id must be ignored123 # too since the previous import has notified the applicants_catalog124 # 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 = result142 self.assertEqual(num_succ,1)143 self.assertEqual(num_fail,0)144 114 return -
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/utils.py
r10765 r11687 19 19 """ 20 20 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 _ 21 from waeup.kofa.applicants.utils import ApplicantsUtils 22 from kofacustom.sampleuni.interfaces import MessageFactory as _ 25 23 26 27 28 class ApplicantsUtils(NigeriaApplicantsUtils): 24 class ApplicantsUtils(ApplicantsUtils): 29 25 """A collection of parameters and methods subject to customization. 30 26 """
Note: See TracChangeset for help on using the changeset viewer.