Index: /main/waeup.cas/trunk/waeup/cas/authenticators.py
===================================================================
--- /main/waeup.cas/trunk/waeup/cas/authenticators.py	(revision 10534)
+++ /main/waeup.cas/trunk/waeup/cas/authenticators.py	(revision 10535)
@@ -173,4 +173,5 @@
         return (False, 'Invalid username or password.')
 
+
 class KofaMoodleAuthenticator(KofaAuthenticator):
     """Authenticate against a running Kofa instance and transfer
@@ -179,13 +180,15 @@
     Configuration of Moodle:
     1. Set 'passwordpolicy' to No
-    2. Create external web service 'Kofa' with the following functions:
-      core_user_create_users, core_user_get_users,
-      core_user_update_users, enrol_manual_enrol_users
-    3. Create token for the admin user (no special web service user needed)
-      and for service 'Kofa'
-    4. Enable and configure CAS server authentication.
-      CAS protocol version is 1.0. Moodle expects SSL/TLS protocol.
-    """
-
+
+    2. Create external web service 'Kofa' with the following
+       functions: core_user_create_users, core_user_get_users,
+       core_user_update_users, enrol_manual_enrol_users
+
+    3. Create token for the admin user (no special web service user
+       needed) and for service 'Kofa'
+
+    4. Enable and configure CAS server authentication. CAS protocol
+       version is 1.0. Moodle expects SSL/TLS protocol.
+    """
     name = 'kofa_moodle1'
 
@@ -226,5 +229,5 @@
         try:
             result = moodle.core_user_update_users([
-                {'id':user_id,'auth':'cas'}])
+                {'id': user_id, 'auth': 'cas'}])
         except xmlrpclib.Fault:
             faultstring = sys.exc_info()[1].faultString
@@ -247,7 +250,9 @@
             moodle = xmlrpclib.ServerProxy(
                 backend['moodle_url'], allow_none=True)
-            principal = proxy.check_applicant_credentials(kofa_username, password)
+            principal = proxy.check_applicant_credentials(
+                kofa_username, password)
             if principal is None:
-                principal = proxy.check_student_credentials(kofa_username, password)
+                principal = proxy.check_student_credentials(
+                    kofa_username, password)
             if principal is None:
                 return (False, 'Invalid username or password')
@@ -260,3 +265,2 @@
             return (False, 'User not eligible')
         return (False, 'Invalid username or password')
-
Index: /main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py
===================================================================
--- /main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py	(revision 10534)
+++ /main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py	(revision 10535)
@@ -1,3 +1,3 @@
-3# Tests for waeup.cas.authentictors
+# Tests for waeup.cas.authentictors
 import os
 import threading
@@ -88,7 +88,8 @@
         url='http://localhost:6666/',
         marker='^SCHOOL1-',
-        moodle_url = 'http://localhost:7777/',
+        moodle_url='http://localhost:7777/',
         )
     )
+
 
 class KofaAuthenticatorTests(unittest.TestCase):
@@ -132,4 +133,5 @@
         assert app.db_connection_string == 'sqlite:///:memory:'
         assert isinstance(app.auth, KofaAuthenticator)
+
 
 class KofaMoodleAuthenticatorTests(unittest.TestCase):
@@ -148,5 +150,7 @@
             {'url': 'http://xmlrpcuser1:xmlrpcuser1@localhost:8080/app1/',
              'marker': '^K',
-             'moodle_url': 'http://localhost/moodle/webservice/xmlrpc/server.php?wstoken=de1e1cbacf91ec6290bb6f6339122e7d',
+             'moodle_url': ('http://localhost/moodle/webservice/xmlrpc'
+                            '/server.php?wstoken=de1e1cbacf91ec6290bb6'
+                            'f6339122e7d'),
             },
           }
@@ -214,4 +218,5 @@
                         )
 
+
 class FakeMoodleServer(SimpleXMLRPCServer):
     # A fake Moodle server that provides only XMLRPC methods
@@ -242,7 +247,7 @@
             raise xmlrpclib.Fault('faultCode', 'core_user_get_users failed')
         if arg[0]['value'] == 'SCHOOL1-fault3':
-            return {'users':[{'id':'SCHOOL1-fault3'}]}
+            return {'users': [{'id': 'SCHOOL1-fault3'}]}
         if arg[0]['value'] in ('SCHOOL1-fault4', 'SCHOOL1-fault5'):
-            return {'users':[{'id': 123}]}
+            return {'users': [{'id': 123}]}
         return {'users': []}
 
@@ -252,4 +257,5 @@
             raise xmlrpclib.Fault('faultCode', 'core_user_update_users failed')
         return None
+
 
 class KofaAuthenticatorsIntegrationTests(unittest.TestCase):
@@ -271,5 +277,6 @@
         # set up a fake moodle server
         cls.moodle_server = FakeMoodleServer(('localhost', 7777))
-        cls.moodle_th = threading.Thread(target=cls.moodle_server.serve_forever)
+        cls.moodle_th = threading.Thread(
+            target=cls.moodle_server.serve_forever)
         cls.moodle_th.daemon = True
         cls.moodle_th.start()
@@ -319,5 +326,5 @@
         result = proxy.core_user_create_users(
             [{'username': 'any name'}])
-        assert result ==  [{'id': 37, 'username': 'any name'}]
+        assert result == [{'id': 37, 'username': 'any name'}]
         self.assertRaises(
             xmlrpclib.Fault, proxy.core_user_create_users,
@@ -354,5 +361,5 @@
         result1s = auth.check_credentials('SCHOOL1-bird', 'bebop')
         assert result1s == (True, '')
-        result1a  = auth.check_credentials('SCHOOL1-pig', 'pog')
+        result1a = auth.check_credentials('SCHOOL1-pig', 'pog')
         assert result1a == (True, '')
         # user does not exist
