Changeset 6637
- Timestamp:
- 27 Aug 2011, 13:19:07 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6635 r6637 307 307 target = 'accommodation' 308 308 309 class HistoryViewActionButton(PlainActionButton): 310 grok.order(7) 311 grok.context(IStudent) 312 grok.view(StudentBaseDisplayFormPage) 313 grok.require('waeup.viewStudents') 314 text = 'History' 315 target = 'history' 316 309 317 class StudentBaseManageFormPage(WAeUPEditFormPage): 310 318 """ View to edit student base data … … 445 453 def label(self): 446 454 return '%s: Accommodation Data' % self.context.__parent__.name 455 456 class StudentHistoryPage(WAeUPPage): 457 """ Page to display student clearance data 458 """ 459 grok.context(IStudent) 460 grok.name('history') 461 grok.require('waeup.viewStudents') 462 grok.template('studenthistory') 463 464 @property 465 def title(self): 466 return 'Student: %s' % self.context.name 467 468 @property 469 def label(self): 470 return '%s: History' % self.context.name -
main/waeup.sirp/trunk/src/waeup/sirp/students/container.py
r6635 r6637 26 26 from waeup.sirp.students.payments import StudentPayments 27 27 from waeup.sirp.students.accommodation import StudentAccommodation 28 from waeup.sirp.utils.helpers import get_current_principal 29 from waeup.sirp.utils.logger import Logger 28 30 29 class StudentsContainer(grok.Container ):31 class StudentsContainer(grok.Container, Logger): 30 32 """ 31 33 The node containing the student models … … 53 55 self[student.student_id]['accommodation'] = accommodation 54 56 return 57 58 logger_name = 'waeup.sirp.${sitename}.students' 59 logger_filename = 'students.log' 60 61 def logger_info(self, target, ob_class, comment=None): 62 """Get the logger's info method. 63 """ 64 user = get_current_principal() 65 if user is None: 66 user = 'system' 67 else: 68 user = user.id 69 self.logger.info('%s - %s - %s - %s' % ( 70 user, target, ob_class, comment)) 71 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r6635 r6637 1 1 ## 2 2 ## interfaces.py 3 from zope.interface import Interface 3 from zope.interface import Interface, Attribute 4 4 from zope import schema 5 5 from waeup.sirp.interfaces import IWAeUPObject … … 8 8 """Representation of student base data. 9 9 """ 10 history = Attribute('Object history, a list of messages.') 11 state = Attribute('Returns the registration state of a student') 12 13 def loggerInfo(ob_class, comment): 14 """Adds an INFO message to the log file 15 """ 16 10 17 student_id = schema.TextLine( 11 18 title = u'Student Id', -
main/waeup.sirp/trunk/src/waeup/sirp/students/student.py
r6632 r6637 21 21 from zope.component.interfaces import IFactory 22 22 from zope.interface import implementedBy 23 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 24 from waeup.sirp.interfaces import IObjectHistory 23 25 from waeup.sirp.students.interfaces import IStudent 24 26 from waeup.sirp.utils.helpers import attrs_to_fields … … 33 35 def __init__(self): 34 36 super(Student, self).__init__() 35 #IWorkflowInfo(self).fireTransition('init')37 IWorkflowInfo(self).fireTransition('create') 36 38 return 39 40 def loggerInfo(self, ob_class, comment=None): 41 target = self.__name__ 42 return grok.getSite()['students'].logger_info(ob_class,target,comment) 43 44 @property 45 def state(self): 46 state = IWorkflowState(self).getState() 47 return state 48 49 @property 50 def history(self): 51 history = IObjectHistory(self) 52 return history 37 53 38 54 # Set all attributes of Student required in IStudent as field -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6635 r6637 91 91 self.payments_student_path = self.student_path + '/payments' 92 92 self.accommodation_student_path = self.student_path + '/accommodation' 93 self.history_student_path = self.student_path + '/history' 93 94 94 95 # Populate university … … 231 232 self.assertEqual(self.browser.url, self.accommodation_student_path) 232 233 234 self.browser.open(self.student_path) 235 self.browser.getLink("History").click() 236 self.assertEqual(self.browser.headers['Status'], '200 Ok') 237 self.assertEqual(self.browser.url, self.history_student_path) 238 self.assertMatches('...Student object created by system...', self.browser.contents) 239 233 240 return
Note: See TracChangeset for help on using the changeset viewer.