Changeset 7150 for main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
- Timestamp:
- 20 Nov 2011, 07:35:35 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7147 r7150 45 45 IStudentAccommodation, IStudentClearanceEdit, IStudentStudyLevel, 46 46 ICourseTicket, ICourseTicketAdd, IStudentPaymentsContainer, 47 IStudentOnlinePayment, IBedTicket 47 IStudentOnlinePayment, IBedTicket, IStudentsUtils 48 48 ) 49 49 from waeup.sirp.students.catalog import search … … 52 52 from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket 53 53 from waeup.sirp.students.vocabularies import StudyLevelSource 54 from waeup.sirp.students.utils import (55 get_payment_details, get_accommodation_details, select_bed,56 render_pdf)57 54 from waeup.sirp.browser.resources import toggleall 58 55 from waeup.sirp.authentication import get_principal_role_manager … … 667 664 studentview = StudentBaseDisplayFormPage(self.context.getStudent(), 668 665 self.request) 669 return render_pdf(self,'Course Registration', 'course_registration.pdf', 666 students_utils = getUtility(IStudentsUtils) 667 return students_utils.render_pdf( 668 self,'Course Registration', 'course_registration.pdf', 670 669 self.context.getStudent, studentview) 671 670 … … 939 938 pnav = 4 940 939 941 # To be sepezified in customization packages942 def get_payment_details(self, category, student):943 return get_payment_details(category, student)944 945 940 @grok.action('Create ticket') 946 941 def createTicket(self, **data): … … 954 949 self.redirect(self.url(self.context)) 955 950 return 956 pay_details = self.get_payment_details( 951 students_utils = getUtility(IStudentsUtils) 952 pay_details = students_utils.get_payment_details( 957 953 p_category,student) 958 954 if pay_details['error']: … … 1108 1104 studentview = StudentBaseDisplayFormPage(self.context.getStudent(), 1109 1105 self.request) 1110 return render_pdf(self,'Payment', 'payment_receipt.pdf', 1106 students_utils = getUtility(IStudentsUtils) 1107 return students_utils.render_pdf(self,'Payment', 'payment_receipt.pdf', 1111 1108 self.context.getStudent, studentview) 1112 1109 … … 1217 1214 notice = '' 1218 1215 1219 # To be sepezified in customization packages1220 def get_accommodation_details(self, student):1221 return get_accommodation_details(student)1222 1223 # To be sepezified in customization packages1224 def select_bed(self, available_beds):1225 return select_bed(available_beds)1226 1227 1216 def update(self, SUBMIT=None): 1228 1217 student = self.context.getStudent() 1229 acc_details = self.get_accommodation_details(student) 1218 students_utils = getUtility(IStudentsUtils) 1219 acc_details = students_utils.get_accommodation_details(student) 1230 1220 if not student.state in acc_details['allowed_states']: 1231 1221 self.flash("You are in the wrong registration state.") … … 1264 1254 entry for entry in entries if entry.owner == NOT_OCCUPIED] 1265 1255 if available_beds: 1266 bed = self.select_bed(available_beds) 1256 students_utils = getUtility(IStudentsUtils) 1257 bed = students_utils.select_bed(available_beds) 1267 1258 bed.bookBed(student.student_id) 1268 1259 else: … … 1345 1336 studentview = StudentBaseDisplayFormPage(self.context.getStudent(), 1346 1337 self.request) 1347 return render_pdf(self,'Bed Allocation', 'bed_allocation.pdf', 1338 students_utils = getUtility(IStudentsUtils) 1339 return students_utils.render_pdf( 1340 self,'Bed Allocation', 'bed_allocation.pdf', 1348 1341 self.context.getStudent, studentview) 1349 1342 … … 1364 1357 grok.require('waeup.manageHostels') 1365 1358 1366 # To be sepezified in customization packages1367 def get_accommodation_details(self, student):1368 return get_accommodation_details(student)1369 1370 # To be sepezified in customization packages1371 def select_bed(self, available_beds):1372 return select_bed(available_beds)1373 1374 1359 # Relocate student if student parameters have changed or the bed_type 1375 1360 # of the bed has changed 1376 1361 def update(self): 1377 1362 student = self.context.getStudent() 1378 acc_details = self.get_accommodation_details(student) 1363 students_utils = getUtility(IStudentsUtils) 1364 acc_details = students_utils.get_accommodation_details(student) 1379 1365 if self.context.bed != None and \ 1380 1366 'reserved' in self.context.bed.bed_type: … … 1403 1389 entry for entry in entries if entry.owner == NOT_OCCUPIED] 1404 1390 if available_beds: 1405 new_bed = self.select_bed(available_beds) 1391 students_utils = getUtility(IStudentsUtils) 1392 new_bed = students_utils.select_bed(available_beds) 1406 1393 new_bed.bookBed(student.student_id) 1407 1394 else:
Note: See TracChangeset for help on using the changeset viewer.