def handle_exception(self, exception, debug): base_params = dict(authdetails = utils.authdetails(), creator = self.creator) if not debug: try: raise exception except PostingError, e: base_params.update(dict(message = e.message)) except Exception: pass
def get(self, boragle_slug): boragle = Boragle.find_by_slug(boragle_slug) avatar = Avatar.find_or_create(boragle=boragle, creator=self.creator) if self.creator else None start = self.read('start') or None questions = boragle.get_latest_questions(count = settings.question_page_size + 1, start = start) next = questions.pop().sort_date if len(questions) == settings.question_page_size + 1 else None self.render_template('boragle', dict(boragle=boragle, questions = questions, authdetails = utils.authdetails(boragle.url), creator = avatar, next = next))
def get(self, city_url, venue_url): redirect_url = None city = City.get_by_url(city_url) if city: venue = city.get_venue_by_url(venue_url) else: redirect_url = '/' if not venue: redirect_url = '/' + city_url if not redirect_url: performances = venue.get_performances().fetch(50) self.render('public/venue.html', dict(venue=venue, performances=performances, auth = utils.authdetails(venue.get_route()))) else: self.redirect(redirect_url,False)
def get(self, boragle_slug, question_slug): question = Question.find_by_slug(question_slug) assert question paginator = utils.Paginator(current_page = int(self.read('page') or 1), page_size = settings.answer_page_size, item_count = question.answer_count, getter = question.get_answers_by_votes) avatar = self.get_avatar_for_boragle(question.boragle) self.render_template('qna', dict(question=question, boragle = question.boragle, authdetails = utils.authdetails(question.url), creator = avatar, answers = paginator.items, paginator = paginator ))
def get(self, url): city = City.get_by_url(url) if not city: company = Company.get_by_url(url) if not city and not company: self.redirect('/', False) return data_type = 'city' if city else 'company' data = city or company start_after = self.read('start_after') performances = data.get_performances(start_after = start_after).fetch(PAGE+1) start_after = performances[-2].time_sort if len(performances) == PAGE+1 else None render_data = dict(performances=performances[:PAGE], start_after = start_after, auth = utils.authdetails(data.get_route())) render_data[data_type] = data self.render('public/' + data_type + '.html', render_data)
def get(self, company_url, show_url): company = Company.get_by_url(company_url) if company: show = company.get_show_by_url(show_url) else: self.redirect('/', False) return if not show: self.redirect('/' + company_url, False) return performances = show.get_performances().fetch(50) self.render('public/show.html', dict(show=show, performances=performances, auth = utils.authdetails(show.get_route())))
def render(self, template_path, data): from google.appengine.ext.webapp import template if not data.has_key('auth'): data.update(dict(auth = utils.authdetails())) self.respond(template.render(utils.path(template_path), data))
def get(self): self.render_template('main', dict(boragles = Boragle.get_latest(count = 5), authdetails = utils.authdetails(), creator = self.creator))
def get(self): self.render_template('search', dict(authdetails = utils.authdetails('/search'), creator = self.creator))
def get(self, user_id): user = Creator.find_by_id(user_id) self.render_template('user', dict(user = user, authdetails = utils.authdetails(user.url), creator = self.creator))
def get(self, boragle_slug): boragle = Boragle.find_by_slug(boragle_slug) avatar = self.get_avatar_for_boragle(boragle) self.render_template('ask-question', dict(boragle = boragle, authdetails = utils.authdetails(boragle.url+'/'+settings.urls['ask']), creator = avatar))
def get(self): self.render_template('new', dict(authdetails = utils.authdetails(settings.urls['new']), creator = self.creator))