Changeset 11773


Ignore:
Timestamp:
31 Jul 2014, 05:14:19 (10 years ago)
Author:
Henrik Bettermann
Message:

Customize clearance_disabled_message.

Location:
main/waeup.uniben/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/CHANGES.txt

    r11736 r11773  
    441.2dev (unreleased)
    55===================
     6
     7* Customize clearance_disabled_message.
    68
    79* Add permission waeup.uploadPassportPictures and role
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r11611 r11773  
    766766            'finger1.fpm deleted'
    767767            in self.browser.contents)
     768
     769    def test_handle_clearance_by_co(self):
     770        # Create clearance officer
     771        self.app['users'].addUser('mrclear', 'mrclearsecret')
     772        self.app['users']['mrclear'].email = 'mrclear@foo.ng'
     773        self.app['users']['mrclear'].title = 'Carlo Pitter'
     774        department = self.app['faculties']['fac1']['dep1']
     775        prmlocal = IPrincipalRoleManager(department)
     776        prmlocal.assignRoleToPrincipal('waeup.local.ClearanceOfficer', 'mrclear')
     777        notify(LocalRoleSetEvent(
     778            department, 'waeup.local.ClearanceOfficer', 'mrclear', granted=True))
     779        IWorkflowState(self.student).setState('clearance requested')
     780        # Login as clearance officer
     781        self.browser.open(self.login_path)
     782        self.browser.getControl(name="form.login").value = 'mrclear'
     783        self.browser.getControl(name="form.password").value = 'mrclearsecret'
     784        self.browser.getControl("Login").click()
     785        self.assertMatches('...You logged in...', self.browser.contents)
     786        # CO can view the student ...
     787        self.browser.open(self.clearance_path)
     788        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     789        self.assertEqual(self.browser.url, self.clearance_path)
     790        # Clearance is disabled for this session for ug students ...
     791        self.browser.open(self.clearance_path)
     792        self.assertFalse('Clear student' in self.browser.contents)
     793        self.browser.open(self.student_path + '/clear')
     794        self.assertTrue('Clearance is disabled for this session'
     795            in self.browser.contents)
     796        # ... but not for
     797        self.certificate.study_mode = 'pg_ft'
     798        self.browser.open(self.clearance_path)
     799        self.assertTrue('Clear student' in self.browser.contents)
     800        self.browser.open(self.student_path + '/clear')
     801        self.assertTrue('Student has been cleared' in self.browser.contents)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r11644 r11773  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
     18import grok
    1819from time import time
    1920from zope.component import createObject, getUtility
     
    232233        return 50
    233234
     235    def clearance_disabled_message(self, student):
     236        if student.is_postgrad:
     237            return None
     238        try:
     239            session_config = grok.getSite()[
     240                'configuration'][str(student.current_session)]
     241        except KeyError:
     242            return _('Session configuration object is not available.')
     243        if not session_config.clearance_enabled:
     244            return _('Clearance is disabled for this session.')
     245        return None
     246
    234247    # Uniben prefix
    235248    STUDENT_ID_PREFIX = u'B'
Note: See TracChangeset for help on using the changeset viewer.