Index: main/waeup.kofa/trunk/src/waeup/kofa/hostels/__init__.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/hostels/__init__.py	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/hostels/__init__.py	(revision 17313)
@@ -1,11 +1,1 @@
-"""This package contains everything regarding hostels.
-"""
 # Make this a package.
-from waeup.kofa.hostels.container import HostelsContainer
-from waeup.kofa.hostels.hostel import Hostel, Bed
-
-__all__ = [
-    'HostelsContainer',
-    'Hostel',
-    'Bed',
-    ]
Index: main/waeup.kofa/trunk/src/waeup/kofa/hostels/batching.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/hostels/batching.py	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/hostels/batching.py	(revision 17313)
@@ -83,7 +83,7 @@
 class BedProcessor(BatchProcessor):
     """The Bed Procesor update beds. It allocates students
-    to empty beds and switches the reservation status of beds. ``1``
-    means reserved and ``0`` unreserved. Beds cannot be released
-    by import.
+    to empty beds and switches the reservation or blockade status of beds. ``1``
+    means reserved (or blocked) and ``0`` unreserved (or unblocked).
+    Beds cannot be released by import.
     """
     grok.implements(IBatchProcessor)
@@ -103,5 +103,5 @@
     @property
     def available_fields(self):
-        return self.location_fields + ['reserved', 'owner']
+        return self.location_fields + ['reserved', 'blocked', 'owner']
 
     def parentsExist(self, row, site):
@@ -132,4 +132,9 @@
         if row.get('owner') and obj.owner != NOT_OCCUPIED:
             return 'Bed is occupied.'
+        # Check if bed is blocked and not unblocked by the importer
+        if obj.bed_type.endswith('blocked') and \
+            row.get('owner') not in (None, '', IGNORE_MARKER) and \
+            row.get('blocked') != '0':
+            return 'Bed is blocked.'
 
     def checkConversion(self, row, mode='ignore'):
@@ -142,4 +147,7 @@
         if reserved not in (None, IGNORE_MARKER, '', '0', '1'):
             errs.append(('reserved','invalid value'))
+        blocked = row.get('blocked')
+        if blocked not in (None, IGNORE_MARKER, '', '0', '1'):
+            errs.append(('blocked','invalid value'))
         owner = row.get('owner')
         if owner not in (None, '', IGNORE_MARKER):
@@ -168,9 +176,14 @@
             obj.bookBed(owner)
             changed.append('owner=%s' % owner)
+        sh, sex, bt = obj.bed_type.split('_')
         reserved = row.get('reserved')
-        sh, sex, bt = obj.bed_type.split('_')
         if (reserved == '1' and bt != 'reserved') or \
             (reserved == '0'and bt == 'reserved'):
-            message = obj.switchReservation()
+            message = obj.switchBed('reserved')
+            changed.append(message)
+        blocked = row.get('blocked')
+        if (blocked == '1' and bt != 'blocked') or \
+            (blocked == '0'and bt == 'blocked'):
+            message = obj.switchBed('blocked')
             changed.append(message)
         # Log actions...
Index: main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py	(revision 17313)
@@ -266,5 +266,5 @@
     grok.name('addhostel')
     #grok.template('hosteladdpage')
-    form_fields = grok.AutoFields(IHostel).omit('beds_reserved', 'hostel_id')
+    form_fields = grok.AutoFields(IHostel).omit('hostel_id')
     label = _('Add hostel')
     pnav = 5
@@ -294,5 +294,5 @@
     grok.require('waeup.viewHostels')
     grok.template('hostelpage')
-    form_fields = grok.AutoFields(IHostel).omit('beds_reserved')
+    form_fields = grok.AutoFields(IHostel)
     pnav = 5
 
@@ -315,5 +315,5 @@
     grok.name('manage')
     grok.require('waeup.manageHostels')
-    form_fields = grok.AutoFields(IHostel).omit('hostel_id', 'beds_reserved')
+    form_fields = grok.AutoFields(IHostel).omit('hostel_id')
     grok.template('hostelmanagepage')
     label = _('Manage hostel')
