Index: /waeup/branches/ulif-rewrite/src/waeup/utils/helpers.py
===================================================================
--- /waeup/branches/ulif-rewrite/src/waeup/utils/helpers.py	(revision 4374)
+++ /waeup/branches/ulif-rewrite/src/waeup/utils/helpers.py	(revision 4375)
@@ -1,6 +1,6 @@
 """General helper functions for WAeUP.
 """
-
 import os
+import re
 import sys
 import shutil
@@ -63,2 +63,29 @@
             removeFileOrDirectory(itemsrc)
     return not_copied
+
+
+def getInnerHTMLPart(html_code):
+    """Return the 'inner' part of a complete HTML snippet.
+
+    If there is a form part, get this.
+
+    If there is no form part, try to return the body part contents.
+
+    If there is no body, return as-is.
+    """
+
+    try:
+        result = re.match('^.+(<forms[^\>]*>.*</form>).+$', html_code,
+                          re.DOTALL).groups()[0]
+        return result
+    except AttributeError:
+        # No <form> part included
+        try:
+            result = re.match('^.+<body[^\>]*>(.*)</body>.*$', html_code,
+                              re.DOTALL).groups()[0]
+            return result
+        except AttributeError:
+            # No <form> and no <body> tag...
+            pass
+    return html_code
+
