- Timestamp:
- 12 Feb 2011, 15:31:16 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/utils/helpers.py
r5736 r5738 11 11 def removeFileOrDirectory(filepath): 12 12 """Remove a file or directory. 13 14 Different to :func:`shutil.rmtree` we also accept not existing 15 paths (returning silently) and if a dir turns out to be a regular 16 file, we remove that. 13 17 """ 14 18 filepath = os.path.abspath(filepath) … … 76 80 77 81 If there is no body, return as-is. 82 83 Let's see how that works. If we deliver some doc with form, we 84 will get that form only: 85 86 >>> doc = '<html><form>My Form</form>Outside the form</html>' 87 >>> getInnerHTMLPart(doc) 88 '<form>My Form</form>' 89 90 No form? Then seek for a body part and get the contents: 91 92 >>> doc = '<html><body>My Body</body>Trailing Trash</html>' 93 >>> getInnerHTMLPart(doc) 94 'My Body' 95 96 If none of these is included, return what we got: 97 98 >>> doc = '<html>without body nor form</html>' 99 >>> getInnerHTMLPart(doc) 100 '<html>without body nor form</html>' 101 78 102 """ 79 103 80 104 try: 81 result = re.match('^.+(<form s[^\>]*>.*</form>).+$', html_code,105 result = re.match('^.+(<form[^\>]*>.*</form>).+$', html_code, 82 106 re.DOTALL).groups()[0] 83 107 return result
Note: See TracChangeset for help on using the changeset viewer.