Index: /main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_utils.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_utils.py	(revision 11814)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_utils.py	(revision 11815)
@@ -18,4 +18,5 @@
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##
+import psutil
 import unittest
 from waeup.kofa.interfaces import IKofaUtils
@@ -26,4 +27,12 @@
 class KofaUtilsTestCase(unittest.TestCase):
 
+    def get_cleared_util(self):
+        # Helper: get a `KofUtil` instance with all values of
+        # SYSTEM_MAX_LOAD dict set to ``None``
+        util = KofaUtils()
+        for key, val in util.SYSTEM_MAX_LOAD.items():
+            util.SYSTEM_MAX_LOAD[key] = None
+        return util
+
     def test_iface(self):
         # KofaUtils fullfill IKofaUtils expectations
@@ -31,2 +40,30 @@
         verify.verifyClass(IKofaUtils, KofaUtils)
         verify.verifyObject(IKofaUtils, utils)
+
+    def test_expensive_actions_allowed_swap_none(self):
+        # unset swap maximum values make KofUtils ignore swap values
+        utils = self.get_cleared_util()
+        utils.SYSTEM_MAX_LOAD['swap-mem'] = None
+        assert utils.expensive_actions_allowed() == True
+
+    @unittest.skipIf(
+        psutil.swap_memory().percent >= 99.0,
+        reason="System swap use over 99%. Cannot set higher allowed value.")
+    def test_expensive_actions_allowed_swap_ok(self):
+        # We can react to high swap values
+        utils = self.get_cleared_util()
+        utils.SYSTEM_MAX_LOAD['swap-mem'] = 99.0    # positive number
+        assert utils.expensive_actions_allowed() == True
+        utils.SYSTEM_MAX_LOAD['swap-mem'] = -1.0    # negative number
+        assert utils.expensive_actions_allowed() == True
+
+    @unittest.skipIf(
+        not psutil.swap_memory().percent,
+        reason="Can test swapping behavior only if actually swapping")
+    def test_expensive_actions_allowed_swap_too_much(self):
+        # We can react if too much swap is used
+        utils = self.get_cleared_util()
+        utils.SYSTEM_MAX_LOAD['swap-mem'] = 0.0     # positive number
+        assert utils.expensive_actions_allowed() == False
+        utils.SYSTEM_MAX_LOAD['swap-mem'] = -100.0  # negative number
+        assert utils.expensive_actions_allowed() == False
Index: /main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py	(revision 11814)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py	(revision 11815)
@@ -19,4 +19,5 @@
 """
 import grok
+import psutil
 import string
 import pytz
@@ -305,2 +306,28 @@
         """
         return payment.p_item
+
+    def expensive_actions_allowed(self, type=None, request=None):
+        """Tell, whether expensive actions are currently allowed.
+
+        Check system load/health (or other external circumstances) and
+        locally set values to see, whether expensive actions should be
+        allowed (`True`) or better avoided (`False`).
+
+        Use this to allow or forbid exports, report generations, or
+        similar actions.
+        """
+        max_values = self.SYSTEM_MAX_LOAD
+        if max_values['swap-mem'] is not None:
+            swap_mem = psutil.swap_memory()
+            max_val = max_values['swap-mem']
+            if isinstance(max_val, float):
+                if max_val < 0.0:
+                    max_val += 100.0
+                if swap_mem.percent > max_val:
+                    return False
+            else:
+                if max_val < 0:
+                    max_val += swap_mem.total
+                if swap_mem.used > max_val:
+                    return False
+        return True
