Ignore:
Timestamp:
5 Nov 2012, 18:03:39 (12 years ago)
Author:
Henrik Bettermann
Message:

Add timestamp to personal data. This timestamp will be checked when students log in. Students sould be remembered to frequently update their personal data.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r9532 r9543  
    745745    form_fields = grok.AutoFields(IStudentPersonal)
    746746    form_fields['perm_address'].custom_widget = BytesDisplayWidget
     747    form_fields[
     748        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    747749    pnav = 4
    748750
     
    758760    grok.name('manage_personal')
    759761    grok.require('waeup.manageStudent')
    760     form_fields = grok.AutoFields(IStudentPersonal)
     762    form_fields = grok.AutoFields(IStudentPersonal).omit('personal_updated')
    761763    label = _('Manage personal data')
    762764    pnav = 4
     
    767769        return
    768770
    769 class StudentPersonalEditFormPage(StudentPersonalManageFormPage):
     771class StudentPersonalEditFormPage(KofaEditFormPage):
    770772    """ Page to edit personal data
    771773    """
     774    grok.context(IStudent)
    772775    grok.name('edit_personal')
    773776    grok.require('waeup.handleStudent')
     777    form_fields = grok.AutoFields(IStudentPersonal).omit('personal_updated')
    774778    label = _('Edit personal data')
    775779    pnav = 4
     780
     781    @action(_('Save/Confirm'), style='primary')
     782    def save(self, **data):
     783        msave(self, **data)
     784        # XXX: Temporarily disabled until all personal forms have been properly
     785        # configured
     786        #self.context.personal_updated = datetime.utcnow()
     787        return
    776788
    777789class StudyCourseDisplayFormPage(KofaDisplayFormPage):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r9532 r9543  
    250250
    251251    """
    252     date_of_birth = FormattedDate(
    253         title = _(u'Date of Birth'),
    254         required = True,
    255         show_year = True,
     252    officer_comment = schema.Text(
     253        title = _(u"Officer's Comment"),
     254        required = False,
    256255        )
    257256
     
    268267        )
    269268
     269    date_of_birth = FormattedDate(
     270        title = _(u'Date of Birth'),
     271        required = True,
     272        show_year = True,
     273        )
     274
    270275    nationality = schema.Choice(
    271276        vocabulary = nats_vocab,
     
    274279        )
    275280
    276     officer_comment = schema.Text(
    277         title = _(u"Officer's Comment"),
    278         required = False,
    279         #description = _(
    280         #    u'This comment will be deleted when student is cleared.'),
    281         )
    282 
    283281class IPGStudentClearance(IUGStudentClearance):
    284282    """Representation of postgraduate student clearance data.
     
    295293
    296294    """
     295    personal_updated = schema.Datetime(
     296        title = _(u'Updated'),
     297        required = False,
     298        readonly = False,
     299        )
     300
    297301    perm_address = schema.Text(
    298302        title = _(u'Permanent Address'),
     
    669673        title = _(u'Payment Level'),
    670674        required = False,
    671         readonly = True,
    672675        )
    673676
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9532 r9543  
    24222422        self.assertTrue('An email with' in self.browser.contents)
    24232423
     2424    def test_student_expired_personal_data(self):
     2425        # Login
     2426        delta = timedelta(days=180)
     2427        self.student.personal_updated = datetime.utcnow() - delta
     2428        self.browser.open(self.login_path)
     2429        self.browser.getControl(name="form.login").value = self.student_id
     2430        self.browser.getControl(name="form.password").value = 'spwd'
     2431        self.browser.getControl("Login").click()
     2432        self.assertEqual(self.browser.url, self.student_path)
     2433        self.assertTrue(
     2434            'You logged in' in self.browser.contents)
     2435        self.browser.getLink("Logout").click()
     2436        delta = timedelta(days=181)
     2437        self.student.personal_updated = datetime.utcnow() - delta
     2438        self.browser.open(self.login_path)
     2439        self.browser.getControl(name="form.login").value = self.student_id
     2440        self.browser.getControl(name="form.password").value = 'spwd'
     2441        self.browser.getControl("Login").click()
     2442        self.assertEqual(self.browser.url, self.edit_personal_path)
     2443        self.assertTrue(
     2444            'Your personal data record expired' in self.browser.contents)
     2445
    24242446class StudentRequestPWTests(StudentsFullSetup):
    24252447    # Tests for student registration
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r9486 r9543  
    4545            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
    4646            'firstname,lastname,matric_number,middlename,nationality,officer_comment,'
    47             'perm_address,phone,reg_number,sex,student_id,suspended,password,'
     47            'perm_address,personal_updated,'
     48            'phone,reg_number,sex,student_id,suspended,password,'
    4849            'state,history,certcode,is_postgrad,current_level,current_session\r\n'
    4950
    5051            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
    51             'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",'
     52            'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,'
    5253            '+234-123-12345#,123,f,A111111,0,,created'
    5354            in result
     
    6566            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
    6667            'firstname,lastname,matric_number,middlename,nationality,officer_comment,'
    67             'perm_address,phone,reg_number,sex,student_id,suspended,password,'
     68            'perm_address,personal_updated'
     69            ',phone,reg_number,sex,student_id,suspended,password,'
    6870            'state,history,certcode,is_postgrad,current_level,current_session\r\n'
    6971
    7072            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
    71             'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",'
     73            'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,'
    7274            '+234-123-12345#,123,f,A111111,0,,created'
    7375            in result
     
    8486            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
    8587            'firstname,lastname,matric_number,middlename,nationality,officer_comment,'
    86             'perm_address,phone,reg_number,sex,student_id,suspended,password,'
     88            'perm_address,personal_updated'
     89            ',phone,reg_number,sex,student_id,suspended,password,'
    8790            'state,history,certcode,is_postgrad,current_level,current_session\r\n'
    8891
    8992            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
    90             'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",'
     93            'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,'
    9194            '+234-123-12345#,123,f,A111111,0,,created'
    9295            in result
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r9405 r9543  
    190190    def tzinfo(self):
    191191        # For Nigeria: pytz.timezone('Africa/Lagos')
     192        # For Germany: pytz.timezone('Europe/Berlin')
    192193        return pytz.utc
    193194
Note: See TracChangeset for help on using the changeset viewer.