Exemple #1
0
def get_place(request, name_param, coord_param):
    name = request.get(name_param, '')
    if name != '':
        places = place.get(name)
        if len(places) > 0:
            return [places[0], maps.GeoPoint(places[0].latitude, places[0].longitude)]
        
    coord = request.get(coord_param, '').replace('-', ',')
    if coord != '':
        return [name if name != '' else coord, maps.GeoPoint(*[float(x) for x in coord.split(',')])]
Exemple #2
0
def do_place(request, response):
    # get request parameters        
    view_mode = request.get('out', 'html')
    term = request.get('term', '')
    
    # produce data        
    data = place.get(term)
    
    # populate the requested view
    if view_mode == 'json':
        view.to_json(data, response)
    else:
        view.to_html(data, 'hotel', request, response)
Exemple #3
0
def do_hotel(request, response, name):
    hotel = place.get(name)[0]
    ratings = rater.get(hotel)
    data = { 'hotel': hotel, 'ratings': ratings }
    view.to_html(data, 'hotel', request, response)