Index: /main/waeup.uniben/trunk/src/waeup/uniben/hostels/utils.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/hostels/utils.py	(revision 13486)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/hostels/utils.py	(revision 13486)
@@ -0,0 +1,70 @@
+## $Id$
+##
+## Copyright (C) 2015 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""General helper functions and utilities for the hostels section.
+"""
+
+import grok
+from zope.component import getUtility
+from zope.catalog.interfaces import ICatalog
+from waeup.kofa.interfaces import MessageFactory as _
+from waeup.kofa.hostels.utils import HostelsUtils
+from waeup.kofa.hostels.vocabularies import NOT_OCCUPIED
+
+class CustomHostelsUtils(HostelsUtils):
+    """A collection of parameters and methods subject to customization.
+    """
+
+    def getBedStatistics(self):
+        cat = getUtility(ICatalog, name='beds_catalog')
+        stats = {}
+        bed_types = (
+            'regular_female_fr',
+            'regular_female_re',
+            'regular_female_fi',
+            'regular_female_reserved',
+            'regular_male_fr',
+            'regular_male_re',
+            'regular_male_fi',
+            'regular_male_reserved',
+            'ekenwan_female_fr',
+            'ekenwan_female_re',
+            'ekenwan_female_fi',
+            'ekenwan_female_reserved',
+            'ekenwan_male_fr',
+            'ekenwan_male_re',
+            'ekenwan_male_fi',
+            'ekenwan_male_reserved',
+            'clinical_female_fr',
+            'clinical_female_re',
+            'clinical_female_fi',
+            'clinical_female_reserved',
+            'clinical_male_fr',
+            'clinical_male_re',
+            'clinical_male_fi',
+            'clinical_male_reserved',)
+        for bed_type in bed_types:
+            free = cat.searchResults(
+                bed_type=(bed_type, bed_type),
+                owner=(NOT_OCCUPIED, NOT_OCCUPIED))
+            all = cat.searchResults(
+                bed_type=(bed_type, bed_type))
+            free = len(free)
+            total = len(all)
+            occ = total - free
+            stats[bed_type] = (occ, free, total)
+        return stats
