Exemple #1
0
    def get(self):
        stations = memcache.get("stations")

        if stations is None:
            logging.info("- rebuild liste des stations")
            stations = StationData.all()
            stations_light = []
            for station in stations:
                stations_light.append({'id_vlille': station.id_vlille, 'name': station.name})

            memcache.set("stations", stations_light, time=TIMEOUT_LONG)

        return self._template({'stations': stations}, "index_stations.html")
Exemple #2
0
    def get(self):
        vlillef = Vlille()
        vlillef.load_stations()

        stations = []
        for station in vlillef.stations:
            stations.append(StationData(key_name=str(station.id),
                                        id_vlille=station.id,
                                        name=station.name))

        db.delete(StationData.all())
        db.put(stations)

        self.response.out.write("stations : %i" % len(vlillef.stations))