Exemplo n.º 1
0
 def import_model_range(self, csv):
     lines = csv.split('\n')
     imported = 0
     for line in lines:
         if len(line.strip()) == 0:
             print 'Skipping line', line
             continue
         model_range = ModelRange()
         fields = line.strip().split(';')
         model_range.name = fields[0]
         model_range.year_start = int(fields[1])
         model_range.year_end = int(fields[2])
         model_range.put()
         imported = imported + 1
     print imported, 'ranges imported'
Exemplo n.º 2
0
 def import_model_range(self, csv):
     lines = csv.split('\n')
     imported = 0
     for line in lines:
         if len(line.strip()) == 0:
             print 'Skipping line',line
             continue
         model_range = ModelRange()
         fields = line.strip().split(';')
         model_range.name = fields[0]
         model_range.year_start = int(fields[1])
         model_range.year_end = int(fields[2])
         model_range.put()
         imported = imported+1
     print imported,'ranges imported'
Exemplo n.º 3
0
def task_model_restore(items):
    model_count = 0
    for item in items:
        mrange = ModelRange()
        mrange.name = item['name']
        mrange.year_start = item['yearStart']
        mrange.year_end = item['yearEnd']
        mrange.notes = item['notes']
        mrange.put()
        for model in item['carModels']:
            carmodel = CarModel(key_name=model['modelId'])
            carmodel.name = model['name']
            carmodel.engine_code = model['engineCode']
            carmodel.typeno = model['typeNo']
            if model['imageUrl'] != None:
                carmodel.imageUrl = db.Link(model['imageUrl'])
            carmodel.year_from = model['yearFrom']
            carmodel.year_to = model['yearTo']
            carmodel.notes = model['notes']
            carmodel.model_range = mrange
            carmodel.put()
            model_count = model_count + 1
Exemplo n.º 4
0
def task_model_restore(items):
    model_count = 0
    for item in items:
        mrange = ModelRange()
        mrange.name = item['name']
        mrange.year_start = item['yearStart']
        mrange.year_end = item['yearEnd']
        mrange.notes = item['notes']
        mrange.put()
        for model in item['carModels']:
            carmodel = CarModel(key_name=model['modelId'])
            carmodel.name = model['name']
            carmodel.engine_code = model['engineCode']
            carmodel.typeno = model['typeNo']
            if model['imageUrl'] != None:
                carmodel.imageUrl = db.Link(model['imageUrl'])
            carmodel.year_from = model['yearFrom']
            carmodel.year_to = model['yearTo']
            carmodel.notes = model['notes']
            carmodel.model_range = mrange
            carmodel.put()
            model_count = model_count + 1