Changeset 7652 for main/waeup.sirp/trunk/src/waeup/sirp/students
- Timestamp:
- 15 Feb 2012, 10:51:53 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/batching.py
r7649 r7652 42 42 from waeup.sirp.students.workflow import IMPORTABLE_STATES 43 43 from waeup.sirp.utils.batching import BatchProcessor 44 from waeup.sirp.utils.helpers import get_current_principal45 44 46 45 class StudentProcessor(BatchProcessor): … … 135 134 parent = self.getParent(row, site) 136 135 parent.addStudent(obj) 137 # In some tests we don't have a students container or a user136 # In some tests we don't have a students container 138 137 try: 139 user = get_current_principal() 140 parent.logger.info('%s - %s - Student record imported' % ( 141 user.id,obj.student_id)) 138 parent.logger.info('%s - Student record imported' % ( 139 obj.student_id)) 142 140 history = IObjectHistory(obj) 143 141 history.addMessage('Student record imported') -
main/waeup.sirp/trunk/src/waeup/sirp/students/container.py
r7256 r7652 22 22 from waeup.sirp.students.interfaces import ( 23 23 IStudentsContainer, IStudent) 24 from waeup.sirp.utils.helpers import get_current_principal25 24 from waeup.sirp.utils.logger import Logger 26 25 … … 53 52 """Get the logger's info method. 54 53 """ 55 user = get_current_principal() 56 if user is None: 57 # In tests we do not necessarily have a logged on principal 58 return 59 user = user.id 60 self.logger.info('%s - %s - %s - %s' % ( 61 user, ob_class, target, comment)) 54 self.logger.info('%s - %s - %s' % ( 55 ob_class, target, comment)) 62 56 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/student.py
r7641 r7652 35 35 from waeup.sirp.students.payments import StudentPaymentsContainer 36 36 from waeup.sirp.students.accommodation import StudentAccommodation 37 from waeup.sirp.utils.helpers import attrs_to_fields , get_current_principal37 from waeup.sirp.utils.helpers import attrs_to_fields 38 38 from waeup.sirp.students.utils import generate_student_id 39 39 … … 174 174 comment = 'Student record removed' 175 175 target = student.student_id 176 # In some tests we don't have a principal177 176 try: 178 user = get_current_principal().id 179 except (TypeError, AttributeError): 180 return 181 try: 182 grok.getSite()['students'].logger.info('%s - %s - %s' % ( 183 user, target, comment)) 177 grok.getSite()['students'].logger.info('%s - %s' % ( 178 target, comment)) 184 179 except KeyError: 185 180 # If we delete an entire university instance there won't be -
main/waeup.sirp/trunk/src/waeup/sirp/students/workflow.py
r7615 r7652 10 10 REGISTERED, VALIDATED) 11 11 from waeup.sirp.workflow import SIRPWorkflow, SIRPWorkflowInfo 12 from waeup.sirp.utils.helpers import get_current_principal13 12 from waeup.sirp.students.interfaces import IStudent, IStudentsUtils 14 13 … … 197 196 if event.transition.transition_id == 'pay_school_fee': 198 197 getUtility(IStudentsUtils).setReturningData(obj) 199 # In some tests we don't have a students container or a user198 # In some tests we don't have a students container 200 199 try: 201 user = get_current_principal()202 200 students_container = grok.getSite()['students'] 203 students_container.logger.info('%s - %s - %s' % (user.id,obj.student_id,msg))201 students_container.logger.info('%s - %s' % (obj.student_id,msg)) 204 202 except (TypeError, AttributeError): 205 203 pass
Note: See TracChangeset for help on using the changeset viewer.