Changeset 3277 for WAeUP_SRP/base/WAeUPTool.py
- Timestamp:
- 7 Mar 2008, 08:12:02 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r3272 r3277 1467 1467 if not pending_only: 1468 1468 info['imported_from'] = import_source_fn 1469 attrs= csv.reader(open(import_source_path,"rb")).next()1470 if "import_mode" not in attrs:1469 headline = csv.reader(open(import_source_path,"rb")).next() 1470 if "import_mode" not in headline: 1471 1471 msg = 'import_mode must be in heading' 1472 1472 return msg 1473 1474 import_keys = [k.strip() for k in attrs if not (k.strip().startswith('ignore') 1475 or k.strip() in info.keys())] 1476 diff2schema = set(import_keys).difference(set(importer.schema.keys())) 1477 diff2layout = set(import_keys).difference(set(importer.layout.keys())) 1478 if diff2schema and diff2schema != set(['id',]): 1479 msg = 'not ignorable key(s): "%s" found in heading' % ", ".join(diff2schema) 1480 return msg 1473 invalid_keys = importer.checkHeadline(headline) 1474 if invalid_keys: 1475 return 'not ignorable key(s): "%s" found in heading' % ", ".join(invalid_keys) 1476 1477 # import_keys = [k.strip() for k in headline if not (k.strip().startswith('ignore') 1478 # or k.strip() in info.keys())] 1479 # diff2schema = set(import_keys).difference(set(importer.schema.keys())) 1480 # diff2layout = set(import_keys).difference(set(importer.layout.keys())) 1481 # if diff2schema and diff2schema != set(['id',]): 1482 # msg = 'not ignorable key(s): "%s" found in heading' % ", ".join(diff2schema) 1483 # return msg 1481 1484 # 1482 1485 # start importing … … 1495 1498 count = 0 1496 1499 imported = [] 1497 old_commit_count = 01500 old_commit_count = -1 1498 1501 error_count = imported_count = 0 1499 1502 already_in = 0 … … 1581 1584 logger.info(' '.join(log_list)) 1582 1585 finished = count > total_to_import - 1 1583 must_commit = False 1584 if len(imported) != old_commit_count: 1585 if not len(imported) % commit_after: 1586 must_commit = True 1587 old_commit_count = len(imported) 1586 must_commit = (imported_count != old_commit_count) and (not imported_count % commit_after) 1587 if must_commit: 1588 old_commit_count = imported_count 1588 1589 1589 1590 if must_commit or finished:
Note: See TracChangeset for help on using the changeset viewer.