Changeset 4375 for waeup/branches
- Timestamp:
- 27 Jun 2009, 15:26:24 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/utils/helpers.py
r4188 r4375 1 1 """General helper functions for WAeUP. 2 2 """ 3 4 3 import os 4 import re 5 5 import sys 6 6 import shutil … … 63 63 removeFileOrDirectory(itemsrc) 64 64 return not_copied 65 66 67 def getInnerHTMLPart(html_code): 68 """Return the 'inner' part of a complete HTML snippet. 69 70 If there is a form part, get this. 71 72 If there is no form part, try to return the body part contents. 73 74 If there is no body, return as-is. 75 """ 76 77 try: 78 result = re.match('^.+(<forms[^\>]*>.*</form>).+$', html_code, 79 re.DOTALL).groups()[0] 80 return result 81 except AttributeError: 82 # No <form> part included 83 try: 84 result = re.match('^.+<body[^\>]*>(.*)</body>.*$', html_code, 85 re.DOTALL).groups()[0] 86 return result 87 except AttributeError: 88 # No <form> and no <body> tag... 89 pass 90 return html_code 91
Note: See TracChangeset for help on using the changeset viewer.