def GET(self, id): i = web.input(context='all', start=0, order=default_order, desc='desc', query='') start = int(i.start) user_id = session.is_logged() and session.get_user_id() results, num_results = applicants.query(query=i.query, context=i.context, offset=start and start - 1, limit=results_per_page+2, order=i.order + ' ' + i.desc, user_id=user_id) pager = web.storage(paging.get_paging_results(start, num_results, int(id), results, results_per_page)) counts = applicants.get_counts() user = session.get_session() applicant = applicants.get_by_id(id) _comments = comments.get_comments(applicant.id) _votes = votes.get_votes(applicant.id) stats = applicants.get_stats() return view.layout( view.applicant(applicant, _comments, _votes, user, pager, i), user, i.context, counts, i.query, stats)
def render_settings(nickname_form=nickname_form(), email_form=email_form(), password_form=password_form(), on_success_message=''): counts = applicants.get_counts() user = session.get_session() return view.layout( view.settings(user, nickname_form, email_form, password_form, on_success_message), user, 'settings', counts)
def GET(self, id): i = web.input(context='all', start=0, order=default_order, desc='desc', query='') start = int(i.start) user_id = session.is_logged() and session.get_user_id() results, num_results = applicants.query(query=i.query, context=i.context, offset=start and start - 1, limit=results_per_page + 2, order=i.order + ' ' + i.desc, user_id=user_id) pager = web.storage( paging.get_paging_results(start, num_results, int(id), results, results_per_page)) counts = applicants.get_counts() user = session.get_session() applicant = applicants.get_by_id(id) _comments = comments.get_comments(applicant.id) _votes = votes.get_votes(applicant.id) stats = applicants.get_stats() return view.layout( view.applicant(applicant, _comments, _votes, user, pager, i), user, i.context, counts, i.query, stats)
def GET(self, context): i = web.input(start=0, order=default_order, desc='desc', query='') start = int(i.start) context = context or 'all' user_id = session.is_logged() and session.get_user_id() results, num_results = applicants.query(query=i.query, context=context, offset=start, limit=results_per_page, order=i.order + ' ' + i.desc, user_id=user_id) pager = web.storage( paging.get_paging(start, num_results, results_per_page=results_per_page, window_size=1)) counts = applicants.get_counts() user = session.get_session() stats = applicants.get_stats() return view.layout(view.applicants(results, context, pager, i), user, context, counts, i.query, stats)
def GET(self): i = web.input(category='') if not categories.is_valid_category(i.category): return web.seeother('/') question = questions.get_random_question(i.category) category, category_name = i.category, categories.get_category_name( i.category) return view.layout(view.question(question, score.get_score(), category, category_name), title='Wikitrivia - ' + category_name)
def GET(self): i = web.input(q='', s=0, usa=False) if not i.q: raise web.seeother('/') place_query, center_hits, nearby_hits = places.get_nearby(i.q, usa_only=i.usa, offset=int(i.s), limit=MAX_NEARBY_RESULTS) pager = paging.get_paging(int(i.s), nearby_hits['total'], results_per_page=MAX_NEARBY_RESULTS, window_size=WINDOW_SIZE) recent_queries = places.get_recent_queries() return view.layout(view.search(place_query, center_hits, nearby_hits, pager, recent_queries))
def POST(self): i = web.input(category='', answer='', guess='', wiki_url='', score=0) success = questions.is_correct_guess(i.guess, i.answer) cscore = i.score if success: cscore = score.update_score(cscore) category_name = categories.get_category_name(i.category) return view.layout(view.score(cscore, i, success, pub_id=lib.get_pub_id()), title='Wikitrivia - ' + category_name)
def GET(self): i = web.input(q='', s=0, usa=False) if not i.q: raise web.seeother('/') place_query, center_hits, nearby_hits = places.get_nearby( i.q, usa_only=i.usa, offset=int(i.s), limit=MAX_NEARBY_RESULTS) pager = paging.get_paging(int(i.s), nearby_hits['total'], results_per_page=MAX_NEARBY_RESULTS, window_size=WINDOW_SIZE) recent_queries = places.get_recent_queries() return view.layout( view.search(place_query, center_hits, nearby_hits, pager, recent_queries))
def GET(self, context): i = web.input(start=0, order=default_order, desc='desc', query='') start = int(i.start) context = context or 'all' user_id = session.is_logged() and session.get_user_id() results, num_results = applicants.query(query=i.query, context=context, offset=start, limit=results_per_page, order=i.order + ' ' + i.desc, user_id=user_id) pager = web.storage(paging.get_paging(start, num_results, results_per_page=results_per_page, window_size=1)) counts = applicants.get_counts() user = session.get_session() stats = applicants.get_stats() return view.layout( view.applicants(results, context, pager, i), user, context, counts, i.query, stats)
def layout(page, title, **args): title = ('Compiler at KBTU', 'Compiler - '+title)[len(title)>0] user = session.user() return view.layout(page, user=user, title=title, **args)
def layout(page, **kwargs): popular = modules.get_popular() _random = modules.get_random() latest_comments = comments.get_latest() by = random.sample(['Ksikes', 'Lenssen'], 2) return view.layout(page, popular, _random, latest_comments, by, **kwargs)
def layout(page, **kwargs): popular= [] _random = functions.getRandom() by = 'Gonzalo Cobos' return view.layout(page, popular, _random, by, **kwargs)
def GET(self): score.reset_score() return view.layout(view.front_page(categories.get_categories()))
def GET(self): i = web.input(q='') return view.layout(view.index(i.q))