Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
175 ashish 1
'''
2
Created on 17-May-2010
3
 
4
@author: gaurav
5
'''
6
from datastore.DataAccessor import DataHelper
7
import sys
8
 
9
'''
10
Get all the univercell phones first.
11
Postprocess the phones and brake the phone name column into multiples on spaces
12
'''
13
 
14
 
15
phones = DataHelper()
16
 
17
phones = phones.get_all_univercell_phones()
18
 
19
if not phones:
20
    print "Error while getting phones"
21
    sys.exit(-1)
22
 
23
file_to_write = "/tmp/univercell.csv"
24
 
25
data_file = open(file_to_write,"w")
26
 
27
for phone in phones:
28
    #phone = infibeam_data()
29
    unparsed_name = phone.p_title
30
    vendor_name, phone_space, phone_name = unparsed_name.partition(" ") 
31
    csv_data =  "%s, %s, %d, %d" %(vendor_name, phone_name, phone.p_shown_price, phone.p_final_price)
32
    data_file.write(csv_data)
33
    data_file.write("\n")
34
 
35
data_file.close()
36