Index: main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 13246)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 13247)
@@ -1988,39 +1988,8 @@
         students_utils = getUtility(IStudentsUtils)
         acc_details  = students_utils.getAccommodationDetails(student)
-        if acc_details.get('expired', False):
-            startdate = acc_details.get('startdate')
-            enddate = acc_details.get('enddate')
-            if startdate and enddate:
-                tz = getUtility(IKofaUtils).tzinfo
-                startdate = to_timezone(
-                    startdate, tz).strftime("%d/%m/%Y %H:%M:%S")
-                enddate = to_timezone(
-                    enddate, tz).strftime("%d/%m/%Y %H:%M:%S")
-                self.flash(_("Outside booking period: ${a} - ${b}",
-                    mapping = {'a': startdate, 'b': enddate}), type="warning")
-            else:
-                self.flash(_("Outside booking period."), type="warning")
-            self.redirect(self.url(self.context))
-            return
-        if not acc_details.get('bt'):
-            self.flash(_("Your data are incomplete."), type="warning")
-            self.redirect(self.url(self.context))
-            return
-        if not student.state in acc_details['allowed_states']:
-            self.flash(_("You are in the wrong registration state."),
-                       type="warning")
-            self.redirect(self.url(self.context))
-            return
-        if student['studycourse'].current_session != acc_details[
-            'booking_session']:
-            self.flash(
-                _('Your current session does not match accommodation session.'),
-                type="warning")
-            self.redirect(self.url(self.context))
-            return
-        if str(acc_details['booking_session']) in self.context.keys():
-            self.flash(
-                _('You already booked a bed space in current ' \
-                    + 'accommodation session.'), type="warning")
+        error_message = students_utils.checkAccommodationRequirements(
+            student, acc_details)
+        if error_message:
+            self.flash(error_message, type="warning")
             self.redirect(self.url(self.context))
             return
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py	(revision 13246)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py	(revision 13247)
@@ -600,4 +600,31 @@
         return d
 
+    def checkAccommodationRequirements(self, student, acc_details):
+        if acc_details.get('expired', False):
+            startdate = acc_details.get('startdate')
+            enddate = acc_details.get('enddate')
+            if startdate and enddate:
+                tz = getUtility(IKofaUtils).tzinfo
+                startdate = to_timezone(
+                    startdate, tz).strftime("%d/%m/%Y %H:%M:%S")
+                enddate = to_timezone(
+                    enddate, tz).strftime("%d/%m/%Y %H:%M:%S")
+                return _("Outside booking period: ${a} - ${b}",
+                         mapping = {'a': startdate, 'b': enddate})
+            else:
+                return _("Outside booking period.")
+        if not acc_details.get('bt'):
+            return _("Your data are incomplete.")
+        if not student.state in acc_details['allowed_states']:
+            return _("You are in the wrong registration state.")
+        if student['studycourse'].current_session != acc_details[
+            'booking_session']:
+            return _('Your current session does not '
+                     'match accommodation session.')
+        if str(acc_details['booking_session']) in student['accommodation'].keys():
+            return _('You already booked a bed space in '
+                     'current accommodation session.')
+        return
+
     def selectBed(self, available_beds):
         """Select a bed from a list of available beds.
