Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1466

Show
Ignore:
Timestamp:
12/02/06 14:38:49
Author:
fumanchu
Message:

Initial test_tidy, plus a bugfix in tidy.strict_xml and indent args.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/tidy.py

    r1419 r1466  
    99     
    1010def tidy(temp_dir, tidy_path, strict_xml=False, errors_to_ignore=None, 
    11          indent=False, wrap=False): 
     11         indent=False, wrap=False, warnings=True): 
    1212    """Run cherrypy.response through Tidy. 
    1313     
    1414    If either 'indent' or 'wrap' are specified, then response.body will be 
    15     set to the output of tidy. Otherwise, only errors will change the body. 
     15    set to the output of tidy. Otherwise, only errors (including warnings, 
     16    if warnings is True) will change the body. 
    1617     
    1718    Note that we use the standalone Tidy tool rather than the python 
     
    4344            tidy_enc = '-' + tidy_enc 
    4445         
    45         strict_xml = (" -xml", "")[bool(strict_xml)] 
     46        strict_xml = ("", " -xml")[bool(strict_xml)] 
    4647         
    4748        if indent: 
    4849            indent = ' -indent' 
    4950        else: 
    50             index = '' 
     51            indent = '' 
    5152         
    5253        if wrap is False: 
     
    6768        new_errs = [] 
    6869        for err in open(err_file, 'rb').read().splitlines(): 
    69             if (err.find('Warning') != -1 or err.find('Error') != -1): 
     70            if (err.find('Error') != -1 or 
     71                (warnings and err.find('Warning') != -1)): 
    7072                ignore = 0 
    7173                for err_ign in errors_to_ignore or []: 
  • trunk/cherrypy/test/test.py

    r1460 r1466  
    363363        'test_sessionauthenticate', 
    364364##        'test_states', 
     365        'test_tidy', 
    365366        'test_xmlrpc', 
    366367        'test_wsgiapps', 

Hosted by WebFaction

Log in as guest/cpguest to create tickets