Changeset 3267


Ignore:
Timestamp:
4 Mar 2008, 08:36:26 (17 years ago)
Author:
joachim
Message:

fix for #497

  1. if sex is invalid the invalid data is written to the pending-file
  2. in pending_only import the imported from is not overwritten, error is still overwritten,since it can be different.
  3. pending.old is created.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTool.py

    r3264 r3267  
    14311431            return em
    14321432        import_source_fn = os.path.split(import_source_path)[1]
    1433         info['imported_from'] = import_source_fn
     1433        if not pending_only:
     1434            info['imported_from'] = import_source_fn
    14341435        attrs = csv.reader(open(import_source_path,"rb")).next()
    14351436        if "import_mode" not in attrs:
     
    15081509                error = results[1]
    15091510                mapping = results[2]
     1511            #
     1512            # restore some values
     1513            #
    15101514            for k in empty_value_keys:
    15111515                mapping[k] = EMPTY
    15121516            if mapping.has_key('sex'):
    15131517                #import pdb;pdb.set_trace()
    1514                 if mapping['sex']:
     1518                if mapping['sex'] == True:
    15151519                    mapping['sex'] = 'F'
    1516                 else:
     1520                elif mapping['sex'] == False:
    15171521                    mapping['sex'] = 'M'
     1522            if pending_only:
     1523                info['imported_from'] = item['imported_from']
    15181524            data_string = ", ".join("%s: %s" % (k,v) for k,v in mapping.items())
    15191525            info['error'] = error
     
    15721578                    logger.info(msg)
    15731579        elapse = time.time() - elapse
     1580        copy2(pending_path,pending_backup)
    15741581        copy2(pending_tmp,pending_path)
    15751582        msg = "finished importing from %(import_source_fn)s in %(elapse).2f seconds, " % vars()
Note: See TracChangeset for help on using the changeset viewer.