Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

'''
Created on 17-May-2010

@author: gaurav
'''
from datastore.DataAccessor import DataHelper
import sys

'''
Get all the infibeam phones first.
Postprocess the phones and brake the phone name column into multiples on spaces
'''


phones = DataHelper()

phones = phones.get_all_infibeam_phones()

if not phones:
    print "Error while getting phones"
    sys.exit(-1)

file_to_write = "/tmp/infibeam.csv"

data_file = open(file_to_write,"w")

for phone in phones:
    #phone = infibeam_data()
    unparsed_name = phone.name
    vendor_name, phone_space, phone_name = unparsed_name.partition(" ") 
    csv_data =  "%s, %s, %d, %d" %(vendor_name, phone_name, phone.shown_price, phone.final_price)
    data_file.write(csv_data)
    data_file.write("\n")
    
data_file.close()