Beispiel #1
0
def tryfloat(val):
    try:
        return float(val)
    except:
        return float(0)


for inx, row in enumerate(csvreader):

    row = map(lambda x: x.decode('utf-8'), row)

    prop = Property()

    prop.headline = ''  # db.StringProperty() #no
    prop.main_description = row[cnames.index(
        "PROP_DescripcionGeneral")] + ' ' + row[
            cnames.index("PROP_DireccionOtros"
                         )]  # db.StringProperty() #prop_descripciongeneral

    #print type(row[cnames.index("PROP_PROV_Id")])

    prop.country = u'Argentina'  # Argentina
    prop.state = row[cnames.index("PROP_PROV_Id")]  # PRop_prov_id
    prop.city = row[cnames.index("PROP_LOCAL_Id")]  # prov local id
    prop.neighborhood = row[cnames.index("PROP_barrio")]
    prop.street_name = row[cnames.index("PROP_Calle")]
    prop.street_number = int(tryint(row[cnames.index("PROP_Nro")]))
    prop.zip_code = ''  # db.IntegerProperty()

    prop.floor = row[cnames.index("PROP_PisoDpto")]  # db.IntegerProperty()
    prop.building_floors = int(
        row[cnames.index("PROP_Plantas")])  # db.IntegerProperty() #no
Beispiel #2
0
dx = float(-58499794 - -58357315)/1000000.0
dx = float(dx/float(gridx))

# Arreglo que contiene los tipos de currency.
currencies = ['USD','ARS']

# Arreglo donde guardo los objetod PropertyIndex correspondiente a cada instancia de Property.
property_indexes = []


for i in range(gridx): 
  for j in range(gridy): 
    prop = Property()
    
    prop.headline                = '' # db.StringProperty()
    prop.main_description        = '_main_description_' # db.StringProperty()
    
    prop.country                 = 'Argentina'
    prop.state                   = 'CABA'
    prop.city                    = 'Buenos Aires'
    prop.neighborhood            = 'Barrio %s' % str(seed) 
    prop.street_name             = 'Calle ' + str(seed)
    prop.street_number           = seed
    prop.zip_code                = str(int(random.randint(1000, 9999))) # db.IntegerProperty()
    
    prop.floor                   = str(random.randint(0, 20)) # db.IntegerProperty()
    prop.building_floors	       = random.randint(0, int(prop.floor)) # db.IntegerProperty()
      
    prop.images_count            = 0
      
    #prop.user                    = '' # db.ReferenceProperty(User)