Changeset 7995 for main/waeup.custom/trunk/src/waeup/custom/students
- Timestamp:
- 28 Mar 2012, 06:23:25 (13 years ago)
- Location:
- main/waeup.custom/trunk/src/waeup/custom/students
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.custom/trunk/src/waeup/custom/students/browser.py
r7890 r7995 24 24 StudentPersonalDisplayFormPage, StudentPersonalManageFormPage, 25 25 StudentClearanceManageFormPage, StudentClearanceEditFormPage, 26 StudentClearanceDisplayFormPage) 26 StudentClearanceDisplayFormPage, 27 ExportPDFClearanceSlipPage) 27 28 from waeup.kofa.students.viewlets import RequestCallbackActionButton 28 29 from waeup.custom.students.interfaces import ( 29 IStudent, IStudentPersonal, IStudentClearance, IStudentClearanceEdit, 30 IStudent, IStudentPersonal, 31 IUGStudentClearance,IPGStudentClearance, 30 32 ) 31 33 from waeup.custom.interfaces import MessageFactory as _ … … 48 50 """ 49 51 grok.context(IStudent) 50 form_fields = grok.AutoFields(IStudentClearance).omit('clearance_locked') 51 form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') 52 53 @property 54 def form_fields(self): 55 cm = getattr(self.context,'current_mode', None) 56 if cm is not None and cm.startswith('pg'): 57 form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked') 58 else: 59 form_fields = grok.AutoFields(IUGStudentClearance).omit('clearance_locked') 60 form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') 61 return form_fields 62 63 class ExportPDFClearanceSlipPage(ExportPDFClearanceSlipPage): 64 """Deliver a PDF slip of the context. 65 """ 66 grok.context(IStudent) 67 68 @property 69 def form_fields(self): 70 cm = getattr(self.context,'current_mode', None) 71 if cm is not None and cm.startswith('pg'): 72 form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked') 73 else: 74 form_fields = grok.AutoFields(IUGStudentClearance).omit('clearance_locked') 75 form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') 76 return form_fields 52 77 53 78 class StudentClearanceManageFormPage(StudentClearanceManageFormPage): … … 55 80 """ 56 81 grok.context(IStudent) 57 form_fields = grok.AutoFields(IStudentClearance) 58 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') 82 83 @property 84 def form_fields(self): 85 cm = getattr(self.context,'current_mode', None) 86 if cm is not None and cm.startswith('pg'): 87 form_fields = grok.AutoFields(IPGStudentClearance) 88 else: 89 form_fields = grok.AutoFields(IUGStudentClearance) 90 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') 91 return form_fields 59 92 60 93 class StudentClearanceEditFormPage(StudentClearanceEditFormPage): … … 62 95 """ 63 96 grok.context(IStudent) 64 form_fields = grok.AutoFields( 65 IStudentClearanceEdit).omit('clearance_locked') 66 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') 97 98 @property 99 def form_fields(self): 100 cm = getattr(self.context,'current_mode', None) 101 if cm is not None and cm.startswith('pg'): 102 form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked') 103 else: 104 form_fields = grok.AutoFields(IUGStudentClearance).omit('clearance_locked') 105 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') 106 return form_fields 67 107 68 108 class RequestCallbackActionButton(RequestCallbackActionButton): -
main/waeup.custom/trunk/src/waeup/custom/students/interfaces.py
r7822 r7995 20 20 from waeup.kofa.interfaces import SimpleKofaVocabulary 21 21 from waeup.kofa.students.interfaces import ( 22 IStudentBase,IStudentClearance,IStudentPersonal,IStudentNavigation, 22 IStudentBase,IUGStudentClearance,IPGStudentClearance, 23 IStudentPersonal,IStudentNavigation, 23 24 ) 24 25 from waeup.kofa.students.vocabularies import ( … … 51 52 ) 52 53 53 class I StudentClearance(IStudentClearance):54 """Representation of student clearance data.54 class IUGStudentClearance(IUGStudentClearance): 55 """Representation of ug student clearance data. 55 56 56 57 """ … … 73 74 ) 74 75 75 class IStudent(IStudentBase,IStudentClearance,IStudentPersonal): 76 class IPGStudentClearance(IUGStudentClearance): 77 """Representation of pg student clearance data. 78 79 """ 80 81 class IStudent(IStudentBase,IUGStudentClearance,IPGStudentClearance,IStudentPersonal): 76 82 """Representation of a student. 77 83 78 84 """ 79 80 # Interfaces for students only81 82 class IStudentClearanceEdit(IStudentClearance):83 """Interface needed for restricted editing of student clearance data.84 85 """86 87 class IStudentPersonalEdit(IStudentPersonal):88 """Interface needed for restricted editing of student personal data.89 90 """ -
main/waeup.custom/trunk/src/waeup/custom/students/student.py
r7822 r7995 23 23 from waeup.kofa.utils.helpers import attrs_to_fields 24 24 from waeup.kofa.students.student import Student, StudentFactory 25 from waeup.custom.students.interfaces import ( 26 IStudent, IStudentNavigation, 27 IStudentPersonalEdit, IStudentClearanceEdit) 25 from waeup.custom.students.interfaces import IStudent, IStudentNavigation 28 26 29 27 … … 32 30 owned by students. 33 31 """ 34 grok.implements(IStudent, IStudentNavigation, 35 IStudentPersonalEdit, IStudentClearanceEdit) 32 grok.implements(IStudent, IStudentNavigation) 36 33 grok.provides(IStudent) 37 34 -
main/waeup.custom/trunk/src/waeup/custom/students/tests/sample_student_data.csv
r7894 r7995 1 firstname,lastname,reg_number,date_of_birth,matric_number,email,phone, lga,nationality2 Aaren,Pieri,1, 1990-01-02,100000,aa@aa.ng,12343 Aaren,Finau,2, 1990-01-03,100001,aa@aa.ng,12344 Aaren,Berson,3, 1990-01-04,100002,aa@aa.ng,12341 firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex 2 Aaren,Pieri,1,,100000,aa@aa.ng,1234,m 3 Aaren,Finau,2,,100001,aa@aa.ng,1234,m 4 Aaren,Berson,3,,100002,aa@aa.ng,1234,m -
main/waeup.custom/trunk/src/waeup/custom/students/tests/test_browser.py
r7934 r7995 72 72 73 73 def test_import(self): 74 # We added empty columns 'nationality' and 'lga' tothe import file.75 # The original processor will fail because these fields arerequired74 # We have an empty column 'date_of_birth' in the import file. 75 # The original processor will fail because 'date_of_birth' is required 76 76 # in the base package. 77 77 num, num_warns, fin_file, fail_file = self.processor_base.doImport( … … 79 79 self.assertEqual(num_warns,3) 80 80 assert len(self.app['students'].keys()) == 0 81 # The customized processor does not complain since both fields are81 # The customized processor does not complain since 'date_of_birth' is 82 82 # not required in the custom package. 83 83 num, num_warns, fin_file, fail_file = self.processor.doImport( 84 84 self.csv_file, STUDENT_HEADER_FIELDS) 85 #print open(fail_file).read() 85 86 self.assertEqual(num_warns,0) 86 87 assert len(self.app['students'].keys()) == 3 … … 103 104 # Managers can add online payment tickets 104 105 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 105 self.browser.open(self.payments_ student_path)106 self.browser.open(self.payments_path) 106 107 self.browser.getControl("Add online payment ticket").click() 107 108 self.browser.getControl("Create ticket").click() … … 109 110 self.browser.contents) 110 111 IWorkflowState(self.student).setState('cleared') 111 self.browser.open(self.payments_ student_path + '/addop')112 self.browser.open(self.payments_path + '/addop') 112 113 self.browser.getControl("Create ticket").click() 113 114 self.assertMatches('...ticket created...', … … 122 123 ticket.p_state = 'paid' 123 124 IWorkflowState(self.student).setState('returning') 124 self.browser.open(self.payments_ student_path + '/addop')125 self.browser.open(self.payments_path + '/addop') 125 126 self.browser.getControl("Create ticket").click() 126 127 self.assertMatches('...This type of payment has already been made...', … … 130 131 for payment in keys: 131 132 del self.student['payments'][payment] 132 self.browser.open(self.payments_ student_path + '/addop')133 self.browser.open(self.payments_path + '/addop') 133 134 self.browser.getControl("Create ticket").click() 134 135 self.assertMatches('...ticket created...', 135 136 self.browser.contents) 136 self.browser.open(self.payments_ student_path + '/addop')137 self.browser.open(self.payments_path + '/addop') 137 138 self.browser.getControl(name="form.p_category").value = ['gown'] 138 139 self.browser.getControl("Create ticket").click() 139 self.browser.open(self.payments_ student_path + '/addop')140 self.browser.open(self.payments_path + '/addop') 140 141 self.browser.getControl(name="form.p_category").value = ['transfer'] 141 142 self.browser.getControl("Create ticket").click() 142 self.browser.open(self.payments_ student_path + '/addop')143 self.browser.open(self.payments_path + '/addop') 143 144 self.browser.getControl( 144 145 name="form.p_category").value = ['bed_allocation'] 145 146 self.browser.getControl("Create ticket").click() 146 self.browser.open(self.payments_ student_path + '/addop')147 self.browser.open(self.payments_path + '/addop') 147 148 self.browser.getControl( 148 149 name="form.p_category").value = ['hostel_maintenance'] 149 150 self.browser.getControl("Create ticket").click() 150 self.browser.open(self.payments_ student_path + '/addop')151 self.browser.open(self.payments_path + '/addop') 151 152 self.browser.getControl(name="form.p_category").value = ['clearance'] 152 153 self.browser.getControl("Create ticket").click() 153 154 self.certificate.study_mode = 'ug_pt' 154 self.browser.open(self.payments_ student_path + '/addop')155 self.browser.open(self.payments_path + '/addop') 155 156 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 156 157 self.browser.getControl("Create ticket").click() … … 161 162 # be shown 162 163 del self.app['configuration']['2004'] 163 self.browser.open(self.payments_ student_path)164 self.browser.open(self.payments_path) 164 165 self.browser.getControl("Add online payment ticket").click() 165 166 self.browser.getControl("Create ticket").click() 166 167 self.assertMatches('...Session configuration object is not...', 167 168 self.browser.contents) 168 169
Note: See TracChangeset for help on using the changeset viewer.