Index: main/waeup.kofa/branches/uli-scores-upload/src/waeup/kofa/students/tests/test_browser.py
===================================================================
--- main/waeup.kofa/branches/uli-scores-upload/src/waeup/kofa/students/tests/test_browser.py	(revision 13902)
+++ main/waeup.kofa/branches/uli-scores-upload/src/waeup/kofa/students/tests/test_browser.py	(revision 13903)
@@ -1,4 +1,4 @@
 ## $Id$
-## 
+##
 ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
 ## This program is free software; you can redistribute it and/or modify
@@ -6,10 +6,10 @@
 ## the Free Software Foundation; either version 2 of the License, or
 ## (at your option) any later version.
-## 
+##
 ## This program is distributed in the hope that it will be useful,
 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ## GNU General Public License for more details.
-## 
+##
 ## You should have received a copy of the GNU General Public License
 ## along with this program; if not, write to the Free Software
@@ -56,4 +56,5 @@
 SAMPLE_IMAGE_BMP = os.path.join(os.path.dirname(__file__), 'test_image.bmp')
 
+
 def lookup_submit_value(name, value, browser):
     """Find a button with a certain value."""
@@ -66,4 +67,5 @@
             break
     return None
+
 
 class StudentsFullSetup(FunctionalTestCase):
@@ -179,6 +181,6 @@
         self.app['faculties']['fac1']['dep1'].courses.addCourse(
             self.course)
-        self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse(
-            self.course, level=100)
+        self.app['faculties']['fac1']['dep1'].certificates[
+            'CERT1'].addCertCourse(self.course, level=100)
 
         # Configure university and hostels
@@ -238,5 +240,4 @@
 
 
-
 class StudentsContainerUITests(StudentsFullSetup):
     # Tests for StudentsContainer class views and pages
@@ -275,6 +276,6 @@
         self.browser.getControl(name="form.reg_number").value = '123'
         self.browser.getControl("Create student").click()
-        self.assertTrue('Registration number exists already'
-            in self.browser.contents)
+        self.assertTrue(
+            'Registration number exists already' in self.browser.contents)
         self.browser.getControl(name="form.reg_number").value = '1234'
         self.browser.getControl("Create student").click()
@@ -424,4 +425,5 @@
         return
 
+
 class OfficerUITests(StudentsFullSetup):
     # Tests for Student class views and pages
@@ -440,9 +442,9 @@
         studylevel.level = 100
         cert = self.app['faculties']['fac1']['dep1'].certificates['CERT1']
-        self.student['studycourse'].addStudentStudyLevel(
-            cert,studylevel)
+        self.student['studycourse'].addStudentStudyLevel(cert, studylevel)
         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
         self.browser.open(self.studycourse_path + '/100/manage')
-        self.assertEqual(self.browser.url, self.studycourse_path + '/100/manage')
+        self.assertEqual(
+            self.browser.url, self.studycourse_path + '/100/manage')
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
 
@@ -452,12 +454,14 @@
         self.browser.getLink("Logout").click()
         self.assertTrue('You have been logged out' in self.browser.contents)
-        # But we are still logged in since we've used basic authentication here.
-        # Wikipedia says: Existing browsers retain authentication information
-        # until the tab or browser is closed or the user clears the history.
-        # HTTP does not provide a method for a server to direct clients to
-        # discard these cached credentials. This means that there is no
-        # effective way for a server to "log out" the user without closing
-        # the browser. This is a significant defect that requires browser
-        # manufacturers to support a "logout" user interface element ...
+        # But we are still logged in since we've used basic
+        # authentication here.  Wikipedia says: Existing browsers
+        # retain authentication information until the tab or browser
+        # is closed or the user clears the history.  HTTP does not
+        # provide a method for a server to direct clients to discard
+        # these cached credentials. This means that there is no
+        # effective way for a server to "log out" the user without
+        # closing the browser. This is a significant defect that
+        # requires browser manufacturers to support a "logout" user
+        # interface element ...
         self.assertTrue('Manager' in self.browser.contents)
 