@@ -322,4 +322,5 @@
     tabtwoactions = [_('Update all beds'),
         _('Switch reservation of selected beds'),
+        _('Switch blockade of selected beds'),
         _('Release selected beds'),
         _('Clear hostel')]
@@ -337,6 +338,7 @@
 
     @action(_('Update all beds'), style='primary',
-            warning=_('Attention: The updater removes all reservation flags of existing beds.'
-                        ' You really want to update?'))
+            warning=_('Attention: The updater removes all reservation and '
+                        'blockade flags of existing beds. '
+                        'You really want to update?'))
     def updateBeds(self, **data):
         if not grok.getSite()['configuration'].maintmode_enabled_by:
@@ -364,6 +366,5 @@
         return
 
-    @action(_('Switch reservation of selected beds'))
-    def switchReservations(self, **data):
+    def _switchBeds(self, switch_type):
         form = self.request.form
         if 'val_id' in form:
@@ -380,5 +381,5 @@
         preferred_language = self.request.cookies.get('kofa.language')
         for bed_id in child_id:
-            message = self.context[bed_id].switchReservation()
+            message = self.context[bed_id].switchBed(switch_type)
             switched.append('%s (%s)' % (bed_id,message))
             m_translated = translate(message, 'waeup.kofa',
@@ -396,4 +397,15 @@
             self.context.writeLogMessage(self, 'switched: %s' % message)
             self.redirect(self.url(self.context, '@@manage')+'#tab2')
+            return
+
+
+    @action(_('Switch reservation of selected beds'))
+    def switchReservations(self, **data):
+        self._switchBeds('reserved')
+        return
+
+    @action(_('Switch blockade of selected beds'))
+    def switchBockade(self, **data):
+        self._switchBeds('blocked')
         return
 
@@ -456,4 +468,7 @@
 
     def update(self):
+        if self.context.bed_type.endswith('blocked'):
+            # No student can reside in a blocked bed.
+            self.redirect(self.url(self.context.__parent__, '@@manage')+'#tab2')
         if self.context.owner != NOT_OCCUPIED:
             # Don't use this form for exchanging students.
Index: main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser_templates/hostelmanagepage.pt
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser_templates/hostelmanagepage.pt	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser_templates/hostelmanagepage.pt	(revision 17313)
@@ -59,5 +59,5 @@
                 <span tal:content="value/owner">OWNER</span>
               </a>
-              <a tal:condition="python: value.owner == view.not_occupied"
+              <a tal:condition="python: value.owner == view.not_occupied and not value.bed_type.endswith('blocked')"
                  tal:attributes="href python: view.url(value)"
                  i18n:translate="">
Index: main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py	(revision 17313)
@@ -198,6 +198,6 @@
             return self.owner
 
-    def switchReservation(self):
-        """Reserves or unreserve bed respectively.
+    def switchBed(self, switch_type):
+        """Switches bed. `switch_type` is either `reserved` or `blocked`.
         """
         sh, sex, bt = self.bed_type.split('_')
@@ -209,5 +209,5 @@
         beds_for_final = getattr(hostel,'beds_for_final',[])
         bed_string = u'%s_%s_%s' % (block, room_nr, bed)
-        if bt == 'reserved':
+        if bt == switch_type:
             bt = 'all'
             if bed in beds_for_fresh:
@@ -220,8 +220,8 @@
                 bt = 're'
             bt = u'%s_%s_%s' % (sh, sex, bt)
-            message = _(u'unreserved')
+            message = _(u'un' + switch_type)
         else:
-            bt = u'%s_%s_reserved' % (sh, sex)
-            message = _(u'reserved')
+            bt = u'%s_%s_%s' % (sh, sex, switch_type)
+            message = switch_type
         self.bed_type = bt
         notify(grok.ObjectModifiedEvent(self))
Index: main/waeup.kofa/trunk/src/waeup/kofa/hostels/interfaces.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/hostels/interfaces.py	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/hostels/interfaces.py	(revision 17313)
@@ -28,5 +28,5 @@
     bed_letters, blocks, SpecialHandlingSource,
     NOT_OCCUPIED)
-from waeup.kofa.students.interfaces import (IStudentsUtils)
+from waeup.kofa.students.interfaces import IStudentsUtils
 
 # Define a validation method for sort ids
@@ -248,6 +248,6 @@
         """
 
-    def switchReservation():
-        """Reserves bed or relases reserved bed respectively.
+    def switchBed(switch_type):
+        """Switches reservation or blockade.
         """
 
Index: main/waeup.kofa/trunk/src/waeup/kofa/hostels/sample_bed_data.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/hostels/sample_bed_data.csv	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/hostels/sample_bed_data.csv	(revision 17313)
@@ -1,6 +1,6 @@
-hostel_id,bed_id,owner,reserved
-block-a-upper-hostel,block-a-upper-hostel_A_101_A,,0
-block-a-upper-hostel,block-a-upper-hostel_A_101_B,,1
-block-a-upper-hostel,block-a-upper-hostel_A_101_C,,2
-block-a-upper-hostel,block-a-upper-hostel_A_101_D,K1000000,0
-block-a-upper-hostel,block-a-upper-hostel_A_101_E,K999,0
+hostel_id,bed_id,owner,reserved,blocked
+block-a-upper-hostel,block-a-upper-hostel_A_101_A,,0,1
+block-a-upper-hostel,block-a-upper-hostel_A_101_B,,1,0
+block-a-upper-hostel,block-a-upper-hostel_A_101_C,,2,0
+block-a-upper-hostel,block-a-upper-hostel_A_101_D,K1000000,0,0
+block-a-upper-hostel,block-a-upper-hostel_A_101_E,K999,0,0
Index: main/waeup.kofa/trunk/src/waeup/kofa/hostels/sample_bed_data_2.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/hostels/sample_bed_data_2.csv	(revision 17313)
+++ main/waeup.kofa/trunk/src/waeup/kofa/hostels/sample_bed_data_2.csv	(revision 17313)
@@ -0,0 +1,2 @@
+hostel_id,bed_id,owner,reserved,blocked
+block-a-upper-hostel,block-a-upper-hostel_A_101_A,K1000001,,
Index: main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py	(revision 17313)
@@ -31,5 +31,5 @@
 from zope.security.interfaces import Unauthorized
 from zope.catalog.interfaces import ICatalog
-from zope.component import queryUtility, getUtility
+from zope.component import queryUtility, getUtility, createObject
 from waeup.kofa.app import University
 from waeup.kofa.hostels.interfaces import (
@@ -54,4 +54,8 @@
 BED_SAMPLE_DATA = open(
     os.path.join(os.path.dirname(__file__), 'sample_bed_data.csv'),
+    'rb').read()
+
+BED_SAMPLE_DATA_2 = open(
+    os.path.join(os.path.dirname(__file__), 'sample_bed_data_2.csv'),
     'rb').read()
 
@@ -396,4 +400,33 @@
              (u'hall-1_A_101_C', u'regular_female_reserved'),
              (u'hall-1_A_101_D', u'regular_female_reserved')])
+        # Block beds.
+        self.browser.getControl("Switch blockade", index=0).click()
+        self.assertTrue('No item selected' in self.browser.contents)
+        ctrl = self.browser.getControl(name='val_id')
+        ctrl.getControl(value='hall-1_A_101_A').selected = True
+        ctrl.getControl(value='hall-1_A_101_B').selected = True
+        ctrl.getControl(value='hall-1_A_101_C').selected = True
+        ctrl.getControl(value='hall-1_A_101_D').selected = True
+        self.browser.getControl("Switch blockade", index=0).click()
+        self.assertTrue('Successfully switched beds: hall-1_A_101_A (blocked)'
+            in self.browser.contents)
+        self.assertEqual(self.app['hostels']['hall-1'][
+            'hall-1_A_101_D'].bed_type, 'regular_female_blocked')
+        # The catalog has been updated.
+        results = cat.searchResults(
+            bed_type=('regular_female_all', 'regular_female_all'))
+        results = [(x.bed_id, x.bed_type) for x in results]
+        self.assertEqual(results,
+            [(u'hall-1_A_101_E', u'regular_female_all'),
+             (u'hall-1_B_101_D', u'regular_female_all'),
+             (u'hall-1_B_101_E', u'regular_female_all')])
+        results = cat.searchResults(
+            bed_type=('regular_female_blocked', 'regular_female_blocked'))
+        results = [(x.bed_id, x.bed_type) for x in results]
+        self.assertEqual(results,
+            [(u'hall-1_A_101_A', u'regular_female_blocked'),
+             (u'hall-1_A_101_B', u'regular_female_blocked'),
+             (u'hall-1_A_101_C', u'regular_female_blocked'),
+             (u'hall-1_A_101_D', u'regular_female_blocked')])
         # Change hostel configuration with one bed booked.
         hall['hall-1_A_101_E'].owner = u'anyid'
@@ -672,13 +705,13 @@
         logcontent = open(self.logfile).read()
         self.assertEqual(
-            'owner,bed_id,hostel_id,reserved,--ERRORS--\r\n'
-            '<IGNORE>,block-a-upper-hostel_A_101_C,block-a-upper-hostel,2,'
+            'owner,bed_id,hostel_id,reserved,blocked,--ERRORS--\r\n'
+            '<IGNORE>,block-a-upper-hostel_A_101_C,block-a-upper-hostel,2,0,'
             'reserved: invalid value\r\n'
-            'K999,block-a-upper-hostel_A_101_E,block-a-upper-hostel,0,'
+            'K999,block-a-upper-hostel_A_101_E,block-a-upper-hostel,0,0,'
             'owner: student does not exist\r\n',
             fail_file_content)
         self.assertTrue(
             'system - Bed Processor (update only) - sample_bed_data - '
-            'block-a-upper-hostel_A_101_A - updated: nothing'
+            'block-a-upper-hostel_A_101_A - updated: blocked'
             in logcontent)
         self.assertTrue(
@@ -697,4 +730,20 @@
                     ['block-a-upper-hostel_A_101_B'].bed_type,
                     'regular_female_reserved')
+        # Add another student K1000001
+        student = createObject('waeup.Student')
+        student.firstname = u'Claus'
+        student.lastname = u'Tester'
+        self.app['students'].addStudent(student)
+        # Try to allocate this student to a blocked bed
+
+        open(self.csv_file, 'wb').write(BED_SAMPLE_DATA_2)
+        num, num_warns, fin_file, fail_file = self.processor.doImport(
+            self.csv_file, BED_HEADER_FIELDS, 'update')
+        fail_file_content = open(fail_file).read()
+        self.assertEqual(
+            'owner,bed_id,hostel_id,reserved,blocked,--ERRORS--\r\n'
+            'K1000001,block-a-upper-hostel_A_101_A,block-a-upper-hostel,'
+            '<IGNORE>,<IGNORE>,Bed is blocked.\r\n',
+            fail_file_content)
         shutil.rmtree(os.path.dirname(fin_file))
         shutil.rmtree(self.workdir)
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/__init__.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/__init__.py	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/__init__.py	(revision 17313)
@@ -1,22 +1,1 @@
-"""This package contains everything regarding students.
-"""
 # Make this a package.
-from waeup.kofa.students.student import (
-    Student, StudentFactory
-    )
-from waeup.kofa.students.container import StudentsContainer
-from waeup.kofa.students.studycourse import StudentStudyCourse
-from waeup.kofa.students.payments import StudentPaymentsContainer
-from waeup.kofa.students.accommodation import StudentAccommodation
-from waeup.kofa.students.dynamicroles import StudentPrincipalRoleManager
-
-
-__all__ = [
-    'Student',
-    'StudentFactory',
-    'StudentsContainer',
-    'StudentStudyCourse',
-    'StudentPaymentsContainer',
-    'StudentAccommodation',
-    'StudentPrincipalRoleManager',
-    ]
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_dynamicroles.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_dynamicroles.py	(revision 17280)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_dynamicroles.py	(revision 17313)
@@ -27,5 +27,6 @@
 from waeup.kofa.app import University
 from waeup.kofa.students.tests.test_browser import StudentsFullSetup
-from waeup.kofa.students import Student, StudentPrincipalRoleManager
+from waeup.kofa.students.student import Student
+from waeup.kofa.students.dynamicroles import StudentPrincipalRoleManager
 
 class StudentPrincipalRoleManagerTests(APRMTest):
