def get(self): auth_level = self.is_user_authorized() if auth_level == models.AUTH_LEVEL_REGISTERED_USER: self.redirect('/account/activate/reminder/') elif auth_level == models.AUTH_LEVEL_ACTIVATED_USER: today = datetime.utcnow() request_year = self.request.get('year') request_month = self.request.get('month') if not request_year or not request_month: year = today.year month = today.month articles = Article.get_latest_published_student() else: year = dec(request_year) month = dec(request_month) articles = Article.get_all_published_student_articles_for_month(year, month) books = Book.get_latest(count=10) response = render_template('blog_students.html', year_list=models.BLOG_YEAR_LIST, month_list=models.MONTH_LIST, today=today, requested_year=year, requested_month=month, articles=articles, books=books) self.response.out.write(response) else: response = render_template('index.html') self.response.out.write(response)
def get(self): auth_level = self.is_user_authorized() if auth_level == models.AUTH_LEVEL_REGISTERED_USER: self.redirect("/account/activate/reminder/") elif auth_level == models.AUTH_LEVEL_ACTIVATED_USER: today = datetime.utcnow() year = self.request.get("year") month = self.request.get("month") if not year or not month: year = today.year month = today.month else: year = dec(year) month = dec(month) articles = Article.get_all_published_for_month(year, month) books = Book.get_latest(count=10) response = render_template( "blog.html", year_list=models.BLOG_YEAR_LIST, month_list=models.MONTH_LIST, today=today, requested_year=year, requested_month=month, articles=articles, books=books, ) self.response.out.write(response) else: response = render_template("index.html") self.response.out.write(response)