@@ -570,8 +574,10 @@
         self.browser.open(self.student_path)
         self.browser.getLink("Send email").click()
-        self.browser.getControl(name="form.subject").value = 'Important subject'
+        self.browser.getControl(
+            name="form.subject").value = 'Important subject'
         self.browser.getControl(name="form.body").value = 'Hello!'
         self.browser.getControl("Send message now").click()
-        self.assertTrue('An smtp server error occurred' in self.browser.contents)
+        self.assertTrue(
+            'An smtp server error occurred' in self.browser.contents)
         self.student.email = 'xx@yy.zz'
         self.browser.getControl("Send message now").click()
@@ -622,5 +628,5 @@
         file_ctrl.add_file(image, filename='my_birth_certificate.jpg')
         # The Save action does not upload files
-        self.browser.getControl("Save").click() # submit form
+        self.browser.getControl("Save").click()  # submit form
         self.assertFalse(
             '<a target="image" href="birth_certificate">'
@@ -660,5 +666,5 @@
             'Uploaded file is too big' in self.browser.contents)
         # we do not rely on filename extensions given by uploaders
-        image = open(SAMPLE_IMAGE, 'rb') # a jpg-file
+        image = open(SAMPLE_IMAGE, 'rb')  # a jpg-file
         ctrl = self.browser.getControl(name='birthcertificateupload')
         file_ctrl = ctrl.mech_control
@@ -681,5 +687,6 @@
         self.browser.getControl(
             name='upload_birthcertificateupload').click()
-        self.assertTrue('Only the following extensions are allowed'
+        self.assertTrue(
+            'Only the following extensions are allowed'
             in self.browser.contents)
 
@@ -692,6 +699,6 @@
         self.browser.getControl(
             name='upload_passportuploadmanage').click()
-        self.assertTrue('jpg file format expected'
-            in self.browser.contents)
+        self.assertTrue(
+            'jpg file format expected' in self.browser.contents)
         ctrl = self.browser.getControl(name='passportuploadmanage')
         file_ctrl = ctrl.mech_control
@@ -750,5 +757,6 @@
         self.assertMatches('...<span>100</span>...', self.browser.contents)
         self.assertEqual(self.student['studycourse']['100'].level, 100)
-        self.assertEqual(self.student['studycourse']['100'].level_session, 2004)
+        self.assertEqual(
+            self.student['studycourse']['100'].level_session, 2004)
         self.browser.getControl(name="addlevel").value = ['100']
         self.browser.getControl(name="level_session").value = ['2004']
@@ -766,6 +774,7 @@
             self.app['datacenter'].storage, 'logs', 'students.log')
         logcontent = open(logfile).read()
-        self.assertTrue('zope.mgr - students.browser.StudyCourseManageFormPage '
-                        '- K1000000 - removed: 100' in logcontent)
+        self.assertTrue(
+            'zope.mgr - students.browser.StudyCourseManageFormPage '
+            '- K1000000 - removed: 100' in logcontent)
         # Add level again
         self.browser.getControl(name="addlevel").value = ['100']
@@ -790,6 +799,7 @@
             self.app['datacenter'].storage, 'logs', 'students.log')
         logcontent = open(logfile).read()
-        self.assertTrue('zope.mgr - students.browser.StudyLevelManageFormPage '
-        '- K1000000 - removed: COURSE1 at 100' in logcontent)
+        self.assertTrue(
+            'zope.mgr - students.browser.StudyLevelManageFormPage '
+            '- K1000000 - removed: COURSE1 at 100' in logcontent)
         self.browser.getLink("here").click()
         self.browser.getControl(name="form.course").value = ['COURSE1']
@@ -823,8 +833,10 @@
         self.assertTrue('Grade' in self.browser.contents)
         self.assertTrue('Weight' in self.browser.contents)
