Changeset 4965
- Timestamp:
- Jan 22, 2008, 6:10:50 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/data_audit.py
r4963 r4965 17 17 audit_exceptions = (NotPublishable, FilenameMismatch, CRCMismatch, Invalid, WrongTags) 18 18 19 def IP_verified(directory ):19 def IP_verified(directory, verbose=False): 20 20 """Find and audit potential data files that might violate IP 21 21 … … 30 30 # Proceed boldly with confidence 31 31 32 verbose controls standard output. 33 If verbose is False, only diagnostics about failed audits will appear. 34 All files that check OK will pass silently. 35 32 36 33 37 """ … … 46 50 all_files_accounted_for = True 47 51 for dirpath, datafile in identify_datafiles(directory): 52 48 53 filename = join(dirpath, datafile) 49 50 print filename + ' (Checksum=%s): ' %str(compute_checksum(filename)),51 52 54 basename, ext = splitext(datafile) 53 55 54 56 # Look for a XML license file with the .lic 57 status = 'OK' 55 58 try: 56 59 fid = open(join(dirpath, basename + '.lic')) 57 60 except IOError: 58 print'NO LICENSE FILE'61 status = 'NO LICENSE FILE' 59 62 all_files_accounted_for = False 60 63 else: 61 64 try: 62 license_file_is_valid(fid, dirpath, verbose= False)65 license_file_is_valid(fid, dirpath, verbose=verbose) 63 66 except audit_exceptions, e: 64 67 all_files_accounted_for = False 65 print'LICENSE FILE NOT VALID'66 print 'REASON:',e68 status = 'LICENSE FILE NOT VALID' 69 status += 'REASON: %s' %e 67 70 68 71 #doc = parse(fid) 69 72 #pretty_print_tree(doc) 70 73 fid.seek(0) 71 printfid.read()72 73 else:74 74 status += fid.read() 75 76 #else: 77 # if verbose: print 'OK' 75 78 76 79 fid.close() 80 81 if status != 'OK' or verbose is True: 82 print filename + ' (Checksum=%s): '\ 83 %str(compute_checksum(filename)), status 84 85 77 86 78 87 # Return result
Note: See TracChangeset
for help on using the changeset viewer.