Index: /main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py	(revision 7002)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py	(revision 7003)
@@ -18,4 +18,5 @@
 """
 import grok
+from zope.event import notify
 from datetime import datetime
 from grok import index
@@ -130,4 +131,5 @@
         if self.owner == NOT_OCCUPIED:
             self.owner = student_id
+            notify(grok.ObjectModifiedEvent(self))
             return None
         else:
@@ -135,5 +137,5 @@
 
     def switchReservation(self):
-        """Reserves a bed or unreserve bed respectively.
+        """Reserves or unreserve bed respectively.
         """
         sh, sex, bt = self.bed_type.split('_')
Index: /main/waeup.sirp/trunk/src/waeup/sirp/hostels/tests.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/hostels/tests.py	(revision 7002)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/hostels/tests.py	(revision 7003)
@@ -19,4 +19,7 @@
 import shutil
 import tempfile
+import grok
+from zope.event import notify
+
 from zope.interface.verify import verifyClass, verifyObject
 from zope.component.hooks import setSite, clearSite
@@ -130,5 +133,16 @@
         # We can find a certain bed
         cat = queryUtility(ICatalog, name='beds_catalog')
-        results = cat.searchResults(bed_type=('abc', 'abc'))
+        results = cat.searchResults(bed_type=(u'abc', u'abc'))
+        results = [x for x in results] # Turn results generator into list
+        assert len(results) == 1
+        assert results[0] is self.app['hostels']['hall-x']['xyz']
+
+    def test_search_by_owner(self):
+        # We can find a certain bed
+        myobj = self.app['hostels']['hall-x']['xyz']
+        myobj.owner = u'abc'
+        notify(grok.ObjectModifiedEvent(myobj))
+        cat = queryUtility(ICatalog, name='beds_catalog')
+        results = cat.searchResults(owner=(u'abc', u'abc'))
         results = [x for x in results] # Turn results generator into list
         assert len(results) == 1
Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7002)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7003)
@@ -1108,5 +1108,6 @@
             self.flash('Activation code is invalid.')
             return
-        # Search a bed and exit if no bed is found
+        # Search a bed and exit if no bed is found or if the student
+        # has already booked a bed
         cat = queryUtility(ICatalog, name='beds_catalog', default=None)
         entries = cat.searchResults(
@@ -1117,4 +1118,11 @@
             self.flash('There is no free bed in your category %s.'
                         % acc_details['bt'])
+            return
+        entries = cat.searchResults(
+            owner=(student.student_id,student.student_id))
+        if len(entries):
+            bed = [entry for entry in entries][0]
+            self.flash('You already booked bed %s.'
+                        % bed.bed_id)
             return
         # Mark pin as used (this also fires a pin related transition)