-        self.assertEqual(self.student['studycourse']['100']['COURSE1'].grade, 'C')
-        self.assertEqual(self.student['studycourse']['100']['COURSE1'].weight, 3)
-        # We add another ticket to check if GPA will be correctly calculated
-        # (and rounded)
+        self.assertEqual(
+            self.student['studycourse']['100']['COURSE1'].grade, 'C')
+        self.assertEqual(
+            self.student['studycourse']['100']['COURSE1'].weight, 3)
+        # We add another ticket to check if GPA will be correctly
+        # calculated (and rounded)
         courseticket = createObject('waeup.CourseTicket')
         courseticket.code = 'ANYCODE'
@@ -838,9 +850,12 @@
         self.browser.open(self.student_path + '/studycourse/100')
         # total credits
-        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[1], 23)
+        self.assertEqual(
+            self.student['studycourse']['100'].gpa_params_rectified[1], 23)
         # weigheted credits = 3 * 10 + 4 * 13
-        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[2], 82.0)
+        self.assertEqual(
+            self.student['studycourse']['100'].gpa_params_rectified[2], 82.0)
         # sgpa = 82 / 23
-        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 3.565)
+        self.assertEqual(
+            self.student['studycourse']['100'].gpa_params_rectified[0], 3.565)
         # Carry-over courses will be collected when next level is created
         self.browser.open(self.student_path + '/studycourse/manage')
@@ -890,9 +905,11 @@
         studylevel['COURSE1'].score = studylevel['COURSE1'].passmark + 1
         # GPA is 1.
-        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 1.0)
+        self.assertEqual(
+            self.student['studycourse']['100'].gpa_params_rectified[0], 1.0)
         # Set score below passmark.
         studylevel['COURSE1'].score = studylevel['COURSE1'].passmark - 1
         # GPA is still 0.
-        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 0.0)
+        self.assertEqual(
+            self.student['studycourse']['100'].gpa_params_rectified[0], 0.0)
         studylevel2 = createObject(u'waeup.StudentStudyLevel')
         studylevel2.level = 200
@@ -904,7 +921,9 @@
         # The score of the carry-over course is now used for calculation of the
         # GPA at level 100 ...
-        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 4.0)
+        self.assertEqual(
+            self.student['studycourse']['100'].gpa_params_rectified[0], 4.0)
         # ... but not at level 200
-        self.assertEqual(self.student['studycourse']['200'].gpa_params_rectified[0], 0.0)
+        self.assertEqual(
+            self.student['studycourse']['200'].gpa_params_rectified[0], 0.0)
         return
 
@@ -939,6 +958,7 @@
         #                   self.browser.contents)
 
-        # The same payment (with same p_item, p_session and p_category)
-        # can be initialized a second time if the former ticket is not yet paid.
+        # The same payment (with same p_item, p_session and
+        # p_category) can be initialized a second time if the former
+        # ticket is not yet paid.
         self.browser.open(self.payments_path)
         self.browser.getLink("Add current session payment ticket").click()
@@ -957,9 +977,9 @@
         # an access code is created after approval.
         IWorkflowState(self.student).setState('school fee paid')
-        self.assertEqual(len(self.app['accesscodes']['SFE-0']),0)
+        self.assertEqual(len(self.app['accesscodes']['SFE-0']), 0)
         self.browser.open(payment_url)
         self.browser.getLink("Approve payment").click()
-        self.assertMatches('...Payment approved...',
-                          self.browser.contents)
+        self.assertMatches(
+            '...Payment approved...', self.browser.contents)
         # Approval is logged in students.log ...
         logcontent = open(logfile).read()
@@ -977,5 +997,5 @@
         # The authorized amount has been stored in the new access code
         self.assertEqual(
-            self.app['accesscodes']['SFE-0'].values()[0].cost,40000.0)
+            self.app['accesscodes']['SFE-0'].values()[0].cost, 40000.0)
 
         # The catalog has been updated
