Ignore:
Timestamp:
13 Jun 2016, 00:44:56 (8 years ago)
Author:
uli
Message:

We can use zope.publisher to enforce types.

Location:
main/waeup.kofa/branches/uli-scores-upload/src/waeup/kofa/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/uli-scores-upload/src/waeup/kofa/students/browser.py

    r13908 r13922  
    31303130            scores = form['scores']
    31313131            sids = form['sids']
    3132             if isinstance(scores, basestring):
    3133                 scores = [scores]
    3134             if isinstance(sids, basestring):
    3135                 sids = [sids]
    31363132            formvals = dict([(sids[i], scores[i]) for i in range(len(sids))])
    31373133            for ticket in editable_tickets:
  • main/waeup.kofa/branches/uli-scores-upload/src/waeup/kofa/students/browser_templates/editscorespage.pt

    r13920 r13922  
    2424
    2525          <td tal:condition="ticket/editable_by_lecturer" style="width: 65px;">
    26           <input type="text" name="scores" class="form-control"
     26          <input type="text" name="scores:list" class="form-control"
    2727                     tal:attributes="value ticket/score" />
    28           <input type="hidden" name="sids"
     28          <input type="hidden" name="sids:list"
    2929                 tal:attributes="value ticket/student/student_id" />
    3030      </td>
  • main/waeup.kofa/branches/uli-scores-upload/src/waeup/kofa/students/tests/test_browser.py

    r13921 r13922  
    39623962        IWorkflowState(self.student).setState(VALIDATED)
    39633963        self.browser.open(self.edit_scores_url)
    3964         self.assertTrue(self.browser.getControl(name="scores") is not None)
     3964        self.assertTrue(
     3965            self.browser.getControl(name="scores:list") is not None)
    39653966
    39663967    def test_score_editing_offers_only_current_scores(self):
     
    39813982        self.app['configuration'].current_academic_session = 2004
    39823983        self.browser.reload()
    3983         self.assertTrue(self.browser.getControl(name="scores") is not None)
     3984        self.assertTrue(
     3985            self.browser.getControl(name="scores:list") is not None)
    39843986
    39853987    def test_score_editing_can_change_scores(self):
     
    39893991            self.student['studycourse']['100']['COURSE1'].score, None)
    39903992        self.browser.open(self.edit_scores_url)
    3991         self.browser.getControl(name="scores", index=0).value = '55'
     3993        self.browser.getControl(name="scores:list", index=0).value = '55'
    39923994        self.browser.getControl("Update scores").click()
    39933995        # the new value is stored in data
     
    39963998        # the new value is displayed on page/prefilled in form
    39973999        self.assertEqual(
    3998             self.browser.getControl(name="scores", index=0).value, '55')
     4000            self.browser.getControl(name="scores:list", index=0).value, '55')
    39994001        # The change has been logged
    40004002        with open(self.stud_log_path, 'r') as fd:
     
    40074009        self.login_as_lecturer()
    40084010        self.browser.open(self.edit_scores_url)
    4009         self.browser.getControl(name="scores", index=0).value = 'abc'
     4011        self.browser.getControl(name="scores:list", index=0).value = 'abc'
    40104012        self.browser.getControl("Update scores").click()
    40114013        self.assertTrue(
     
    40194021        self.student['studycourse']['100']['COURSE1'].score = None
    40204022        self.browser.open(self.edit_scores_url)
    4021         self.browser.getControl(name="scores", index=0).value = ''
     4023        self.browser.getControl(name="scores:list", index=0).value = ''
    40224024        self.browser.getControl("Update scores").click()
    40234025        logcontent = open(self.stud_log_path, 'r').read()
     
    40254027        # now retry with some value set
    40264028        self.student['studycourse']['100']['COURSE1'].score = 55
    4027         self.browser.getControl(name="scores", index=0).value = ''
     4029        self.browser.getControl(name="scores:list", index=0).value = ''
    40284030        self.browser.getControl("Update scores").click()
    40294031        logcontent = open(self.stud_log_path, 'r').read()
Note: See TracChangeset for help on using the changeset viewer.