From d566fedf4cb468dad28471b8cbbaa2111e702757 Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 15 Nov 2012 15:14:50 +0530 Subject: [PATCH] clean up imports --- ifa/films/imports.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ifa/films/imports.py b/ifa/films/imports.py index 048c74d..4008ecc 100644 --- a/ifa/films/imports.py +++ b/ifa/films/imports.py @@ -31,20 +31,21 @@ def do(path=path): def import_csv(path=csv_path): lines = csv.reader(open(path)) - try: - year = int(line[1].replace('"', '')[0:4]) - year_error = False - except: - year = None - year_error = True for line in lines: + try: + year = int(line[1].replace('"', '')[0:4]) + year_error = False + except: + year = None + year_error = True + d = { - 'title': line[0], + 'title': line[0].strip(), 'year': year, - 'director': line[2], - 'producer': line[3], - 'language': line[4], + 'director': line[2].replace('"', ''), + 'producer': line[3].replace('"', '').strip(), + 'language': line[4].replace('"', '').strip(), 'year_error': year_error } f = Film(**d)