Ignore:
Timestamp:
7 Mar 2008, 08:12:02 (17 years ago)
Author:
joachim
Message:

implemented new Upload functionallity

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTool.py

    r3272 r3277  
    14671467        if not pending_only:
    14681468            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:
    14711471            msg = 'import_mode must be in heading'
    14721472            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
    14811484        #
    14821485        # start importing
     
    14951498        count = 0
    14961499        imported = []
    1497         old_commit_count = 0
     1500        old_commit_count = -1
    14981501        error_count = imported_count = 0
    14991502        already_in = 0
     
    15811584                logger.info(' '.join(log_list))
    15821585            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
    15881589
    15891590            if must_commit or finished:
Note: See TracChangeset for help on using the changeset viewer.