Ignore:
Timestamp:
12 Feb 2011, 15:31:16 (14 years ago)
Author:
uli
Message:

Be more verbose.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/utils/helpers.py

    r5736 r5738  
    1111def removeFileOrDirectory(filepath):
    1212    """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.
    1317    """
    1418    filepath = os.path.abspath(filepath)
     
    7680
    7781    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
    78102    """
    79103
    80104    try:
    81         result = re.match('^.+(<forms[^\>]*>.*</form>).+$', html_code,
     105        result = re.match('^.+(<form[^\>]*>.*</form>).+$', html_code,
    82106                          re.DOTALL).groups()[0]
    83107        return result
Note: See TracChangeset for help on using the changeset viewer.