Index: main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py	(revision 9830)
+++ main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py	(revision 9831)
@@ -28,5 +28,5 @@
 #   If you enable this, please make sure the external services
 #   do exist really and are not bothered by being spammed by a test programme.
-EXTERNAL_TESTS = True
+EXTERNAL_TESTS = False
 
 def external_test(func):
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py	(revision 9830)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py	(revision 9831)
@@ -193,7 +193,9 @@
             self.redirect(self.url(self.context))
             return
-        if self.context.total_credits > self.max_credits:
+        students_utils = getUtility(IStudentsUtils)
+        max_credits = students_utils.maxCredits(self.context)
+        if self.context.total_credits > max_credits:
             self.flash(_('Maximum credits of ${a} exceeded.',
-                mapping = {'a':self.max_credits}))
+                mapping = {'a':max_credits}))
             return
         IWorkflowInfo(self.context.student).fireTransition(
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 9830)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 9831)
@@ -687,5 +687,5 @@
                            self.browser.contents)
         self.browser.getControl("Create course list now").click()
-        # A level with one course ticket was created
+        # A level with no course ticket was created
         self.assertEqual(self.student['studycourse']['700'].number_of_tickets, 0)
         self.browser.getLink("700").click()
@@ -693,8 +693,28 @@
         self.browser.getControl("Add course ticket").click()
         self.browser.getControl(name="form.course").value = ['COURSE1']
+        # Non-final year students can't add ticket with 51 credits
+        self.app['faculties']['fac1']['dep1'].courses['COURSE1'].credits = 51
+        self.browser.getControl("Add course ticket").click()
+        self.assertMatches('...Your total credits exceed 50...',
+                           self.browser.contents)
+        # Final year students can't add ticket with 52 credits ...
+        self.app['faculties']['fac1']['dep1'].courses['COURSE1'].credits = 52
+        self.student['studycourse'].certificate.end_level = 700
+        self.browser.getControl("Add course ticket").click()
+        self.assertMatches('...Your total credits exceed 51...',
+                           self.browser.contents)
+        # ... but with 51 credits
+        self.app['faculties']['fac1']['dep1'].courses['COURSE1'].credits = 51
         self.browser.getControl("Add course ticket").click()
         self.assertMatches('...Successfully added COURSE1...',
                            self.browser.contents)
-        # Special postgraduate students can register course lists
+        # Non-final year special postgraduate students can't register
+        # course lists if their total credits are 51 and thus exceed 50 ...
+        self.student['studycourse'].certificate.end_level = 800
+        self.browser.getControl("Register course list").click()
+        self.assertMatches('...Maximum credits of 50 exceeded...',
+            self.browser.contents)
+        # ... but final year students can
+        self.student['studycourse'].certificate.end_level = 700
         self.browser.getControl("Register course list").click()
         self.assertMatches('...Course list has been registered...',
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 9830)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 9831)
@@ -225,4 +225,18 @@
         return None, payment
 
+    def maxCredits(self, studylevel):
+        """Return maximum credits.
+
+        """
+        studycourse = studylevel.__parent__
+        certificate = getattr(studycourse,'certificate', None)
+        current_level = studycourse.current_level
+        if None in (current_level, certificate):
+            return 0
+        end_level = certificate.end_level
+        if current_level >= end_level:
+            return 51
+        return 50
+
     # Uniben prefix
     STUDENT_ID_PREFIX = u'B'
