def get(self): puzzles = Puzzle.gql("ORDER BY name ASC") pieces = self.get_pieces() locations = Location.gql("ORDER BY x ASC") svg_path = os.path.join(os.path.dirname(__file__), 'templates/puzzle.svg') svg_values = { "pieces": pieces, "locations": locations, "width": 641, "height": 481 } svg_text = template.render(svg_path, svg_values) try: first_puzzle = puzzles[0] except IndexError: first_puzzle = "None" template_values = { "title": "HTML5 Hacks: SVG", "puzzles": puzzles, "first_puzzle": first_puzzle, "host": os.environ["HTTP_HOST"], "config": config, "svg_text": svg_text, "is_dev": IS_DEV, "rows": ["A", "B", "C", "D", "E", "F", "G", "H"], "cols": ["1", "2", "3", "4", "5", "6", "7", "8"], } path = os.path.join(os.path.dirname(__file__), 'templates/svg.html') self.response.out.write(template.render(path, template_values))