Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 8973)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 8974)
@@ -1594,17 +1594,16 @@
             self.flash(_('Activation code is invalid.'))
             return
+        if code.state == USED:
+            self.flash(_('Activation code has already been used.'))
+            return
         # Mark pin as used (this also fires a pin related transition)
         # and fire transition start_clearance
-        if code.state == USED:
-            self.flash(_('Activation code has already been used.'))
-            return
-        else:
-            comment = _(u"invalidated")
-            # Here we know that the ac is in state initialized so we do not
-            # expect an exception, but the owner might be different
-            if not invalidate_accesscode(pin,comment,self.context.student_id):
-                self.flash(_('You are not the owner of this access code.'))
-                return
-            self.context.clr_code = pin
+        comment = _(u"invalidated")
+        # Here we know that the ac is in state initialized so we do not
+        # expect an exception, but the owner might be different
+        if not invalidate_accesscode(pin, comment, self.context.student_id):
+            self.flash(_('You are not the owner of this access code.'))
+            return
+        self.context.clr_code = pin
         IWorkflowInfo(self.context).fireTransition('start_clearance')
         self.flash(_('Clearance process has been started.'))
@@ -1623,7 +1622,9 @@
     def form_fields(self):
         if self.context.is_postgrad:
-            form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked')
-        else:
-            form_fields = grok.AutoFields(IUGStudentClearance).omit('clearance_locked')
+            form_fields = grok.AutoFields(IPGStudentClearance).omit(
+                'clearance_locked')
+        else:
+            form_fields = grok.AutoFields(IUGStudentClearance).omit(
+                'clearance_locked')
         return form_fields
 
