Changeset 3155
- Timestamp:
- 13 Feb 2008, 14:18:58 (17 years ago)
- Location:
- WAeUP_SRP/base
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r3148 r3155 2121 2121 # 2122 2122 not_imported_keys = import_keys + ["Error",] 2123 not_imported_file = open(not_imported_fn," a")2123 not_imported_file = open(not_imported_fn,"w") 2124 2124 not_imported_csv_writer = csv.DictWriter(not_imported_file, 2125 2125 not_imported_keys, … … 2134 2134 if 'id' not in imported_keys: 2135 2135 imported_keys.insert(0,"id") 2136 imported_file = open(imported_fn," a")2136 imported_file = open(imported_fn,"w") 2137 2137 imported_csv_writer = csv.DictWriter(imported_file, 2138 2138 imported_keys, … … 2178 2178 pending_imported_ids = [] 2179 2179 pending_imported = [] 2180 for item in pending_records.values(): 2180 for record in pending_records.values(): 2181 item = {} 2182 for k,v in record.items(): 2183 if v: 2184 item[k] = v 2181 2185 results = importer(item) 2182 2186 id = results[0] … … 2185 2189 if is_pending: 2186 2190 continue 2187 if error: 2188 continue 2189 msg = format % item 2191 del item['Error'] 2192 msg = ";".join(["%s : %s" % (k,v) for k,v in item.items()]) 2190 2193 logger.info("imported from %(pending_fn)s %(msg)s" % vars()) 2191 2194 pending_imported.append(item) 2192 2195 pending_imported_ids += id, 2193 2196 total_pending_imported = len(pending_imported_ids) 2194 logger.info("imported %d pending imports" % len(pending_imported_ids))2197 logger.info("imported %d pending imports" % len(pending_imported_ids)) 2195 2198 for id in pending_imported_ids: 2196 if pending_records.has_key(id): 2197 del pending_records[id] 2199 del pending_records[id] 2198 2200 pending_imports_file = open(pending_fn,'w') 2199 2201 pending_csv_writer = csv.DictWriter(pending_imports_file,
Note: See TracChangeset for help on using the changeset viewer.