Changeset 8983


Ignore:
Timestamp:
12 Jul 2012, 11:43:12 (12 years ago)
Author:
Henrik Bettermann
Message:

Add boolean field 'suspended' to IStudent and IApplicant and extend authentication (checkPassword) slightly. Test will follow

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

Legend:

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

    r8922 r8983  
    492492    grok.template('applicantdisplaypage')
    493493    form_fields = grok.AutoFields(IApplicant).omit(
    494         'locked', 'course_admitted', 'password')
     494        'locked', 'course_admitted', 'password', 'suspended')
    495495    label = _('Applicant')
    496496    pnav = 3
     
    881881    form_fields = grok.AutoFields(IApplicantEdit).omit(
    882882        'locked', 'course_admitted', 'student_id',
    883         'screening_score',
     883        'screening_score', 'suspended'
    884884        )
    885885    form_fields['applicant_id'].for_display = True
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicantdisplaypage.pt

    r8273 r8983  
    1 <h2>
    2 ... <span tal:replace="context/translated_state">APPLICATIONSTATE</span> ...
     1<h2 i18n:domain="waeup.kofa">
     2  ...
     3  <span tal:replace="context/translated_state">APPLICATIONSTATE
     4  </span>
     5  <span tal:omit-tag=""
     6    i18n:translate="" tal:condition="context/suspended">(account suspended)
     7  </span>
     8  ...
    39</h2>
    410
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicanteditpage.pt

    r8486 r8983  
    33      autocomplete="off">
    44
    5   <h2>
    6   ... <span tal:replace="context/translated_state">APPLICATIONSTATE</span> ...
     5  <h2 i18n:domain="waeup.kofa">
     6    ...
     7    <span tal:replace="context/translated_state">APPLICATIONSTATE
     8    </span>
     9    <span tal:omit-tag=""
     10      i18n:translate="" tal:condition="context/suspended">(account suspended)
     11    </span>
     12    ...
    713  </h2>
    814
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r8801 r8983  
    322322    application_number = Attribute('The key under which the record is stored')
    323323
     324    suspended = schema.Bool(
     325        title = _(u'Account suspended'),
     326        default = False,
     327        )
     328
    324329    applicant_id = schema.TextLine(
    325330        title = _(u'Applicant Id'),
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_authentication.py

    r8351 r8983  
    6464    email = None
    6565    phone = None
     66    suspended = False
    6667
    6768
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r8778 r8983  
    821821        self.browser.getControl("Final Submit").click()
    822822        self.assertTrue(
    823             '... submitted ...' in self.browser.contents)
     823            'Application submitted' in self.browser.contents)
    824824        # ... or allow submission after deadline.
    825825        IWorkflowState(self.applicant).setState('paid')
     
    830830        self.browser.getControl("Final Submit").click()
    831831        self.assertTrue(
    832             '... submitted ...' in self.browser.contents)
     832            'Application submitted' in self.browser.contents)
    833833        self.browser.goBack(count=1)
    834834        self.browser.getControl("Save").click()
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py

    r8724 r8983  
    145145            'history,lastname,locked,middlename,notice,password,phone,'
    146146            'reg_number,screening_score,screening_venue,sex,state,'
    147             'student_id,container_code\r\n'
     147            'student_id,suspended,container_code\r\n'
    148148            'dp2011_654321,,654321,,,,,Anna Tester,,Anna,'
    149149            in result)
    150150        self.assertTrue(
    151151            'Application initialized by system\'],Tester,'
    152             '0,,,,,,,,,initialized,,dp2011\r\n'
     152            '0,,,,,,,,,initialized,,0,dp2011\r\n'
    153153            in result)
    154154        return
     
    169169            'history,lastname,locked,middlename,notice,password,phone,'
    170170            'reg_number,screening_score,screening_venue,sex,state,'
    171             'student_id,container_code\r\n'
     171            'student_id,suspended,container_code\r\n'
    172172            'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,'
    173173            'Anna M. Tester,anna@sample.com,Anna,'
     
    176176            'Application initialized by system\'],'
    177177            'Tester,0,M.,"Some notice\nin lines.",any password,'
    178             '+234-123-12345,123456,98,Exam Room,f,initialized,,dp2011\r\n'
     178            '+234-123-12345,123456,98,Exam Room,f,initialized,,0,dp2011\r\n'
    179179            in result)
    180180
     
    193193            'history,lastname,locked,middlename,notice,password,phone,'
    194194            'reg_number,screening_score,screening_venue,sex,state,'
    195             'student_id,container_code\r\n'
     195            'student_id,suspended,container_code\r\n'
    196196            'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,'
    197197            'Anna M. Tester,anna@sample.com,Anna,'
     
    200200            'Application initialized by system\'],'
    201201            'Tester,0,M.,"Some notice\nin lines.",any password,'
    202             '+234-123-12345,123456,98,Exam Room,f,initialized,,dp2011\r\n'
    203             in result)
    204         return
     202            '+234-123-12345,123456,98,Exam Room,f,initialized,,0,dp2011\r\n'
     203            in result)
     204        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/authentication.py

    r8757 r8983  
    102102    def checkPassword(self, password):
    103103        """Check whether the given `password` matches the one stored.
     104
     105        We additionally check if student account has been suspended.
    104106        """
    105107        if not isinstance(password, basestring):
     
    107109        if not getattr(self.context, 'password', None):
    108110            # unset/empty passwords do never match
     111            return False
     112        if self.context.suspended == True:
    109113            return False
    110114        passwordmanager = getUtility(IPasswordManager, 'SSHA')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r8977 r8983  
    292292    grok.require('waeup.viewStudent')
    293293    grok.template('basepage')
    294     form_fields = grok.AutoFields(IStudentBase).omit('password')
     294    form_fields = grok.AutoFields(IStudentBase).omit('password', 'suspended')
    295295    pnav = 4
    296296
    297297    @property
    298298    def label(self):
    299         return _('${a}: Base Data',
     299        if self.context.suspended:
     300            return _('${a}: Base Data (account suspended)',
     301                mapping = {'a':self.context.display_fullname})
     302        return  _('${a}: Base Data',
    300303            mapping = {'a':self.context.display_fullname})
    301304
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r8977 r8983  
    157157    is_postgrad = Attribute('True if postgraduate student')
    158158
     159    suspended = schema.Bool(
     160        title = _(u'Account suspended'),
     161        default = False,
     162        )
     163
    159164    student_id = schema.TextLine(
    160165        title = _(u'Student Id'),
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_authentication.py

    r8351 r8983  
    6565    email = None
    6666    phone = None
     67    suspended = False
    6768
    6869
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r8947 r8983  
    4444            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
    4545            'firstname,lastname,matric_number,middlename,nationality,'
    46             'perm_address,phone,reg_number,sex,student_id,password,'
     46            'perm_address,phone,reg_number,sex,student_id,suspended,password,'
    4747            'state,history,certcode\r\n'
    4848
    4949            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
    5050            'Anna,Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'
    51             '+234-123-12345#,123456,f,A111111,,created'
     51            '+234-123-12345#,123456,f,A111111,0,,created'
    5252            in result
    5353            )
     
    6464            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
    6565            'firstname,lastname,matric_number,middlename,nationality,'
    66             'perm_address,phone,reg_number,sex,student_id,password,'
     66            'perm_address,phone,reg_number,sex,student_id,suspended,password,'
    6767            'state,history,certcode\r\n'
    6868
    6969            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
    7070            'Anna,Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'
    71             '+234-123-12345#,123456,f,A111111,,created'
     71            '+234-123-12345#,123456,f,A111111,0,,created'
    7272            in result
    7373            )
     
    8383            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
    8484            'firstname,lastname,matric_number,middlename,nationality,'
    85             'perm_address,phone,reg_number,sex,student_id,password,'
     85            'perm_address,phone,reg_number,sex,student_id,suspended,password,'
    8686            'state,history,certcode\r\n'
    8787
    8888            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
    8989            'Anna,Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'
    90             '+234-123-12345#,123456,f,A111111,,created'
     90            '+234-123-12345#,123456,f,A111111,0,,created'
    9191            in result
    9292            )
Note: See TracChangeset for help on using the changeset viewer.