def renderman_render(config,returnfh = False): config = config.to_dict() params_list = [{}] param = params_list[0] if 'bg_id' in config: param['bg_id'] = config.pop('bg_id') if 'bg_phi' in config: param['bg_phi'] = config.pop('bg_phi') if 'bg_psi' in config: param['bg_phi'] = config.pop('bg_psi') if 'kenv' in config: param['kenv'] = config.pop('kenv') if 'res' in config: param['res_x'] = param['res_y'] = config['res'] use_canonical = config.pop('use_canonical',False) if use_canonical: v = get_canonical_view(config['model_id']) if v: config['rotations'] = [{'rxy':v['rxy'],'rxz':v['rxz'],'ryz':v['ryz']}, {'rxy':config.pop('rxy',0),'rxz':config.pop('rxz',0),'ryz':config.pop('ryz',0)}] param['model_params'] = [config] orig_dir = os.getcwd() os.chdir(os.path.join(os.environ['HOME'] , 'render_wd')) tmp = tempfile.mkdtemp() renderer.render(tmp,params_list) imagefile = [os.path.join(tmp,x) for x in os.listdir(tmp) if x.endswith('.tif')][0] os.chdir(orig_dir) fh = open(imagefile) if returnfh: return fh else: return fh.read()
def cou(pose_est, pose_gt, model, im_size, K): """ Complement over Union, i.e. the inverse of the Intersection over Union used in the PASCAL VOC challenge - by Everingham et al. (IJCV 2010). :param pose_est: Estimated pose given by a dictionary: {'R': 3x3 rotation matrix, 't': 3x1 translation vector}. :param pose_gt: The ground truth pose given by a dictionary (as pose_est). :param model: Object model given by a dictionary where item 'pts' is nx3 ndarray with 3D model points. :param im_size: Test image size. :param K: Camera matrix. :return: Error of pose_est w.r.t. pose_gt. """ # Render depth images of the model in the estimated and the ground truth pose d_est = renderer.render(model, im_size, K, pose_est['R'], pose_est['t'], clip_near=100, clip_far=10000, mode='depth') d_gt = renderer.render(model, im_size, K, pose_gt['R'], pose_gt['t'], clip_near=100, clip_far=10000, mode='depth') # Masks of the rendered model and their intersection and union mask_est = d_est > 0 mask_gt = d_gt > 0 inter = np.logical_and(mask_gt, mask_est) union = np.logical_or(mask_gt, mask_est) union_count = float(union.sum()) if union_count > 0: e = 1.0 - inter.sum() / union_count else: e = 1.0 return e
def add(hostname, stats, upstat): 'Update node data accumulator.' # update with newer information if hostname in nodes: for key in stats: nodes[hostname][key] = stats[key] else: nodes[hostname] = stats nodes[hostname]['up']='up' # incorporate info about down nodes/missing monitord installs for hostname in upstat: if hostname in nodes: nodes[hostname]['up'] = upstat[hostname] else: nodes[hostname] = {'up':upstat[hostname]} # track how many updates we've received total for key in stats: if key in updates: updates[key]+=1 else: updates[key]=1 # render renderer.render(nodes, updates) # save data in case server goes down cPickle.dump(nodes, open(CACHE_FILE, 'wb'))
def vsd(pose_est, pose_gt, model, depth_test, delta, tau, K): """ Visible Surface Discrepancy. :param pose_est: Estimated pose given by a dictionary: {'R': 3x3 rotation matrix, 't': 3x1 translation vector}. :param pose_gt: The ground truth pose given by a dictionary (as pose_est). :param model: Object model given by a dictionary where item 'pts' is nx3 ndarray with 3D model points. :param depth_test: Depth image of the test scene. :param delta: Tolerance used for estimation of the visibility masks. :param tau: Misalignment tolerance. :return: Error of pose_est w.r.t. pose_gt. """ im_size = (depth_test.shape[1], depth_test.shape[0]) # Render depth images of the model in the estimated and the ground truth pose depth_est = renderer.render(model, im_size, K, pose_est['R'], pose_est['t'], clip_near=100, clip_far=10000, mode='depth') depth_gt = renderer.render(model, im_size, K, pose_gt['R'], pose_gt['t'], clip_near=100, clip_far=10000, mode='depth') # Convert depth images to distance images dist_test = misc.depth_im_to_dist_im(depth_test, K) dist_gt = misc.depth_im_to_dist_im(depth_gt, K) dist_est = misc.depth_im_to_dist_im(depth_est, K) # Visibility mask of the model in the ground truth pose visib_gt = visibility.estimate_visib_mask_gt(dist_test, dist_gt, delta) # Visibility mask of the model in the estimated pose visib_est = visibility.estimate_visib_mask_est(dist_test, dist_est, visib_gt, delta) # Intersection and union of the visibility masks visib_inter = np.logical_and(visib_gt, visib_est) visib_union = np.logical_or(visib_gt, visib_est) # Pixel-wise matching cost costs = np.abs(dist_gt[visib_inter] - dist_est[visib_inter]) costs *= (1.0 / tau) costs[costs > 1.0] = 1.0 # costs_vis = np.ones(dist_gt.shape) # costs_vis[visib_inter] = costs # import matplotlib.pyplot as plt # plt.matshow(costs_vis) # plt.colorbar() # plt.show() # Visible Surface Discrepancy visib_union_count = visib_union.sum() visib_comp_count = visib_union_count - visib_inter.sum() if visib_union_count > 0: e = (costs.sum() + visib_comp_count) / visib_union_count else: e = 1.0 return e
def main(): points = POINTS stack = [] angles = [0, np.pi * 0.5, np.pi, np.pi * 1.5] axies = ["x", "y", "z"] print render(points, 17)
def results(self): """ Process the scraped triples for the deed. """ def cc0_filter(license_name): return CC0_SELECTOR.has_license(str(license_name)) # look through all license relations to check for dual-licensing licenses = metadata.get_license_uri(self.subject, self.triples) or [] if type(licenses) in (str, unicode): licenses = [licenses] cc0 = (filter(cc0_filter, licenses) or [None])[0] regist = metadata.registration( self.subject, self.triples, self.license_uri) # empty values are represented by None results = { 'waiver': cc0, 'registration': renderer.render('registration.html', regist), 'title': metadata.get_title(self.subject, self.triples), 'norms': metadata.get_norms(self.subject, self.triples), 'curator': metadata.get_publisher(self.subject, self.triples), 'creator': metadata.get_creator(self.subject, self.triples), 'curator_title': '', 'creator_title': '', 'curator_literal': False, 'creator_literal': False, } results['curator_title'] = metadata.get_title(results['curator'], self.triples) or \ metadata.get_name(results['curator'], self.triples) results['creator_title'] = metadata.get_title(results['creator'], self.triples) or \ metadata.get_name(results['creator'], self.triples) if results['curator'] and not \ (urlparse(results['curator']).scheme and \ urlparse(results['curator']).netloc): results['curator_literal'] = True if results['creator'] and not \ (urlparse(results['creator']).scheme and \ urlparse(results['creator']).netloc): results['creator_literal'] = True # escape and strip whitespaces for k,v in results.items(): if type(v) in (str, unicode): results[k] = ' '.join(''.join(cgi.escape(v).split('\\n')).split()) results['marking'] = renderer.render( 'pd_marking.html', dict(results, work=self.subject, mark_uri=self.cclicense.uri, mark_title=self.cclicense.title(self.lang))) return results
def _render_statuses(self): db_data = self.db.get_all_status() if db_data: data = [] print('开始读取{0}的消息列表数据...'.format(self.target_id)) for dt in db_data: data.append(json.loads(dt['data'])) fileOut = os.path.join(self.output, self.target_id) print('开始导出{0}的消息列表为Html/Markdown/Txt...'.format(self.target_id)) renderer.render(data, fileOut) print('已导出文件', fileOut + '.html|.md|.txt')
def render(cloth, clothFile): layers.showOnlyLayer(0) layers.showLayersOfObject(cloth, True) bodyMasks.hideAllObjects(True) bodyMasks.hideObject("Gracz", False) bodyMasks.hideObject(cloth, False) bodyMasks.makePlayerMasked(True) renderer.render(cloth) bodyMasks.makePlayerMasked(False) renderer.merge(clothFile)
def _render_statuses(self): db_data = self.db.get_all_status() if db_data: data = [] print('开始读取{0}的消息列表数据...'.format(self.target_id)) for dt in db_data: data.append(json.loads(dt['data'])) fileOut = os.path.join( self.output, self.target_id) print('开始导出{0}的消息列表为Html/Markdown/Txt...'.format(self.target_id)) renderer.render(data, fileOut) print('已导出文件', fileOut+'.html|.md|.txt')
def generate_single_image(config,outdir): orig_dir = os.getcwd() os.chdir(os.path.join(os.environ['HOME'] , 'render_wd')) tmp = tempfile.mkdtemp() renderer.render(tmp,[config]) imagefile = [os.path.join(tmp,x) for x in os.listdir(tmp) if x.endswith('.tif')][0] os.chdir(orig_dir) image_string = open(imagefile).read() outfile = os.path.join(outdir,config['model_params'][0]['model_id'] + '.tif') F = open(outfile,'w') F.write(image_string) F.close()
def build_schema_file(schema, properties): _vars = [] for _property in properties: _type = properties[_property]['type'] java_type = _openapi_type_to_java(_type) entry = {"java_type": java_type, "property_name": _property} _vars.append(entry) renderer.render(schema, schema_imports(), _vars)
def realizer(fileName): outputFile = fileName + ".json" realizerLPName = fileName + "Sketch.lp" realOutJSON = fileName + "Real.json" buildLP(outputFile, realizerLPName) print "Start Realizer Clingo call" subprocess.call("clingo Realizer.lp slopeRealizer.lp RealizerGlue.lp " + realizerLPName + " --opt-strategy=usc,0 --parallel-mode=4 --outf=2 > " + realOutJSON + " & exit 0", shell=True) print "Clingo finished" parseList = parse(realOutJSON) renderer.render(parseList, fileName)
def POST(self): you = require_you() params = web.input(name='') unique = True name = params['name'] if name and name != you.get('name',None): slug = slugify(name) for row in dbview.users(db, startkey=slug, endkey=slug): if slug == row.key: unique = False break if unique: you['name'] = name you['slug'] = slug elif not name and 'name' in you: # blanking your name makes you anonymous, and makes your page inaccessible del you['name'] del you['slug'] db[you.id] = you if unique: web.redirect('/') else: return render('settings', errors="Sorry, that name's taken!", you=you)
def default(self, *args, **kwargs): req = cherrypy.request resp = cherrypy.response print args print status = 200 try: if req.method == 'GET': obj = self.__st.get(args) if req.method == 'POST': obj = self.__st.post(args) status = 201 if req.method == 'PUT': obj = self.__st.put(args) if req.method == 'DELETE': self.__st.delete(args) obj = None status = 204 except fmwk.HTTPException as e: # TODO: return a body describing the error too raise cherrypy.HTTPError(e.httpCode) except KeyError: raise cherrypy.HTTPError(404) except NotImplementedError: # To play safe raise cherrypy.HTTPError(405) resp.headers['Content-Type'] = 'application/json' resp.status = status if obj is not None: body = renderer.render(obj) ret = json.dumps(body) else: ret = '' return ret
def statistik_func(): try: from database import Campaign, DataSet, get_campaign_and_data from plotting import alldata, operating_hours, statistics from renderer import render req_pth = os.path.join(os.path.expanduser("~"), "statistik.html") #req_pth = os.path.join("/tmp", "statistik.html") if os.path.isfile(req_pth): #return app.send_static_file(req_pth) with open(req_pth, 'r') as fle: return fle.read() ca, ds_s = get_campaign_and_data( se, "Ventilation i faelleskoekkenet 2017") js_resources, css_resources, plot_script, plot_divs = statistics(ds_s) page_title = ca.name page_header = ca.name page_text = "Desc" html = render(page_title, page_header, page_text, js_resources, css_resources, plot_script, plot_divs) import io with io.open(req_pth, mode='w', encoding='utf-8') as f: f.write(html) return html except Exception as e: return str(e)
def play_game(agent, render=False): game_board = Board() reward = 0 while True: _, a_play = agent.get_action(game_board.as_state(), learning=True, printing=False) game_end, r = game_board.make_move(*a_play) reward += r if render: print(a_play) renderer.render(game_board) if game_end: if render: print("Total game reward:", reward) return reward
def on_get(self, req, resp): resp.status = falcon.HTTP_200 headers.html(resp) resp.body = renderer.render("settings.html", {})
def contact_handler(request, conn, match=True): template = "contacts.html" content = render(template) resp = """\ HTTP/1.1 200 OK {0} """.format(content) send_response(resp, conn, match)
def about_handler(request, conn, match=True, method=None): template = 'about.html' content = render(template) resp = """\ HTTP/1.1 200 OK {} """.format(content) send_response(resp, conn, match)
def translit_handler(request, conn, match=True, data={}): template = "translit.html" abc = render(template) resp = """\ HTTP/1.1 200 OK {0} """.format(abc) send_response(resp, conn, match)
def about_handler(request, conn, match=True, data={}): template = "about.html" abc = render(template) resp = """\ HTTP/1.1 200 OK {0} """.format(abc) # write_to_db(match,data) send_response(resp, conn, match)
def translate_handler(request, conn, match=True, data={}): template = "translate.html" cont = render(template) resp = """\ HTTP/1.1 200 OK {0} """.format(cont) # write_to_db(match, data) send_response(resp, conn, match)
def about_handler(request, conn, match=True, data={}): template = "about.html" abc = render(template, {'this_is_variable': 'Бул өзгөрмөнүн ордуна барат'}) resp = """\ HTTP/1.1 200 OK {0} """.format(abc) send_response(resp, conn, match)
def main(template, data={}, **kwargs): with open(template, 'r') as template_file: if data != {}: data_file = open(data, 'r') data = json.load(data_file) data_file.close() args = {'template': template_file, 'data': data} args.update(kwargs) return render(**args)
def on_get(self, req, resp): current_user = users.get_current_user if current_user: raise falcon.redirects.HTTPFound('/home') resp.status = falcon.HTTP_200 headers.html(resp) resp.body = renderer.render("index.html", {})
def main(template, data={}, **kwargs): with io.open(template, 'r', encoding='utf-8') as template_file: if data != {}: data_file = io.open(data, 'r', encoding='utf-8') data = yaml.load(data_file, Loader=yaml.SafeLoader) data_file.close() args = {'template': template_file, 'data': data} args.update(kwargs) return render(**args)
def contact_handler(request, conn, match=True, data={}): template = "contacts.html" content = render(template) resp = """\ HTTP/1.1 200 OK {0} """.format(content) write_to_db(match, data) # translit(data,) send_response(resp, conn, match)
def main(template, data={}, **kwargs): with io.open(template, 'r', encoding='utf-8') as template_file: if data != {}: data_file = io.open(data, 'r', encoding='utf-8') data = json.load(data_file) data_file.close() data['DOT_KEY'] = DOT_KEY args = {'template': template_file, 'data': data} args.update(kwargs) return render(**args)
def main(template, data=None, **kwargs): with io.open(template, 'r', encoding='utf-8') as template_file: if data is not None: with io.open(data, 'r', encoding='utf-8') as data_file: data = json.load(data_file) else: data = {} args = {'template': template_file, 'data': data} args.update(kwargs) return render(**args)
def on_get(self, req, resp, collection_id): resp.status = falcon.HTTP_200 headers.html(resp) current_user = users.get_current_user() template_data = { 'collection': repositories.collections.read(current_user, collection_id) } resp.body = renderer.render("collections/view.html", template_data)
def on_get(self, request, response): user = users.get_current_user() collections = [repositories.collections.to_map(c) for c in repositories.collections.all_collections(user, sort=True)] template_data = { "collections" : collections, } headers.html(response) response.status = falcon.HTTP_200 response.body = renderer.render("collections/list.html", template_data)
def aws_func(event, context): events = [Event(data) for data in get_latest_events_raw()] events = filter(lambda e: e.is_active(), events) events = events[::-1] if len(events) > 0: main_event = events.pop(0) main_event.fetch_full_picture() else: main_event = None html = render('event.html', main_event=main_event, rest_events=events) return {'html': html}
def render(self, R, t): ren, canvas = renderer.render(self.model, (960, 720), self.K, R, t,surf_color=(1,1,1,1), bg_color=(0, 0, 0, 0), mode='rgb+depth') self.canvas = canvas ren_rgb, ren_depth = ren yz_flip = np.eye(4, dtype=np.float32) yz_flip[1, 1], yz_flip[2, 2] = -1, -1 mat_world2camera = np.dot(yz_flip, canvas.mat_view.T) mat_camera2world = np.linalg.inv(mat_world2camera) mat_rotation = mat_world2camera[:3, :3] vec_translation = mat_world2camera[:3, 3].reshape([3, 1]) return ren_rgb, ren_depth, mat_rotation, vec_translation
def main(template, data={}, **kwargs): with io.open(template, 'r', encoding='utf-8') as template_file: if data != {}: data_file = io.open(data, 'r', encoding='utf-8') data = json.load(data_file) data_file.close() args = { 'template': template_file, 'data': data } args.update(kwargs) return render(**args)
def _serve_request(self, resource, start_response, query): output_format = query.get('format', [self.DEFAULT_OUTPUT_FORMAT])[0] renderer = self.RENDERERS[output_format] nb = self.nbreader.reads(open(resource).read()) status = "200 OK" response = renderer.render(nb) headers = [("Content-Type", self.CONTENT_TYPE[output_format]), ("Content-Length", str(len(response)))] start_response(status, headers) return [response]
def main(template, data=None, **kwargs): with io.open(template, "r", encoding="utf-8") as template_file: yaml_loader = kwargs.pop("yaml_loader", None) or "SafeLoader" if data is not None: with io.open(data, "r", encoding="utf-8") as data_file: data = _load_data(data_file, yaml_loader) else: data = {} args = {"template": template_file, "data": data} args.update(kwargs) return render(**args)
def results(self): """ Interprets the scraped data for its significance to a deed """ # returns dictionaries with values to CCREL triples attrib = metadata.attribution(self.subject, self.triples) regist = metadata.registration(self.subject, self.triples, self.license_uri) mPerms = metadata.more_permissions(self.subject, self.triples) # check if a dc:title exists, if there is a title, it will replace # any place where "this work" would normally appear in the deed popups title = metadata.get_title(self.subject, self.triples) results = { 'attribution': { 'details': renderer.render( 'attribution_details.html', { 'subject': self.subject, 'license': self.cclicense, 'title':title, 'attributionName': attrib['attributionName'], 'attributionURL': attrib['attributionURL'], }), 'marking': renderer.render( 'attribution_marking.html', { 'subject': self.subject, 'license': self.cclicense, 'title': title, 'attributionName': attrib['attributionName'], 'attributionURL': attrib['attributionURL'], }), }, 'registration': renderer.render('registration.html', regist), 'more_permissions': renderer.render('more_permissions.html', dict(subject=self.subject, **mPerms)), } return results
def on_get(self, request, response): user = users.get_current_user() collections = [ repositories.collections.to_map(c) for c in repositories.collections.all_collections(user, sort=True) ] template_data = { "collections": collections, } headers.html(response) response.status = falcon.HTTP_200 response.body = renderer.render("collections/list.html", template_data)
def main(template, data=None, **kwargs): with io.open(template, 'r', encoding='utf-8') as template_file: yaml_loader = kwargs.pop('yaml_loader', None) or 'SafeLoader' if data is not None: with io.open(data, 'r', encoding='utf-8') as data_file: data = _load_data(data_file, yaml_loader) else: data = {} args = { 'template': template_file, 'data': data } args.update(kwargs) return render(**args)
def main_view(env, method): template = 'index.html' if method == "POST": try: request_body_size = int(env.get('CONTENT_LENGTH', 0)) except (ValueError): request_body_size = 0 request_body = env['wsgi.input'].read(request_body_size) data = parse_qs(request_body) link = data[b'link'][0].decode() email = data[b'email'][0].decode() create_query(link, email) send_link_mail.delay(email, link) response = render(template).encode('utf-8') return response
def on_get(self, req, response, public_id): collection = repositories.collections.read_public_collection(public_id) if collection == None or not collection.public: headers.text(response) response.status = falcon.HTTP_404 response.body = "Unknown collection" return template_data = { 'collection': collection, } headers.html(response) response.status = falcon.HTTP_200 response.body = renderer.render("collections/public/view.html", template_data)
def on_get(self, request, response, collection_id, link_index): link_idx = int(link_index) response.status = falcon.HTTP_200 headers.html(response) current_user = users.get_current_user() collection = repositories.collections.read(current_user, collection_id) link = collection.links[link_idx] template_data = { 'collection': collection, 'link': link, 'link_index': link_idx, } response.body = renderer.render("collections/links/view.html", template_data)
return tuple(int(i*100) for i in hsv_to_rgb(h, 0.8, 1)) @progress(iterations=MAX_X * MAX_Y) def basic_mandelbrot(x, y): """ Calculate and return the RGB colour for a given (x, y) pixel. :param x: The X coordinate of the pixel. :param y: The Y coordinate of the pixel. :return: A tuple (R,G,B) of values 0-255. """ # Scale X and Y to the viewport bounded by (X1, Y1) and (X2, Y2). x = scaled(x, 0, MAX_Y, X1, X2) y = scaled(y, 0, MAX_Y, Y1, Y2) # Count the number of iterations to escape an arbitrary "bound". i = count_its(x, y, MAX_ITERATION) # Return a color based on this escape time. if i == MAX_ITERATION: return 0, 0, 0 return color(i) if __name__ == "__main__": from renderer import render filename = "mandelbrot.png" if "-o" in sys.argv: filename = sys.argv[-1] render(basic_mandelbrot, filename)
def GET(self): return render("settings", you=require_you())
def render(self): renderer.render() pygame.display.update()
import boto import renderer # would be nice if the following stuff were encapsulated in the library # e.g. ls_models + ls_backgrounds conn = boto.connect_s3() bbucket = conn.get_bucket('dicarlocox-backgrounds') cache_bucket = conn.get_bucket('dicarlocox-3dmodels-renderedimages') model_bucket = conn.get_bucket('dicarlocox-3dmodels-v1') bg_list = [x.name for x in bbucket.list()] model_list = [x.name for x in model_bucket.list()] model_id_list = [ x.rstrip('.tar.gz') for x in model_list] # this is where the 'real' stuff starts models = [] models.append( { 'bg_id' : bg_list[0], 'model_params' : [ {'model_id' : model_id_list[0]} ] }) print(models) renderer.render('/tmp', models)
def mainloop (): global items, gameover, clock, digplace global blocked, playerheads digit = 1 clock = pygame.time.Clock() blocked = set(board.obstacles) # playerbodies = [] for player in players: player.start () # TODO: Trow more items on the board! digplace = place(str(digit)) gameover = False playerheads = [] while 1: clock.tick(10) # Render the screen renderer.render() for event in pygame.event.get(): if event.type == pygame.QUIT: return if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: return for player in players: player.usekey (event.key) if gameover: continue for player in players: if player.dev == "ai" and player.playing: player.aimove() elif player.dev == "net": if player.playing: network.getkey (player) network.sendinfo (player, players, items) for player in players: if player.playing and player.dead == 0: blocked.add(player.gethead()) playerheads = [] dead = set() for player in players: if not player.playing: continue head = player.go() if head != None: playerheads.append(head) # Use this to detect head-to-head # Check if hit the wall or ther players if head in blocked: dead.add(player) if nlpr: for other in players: if other != player: if head in other.body: other.grow (len(player.body)) other.score += len(player.body) # Check if hit any items elif items.has_key(head) : # TODO: Assumed items are only numbers del items[head] player.score += 10 * digit #player.grow(digit * 4) player.grow(digit * 10) digit += 1 if digit < 10 or not numbersend: if digit == 10: digit = random.randint(1,6) digplace = place (str(digit)) else: gameover = True # Detect head-to-head for player1 in players: if player1.playing and playerheads.count(player1.gethead()) > 1: dead.add(player1) # Now see who is dead for player in list(dead): if player.die(): if not cont: gameover = True if remplayers == 0: gameover = True if dead: if digit > 5: digit -= 4 else: digit = 1 items[digplace]["type"] = str(digit) # keep track of player bodies as obstacles as well #playerbodies = reduce(operator.add, (player.body[:] for player in players)) # Check for timer exppirations for loc in items.keys() : item = items[loc] item["timer"] -= 1 if item["timer"] == 0 : type = item["type"] del items[loc] if type in otheritemtypes : place (random.choice(otheritemtypes)) else: # It is number, put the same number somewhere else on the board digplace = place (type)
def do_render(possible): img = render(possible) filename = '{}.png'.format(determine_hash(possible)) img.save(join('possibles', filename))
def render(self,params_list): renderer.render(self.temp_dir,params_list,callback=self.callback)
def get(self): restaurants_query = Restaurant.all().order('-date') template_values = { 'restaurants': restaurants_query } renderer.render(self, 'index.html', template_values)
def form(name): form_db = config.db.get_db('') form_description = form_db['forms'][name] return renderer.render(name, form_description)