示例#1
0
 def get(self):
     buildings = Building.query().fetch()
     # print buildings
     buildings_template = jinja_env.get_template('templates/index.html')
     self.response.write(buildings_template.render({
         'buildings': buildings
     }))
示例#2
0
 def get(self):
     # print 'hello world'
     building_street_number = self.request.get('building')
     building = Building.query(Building.street_number == int(building_street_number)).get()
     floors = []
     for floor in building.floors:
         floors.append(floor.get())
     #  '/directions?building=%s&floor=%s'%(floor['building'], floor['name'])
     floors_template = jinja_env.get_template('templates/floors.html')
     self.response.write(floors_template.render({
         'building': building,
         'floors': floors
     }))
示例#3
0
    def get(self):
        # print , 'aoisdnaisndiasndi'
        building_street_number = self.request.get('building')
        floor_name = self.request.get('floor')
        building = Building.query(
            Building.street_number == int(building_street_number)).get()
        floor = {}
        bins = []
        hotspots = []
        for _floor in building.floors:
            _floor = _floor.get()
            if _floor.name == floor_name:
                floor = _floor

        if floor.bins != None:
            for _bin in floor.bins:
                _bin = _bin.get().to_dict()
                directions = []
                for direction in _bin['directions']:
                    _direction = direction.get()
                    directions.append(_direction)
                _bin['directions'] = directions
                bins.append(_bin)

        if floor.hotspots != None:
            for hotspot in floor.hotspots:
                hotspots.append(hotspot.get())

        direction_template = jinja_env.get_template('templates/direction.html')
        self.response.write(
            direction_template.render({
                'building': building,
                'floor': floor,
                'bins': bins,
                'hotspots': hotspots,
                'http_host': os.environ['HTTP_HOST']
            }))