Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

'''
Created on 18-May-2010

@author: gaurav
'''

from datastore.DataAccessor import DataHelper
import sys

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


phones = DataHelper()

phones = phones.get_all_indiaplaza_phones()

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

file_to_write = "/tmp/indiaplaza.csv"

data_file = open(file_to_write,"w")

for phone in phones:
    #phone = infibeam_data()
    unparsed_name = phone.p_name
    vendor_name, phone_space, phone_name = unparsed_name.partition(" ") 
    csv_data =  "%s, %s, %d, %d, %s, %s" %(vendor_name, phone_name, phone.p_shown_price, phone.p_final_price, phone.p_guaranteeinfo, phone.p_shipinfo)
    data_file.write(csv_data)
    data_file.write("\n")
    
data_file.close()