예제 #1
0
 def _add_urls_to_results(search):
     gets = list()
     length = len(search['results'])
     for i in xrange(length):
         gets.append(Place.all().filter('google_places_id =', search['results'][i]['id']).run())    
     for i in xrange(length):
         place = gets[i]
         try:
             place = place.next()
             search['results'][i].update({'_url': place.get_absolute_url()})
         except StopIteration:
             # no existe, devolvemos una url 'generica'
             search['results'][i].update({'_url': '/place/gref/%s' % search['results'][i]['reference']})
     return search
예제 #2
0
 def _add_urls_to_results(search):
     gets = list()
     length = len(search['results'])
     for i in xrange(length):
         gets.append(Place.all().filter('google_places_id =',
                                        search['results'][i]['id']).run())
     for i in xrange(length):
         place = gets[i]
         try:
             place = place.next()
             search['results'][i].update({'_url': place.get_absolute_url()})
         except StopIteration:
             # no existe, devolvemos una url 'generica'
             search['results'][i].update({
                 '_url':
                 '/place/gref/%s' % search['results'][i]['reference']
             })
     return search