Index: main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 13904)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 13908)
@@ -3209,5 +3209,5 @@
             code=(self.context.code, self.context.code)
             )
-        result = [[_('Matric No.'),
+        header = [[_('Matric No.'),
                    _('Reg. No.'),
                    _('Fullname'),
@@ -3216,4 +3216,5 @@
                    _('Level'),
                    _('Score') ],]
+        tickets = []
         for ticket in list(coursetickets):
             row = [ticket.student.matric_number,
@@ -3224,6 +3225,6 @@
                   ticket.level,
                   ticket.score]
-            result.append(row)
-        return result
+            tickets.append(row)
+        return header + sorted(tickets, key=lambda value: value[0])
 
     def render(self):
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 13904)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 13908)
@@ -1821,29 +1821,31 @@
         prmlocal = IPrincipalRoleManager(course)
         prmlocal.assignRoleToPrincipal('waeup.local.Lecturer', 'mrslecturer')
+        notify(LocalRoleSetEvent(
+            course, 'waeup.local.Lecturer', 'mrslecturer', granted=True))
         # Login as lecturer.
         self.browser.open(self.login_path)
         self.browser.getControl(name="form.login").value = 'mrslecturer'
-        self.browser.getControl(name="form.password").value = 'mrslecturersecret'
+        self.browser.getControl(
+            name="form.password").value = 'mrslecturersecret'
         self.browser.getControl("Login").click()
         self.assertMatches('...You logged in...', self.browser.contents)
-        # CO can see her roles.
+        # Lecturer is on landing page
+        self.assertTrue('(<span>COURSE1</span>)' in self.browser.contents)
+        # Lecturer can click the 'My Roles' link.
         self.browser.getLink("My Roles").click()
         self.assertMatches(
             '...<div>Academics Officer (view only)</div>...',
             self.browser.contents)
-        # But not her local role ...
-        self.assertFalse('Lecturer' in self.browser.contents)
-        # ... because we forgot to notify the course that the local role
-        # has changed.
-        notify(LocalRoleSetEvent(
-            course, 'waeup.local.Lecturer', 'mrslecturer', granted=True))
-        self.browser.open('http://localhost/app/users/mrslecturer/my_roles')
-        self.assertTrue('Lecturer' in self.browser.contents)
         self.assertMatches(
-            '...<a href="http://localhost/app/faculties/fac1/dep1/courses/COURSE1">...',
+            '...<a href="http://localhost/app/'
+            'faculties/fac1/dep1/courses/COURSE1">...',
             self.browser.contents)
+        self.assertFalse('(<span>COURSE1</span>)' in self.browser.contents)
+        # Lecturer can click the 'My Courses' link ...
+        self.browser.getLink("My Courses").click()
+        # ... and is is back on landing page
+        self.assertTrue('(<span>COURSE1</span>)' in self.browser.contents)
         # The lecturer can go to her course ...
-        self.browser.getLink(
-            "http://localhost/app/faculties/fac1/dep1/courses/COURSE1").click()
+        self.browser.getLink("COURSE1").click()
         # Lecturers can neither filter students ...
         self.assertRaises(
@@ -1861,10 +1863,12 @@
         # Course results can be batch edited via the edit_courses view.
         self.app['faculties']['fac1']['dep1'].score_editing_disabled = True
-        self.browser.open("http://localhost/app/faculties/fac1/dep1/courses/COURSE1")
+        self.browser.open(
+            "http://localhost/app/faculties/fac1/dep1/courses/COURSE1")
         self.browser.getLink("Update scores").click()
         self.assertTrue('Score editing disabled' in self.browser.contents)
         self.app['faculties']['fac1']['dep1'].score_editing_disabled = False
         self.browser.getLink("Update scores").click()
-        self.assertTrue('Current academic session not set' in self.browser.contents)
+        self.assertTrue(
+            'Current academic session not set' in self.browser.contents)
         self.app['configuration'].current_academic_session = 2004
         self.browser.getLink("Update scores").click()
@@ -1875,5 +1879,6 @@
         # Student must be in state 'courses validated'.
         self.browser.open(
-            "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores")
+            'http://localhost/app/faculties/fac1/'
+            'dep1/courses/COURSE1/edit_scores')
         self.assertTrue(
             'input type="text" name="scores"' in self.browser.contents)
@@ -1888,8 +1893,9 @@
         logcontent = open(logfile).read()
         self.assertTrue('mrslecturer - students.browser.EditScoresPage - '
-                        'K1000000 100/COURSE1 score updated (55)' in logcontent)
+            'K1000000 100/COURSE1 score updated (55)' in logcontent)
         # Non-integer scores won't be accepted.
         self.browser.open(
-            "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores")
+            'http://localhost/app/faculties/fac1/'
+            'dep1/courses/COURSE1/edit_scores')
         self.assertTrue('value="55" />' in self.browser.contents)
         self.browser.getControl(name="scores", index=0).value = 'abc'
@@ -1899,5 +1905,6 @@
         # Scores can be removed.
         self.browser.open(
-            "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores")
+            'http://localhost/app/faculties/fac1/'
+            'dep1/courses/COURSE1/edit_scores')
         self.browser.getControl(name="scores", index=0).value = ''
         self.browser.getControl("Update scores").click()
@@ -1906,8 +1913,9 @@
         logcontent = open(logfile).read()
         self.assertTrue('mrslecturer - students.browser.EditScoresPage - '
-                        'K1000000 100/COURSE1 score updated (None)' in logcontent)
+            'K1000000 100/COURSE1 score updated (None)' in logcontent)
         # A course ticket slip can be downloaded
         self.browser.open(
-            "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/coursetickets.pdf")
+            'http://localhost/app/faculties/fac1/'
+            'dep1/courses/COURSE1/coursetickets.pdf')
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
         self.assertEqual(self.browser.headers['Content-Type'],
@@ -1916,5 +1924,4 @@
         open(path, 'wb').write(self.browser.contents)
         print "Sample PDF coursetickets.pdf written to %s" % path
-
 
     def test_change_current_mode(self):
