Index: main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py	(revision 6973)
+++ main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py	(revision 6974)
@@ -229,5 +229,5 @@
 
     @grok.action('Switch reservation of selected beds')
-    def switchReservation(self, **data):
+    def switchReservations(self, **data):
         form = self.request.form
         if form.has_key('val_id'):
@@ -240,27 +240,7 @@
             child_id = [child_id]
         switched = []
-        beds_for_fresh = getattr(self.context,'beds_for_fresh',[])
-        beds_for_pre = getattr(self.context,'beds_for_pre',[])
-        beds_for_returning = getattr(self.context,'beds_for_returning',[])
-        beds_for_final = getattr(self.context,'beds_for_final',[])
         for bed_id in child_id:
             try:
-                actual_type = self.context[bed_id].bed_type
-                sh, sex, bt = actual_type.split('_')
-                hostel_id, block, room_nr, bed = bed_id.split('_')
-                if bt == 'reserved':
-                    bt = 'all'
-                    if bed in beds_for_fresh:
-                        bt = 'fr'
-                    elif bed in beds_for_pre:
-                        bt = 'pr'
-                    elif bed in beds_for_final:
-                        bt = 'fi'
-                    elif bed in beds_for_returning:
-                        bt = 're'
-                    bt = u'%s_%s_%s' % (sh, sex, bt)
-                else:
-                    bt = u'%s_%s_reserved' % (sh, sex)
-                self.context[bed_id].bed_type = bt
+                self.context[bed_id].switchReservation()
                 switched.append(bed_id)
             except:
@@ -270,5 +250,4 @@
                 return
         if len(switched):
-            #import pdb; pdb.set_trace()
             self.flash('Successfully switched: %s' % ', '.join(switched))
             self.redirect(self.url(self.context, '@@manage')+'#tab-2')
Index: main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py	(revision 6973)
+++ main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py	(revision 6974)
@@ -109,7 +109,32 @@
 
     def getBedCoordinates(self):
-        """Determine the coordinates from bed_id.
+        """Determine the coordinates from the bed_id.
         """
-        pass
+        return self.bed_id.split('_')
+
+    def switchReservation(self):
+        """Reserves a bed or relases a reserved bed respectively.
+        """
+        sh, sex, bt = self.bed_type.split('_')
+        hostel_id, block, room_nr, bed = self.getBedCoordinates()
+        beds_for_fresh = getattr(self,'beds_for_fresh',[])
+        beds_for_pre = getattr(self,'beds_for_pre',[])
+        beds_for_returning = getattr(self,'beds_for_returning',[])
+        beds_for_final = getattr(self,'beds_for_final',[])
+        if bt == 'reserved':
+            bt = 'all'
+            if bed in beds_for_fresh:
+                bt = 'fr'
+            elif bed in beds_for_pre:
+                bt = 'pr'
+            elif bed in beds_for_final:
+                bt = 'fi'
+            elif bed in beds_for_returning:
+                bt = 're'
+            bt = u'%s_%s_%s' % (sh, sex, bt)
+        else:
+            bt = u'%s_%s_reserved' % (sh, sex)
+        self.bed_type = bt
+        return
 
     def loggerInfo(self, ob_class, comment=None):
Index: main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py	(revision 6973)
+++ main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py	(revision 6974)
@@ -139,4 +139,8 @@
         """
 
+    def switchReservation():
+        """Reserves bed or relases reserved bed respectively.
+        """
+
     bed_id = schema.TextLine(
         title = u'Bed Id',
