Changeset 9569 for main


Ignore:
Timestamp:
7 Nov 2012, 14:09:50 (12 years ago)
Author:
Henrik Bettermann
Message:

Activate personal data expiration checker.

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

Legend:

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

    r9565 r9569  
    222222                            self.request.principal.id)
    223223                        self.flash(
    224                           _('Your personal data record expired. '
    225                             'Please update.'))
     224                          _('Your personal data record is outdated. Please update.'))
    226225                    self.redirect(self.application_url() + rel_link)
    227226                    return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r9563 r9569  
    798798    def save(self, **data):
    799799        msave(self, **data)
    800         # XXX: Temporarily disabled until all personal forms have been properly
    801         # configured
    802         #self.context.personal_updated = datetime.utcnow()
     800        self.context.personal_updated = datetime.utcnow()
    803801        return
    804802
  • main/waeup.kofa/trunk/src/waeup/kofa/students/student.py

    r9563 r9569  
    3737    IObjectHistory, IUserAccount, IFileStoreNameChooser, IFileStoreHandler,
    3838    IKofaUtils, registration_states_vocab, IExtFileStore,
    39     CLEARANCE, PAID, REGISTERED, VALIDATED, RETURNING)
     39    CREATED, ADMITTED, CLEARANCE, PAID, REGISTERED, VALIDATED, RETURNING)
    4040from waeup.kofa.students.accommodation import StudentAccommodation
    4141from waeup.kofa.students.export import EXPORTER_NAMES
     
    204204    @property
    205205    def personal_data_expired(self):
     206        if self.state in (CREATED, ADMITTED,):
     207            return False
    206208        now = datetime.utcnow()
    207         if self.personal_updated:
    208             days_ago = getattr(
    209                 now - self.personal_updated, 'days')
    210             if days_ago > 180:
    211                 return True
     209        if self.personal_updated is None:
     210            return True
     211        days_ago = getattr(now - self.personal_updated, 'days')
     212        if days_ago > 180:
     213            return True
    212214        return False
    213215
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9566 r9569  
    16591659    def test_student_change_password(self):
    16601660        # Students can change the password
     1661        self.student.personal_updated = datetime.utcnow()
    16611662        self.browser.open(self.login_path)
    16621663        self.browser.getControl(name="form.login").value = self.student_id
     
    24872488    def test_student_expired_personal_data(self):
    24882489        # Login
     2490        IWorkflowState(self.student).setState('school fee paid')
    24892491        delta = timedelta(days=180)
    24902492        self.student.personal_updated = datetime.utcnow() - delta
     
    25102512        self.assertEqual(self.browser.url, self.edit_personal_path)
    25112513        self.assertTrue(
    2512             'Your personal data record expired' in self.browser.contents)
     2514            'Your personal data record is outdated.' in self.browser.contents)
    25132515
    25142516class StudentRequestPWTests(StudentsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.