Beispiel #1
0
 def get(self, url):
     article = Article.get_article_by_url(path_to_unicode(url))
     if article and (article.published or self.request.is_admin):
         if self.is_spider():
             self.response.set_last_modified(article.mod_time)
         user = self.request.current_user
         self.echo(
             'article.html', {
                 'article':
                 article,
                 'can_grade':
                 user and user.flag & USER_FLAGS['active']
                 and not user.has_graded(article.key()),
                 'title':
                 article.title,
                 'page':
                 'article'
             })
         incr_counter('article_counter:%s' % article.key().id(),
                      BLOG_ADMIN_RELATIVE_PATH + 'article_counter/')
     else:
         self.error(404)
         self.echo(
             'error.html', {
                 'page': '404',
                 'title': '找不到该文章',
                 'h2': '糟糕',
                 'msg': '好像弄丢了什么东东,完全找不到了的说…'
             })
Beispiel #2
0
 def get(self, url):
     article = Article.get_article_by_url(path_to_unicode(url))
     if article and (article.published or self.request.is_admin):
         self.echo("article_mobile.html", {"article": article, "title": article.title, "page": "article"})
         incr_counter("article_counter:%s" % article.key().id(), BLOG_ADMIN_RELATIVE_PATH + "article_counter/")
     else:
         self.error(404)
         self.echo("message_mobile.html", {"page": "404", "title": "找不到该文章", "h2": "找不到该文章", "msg": "请检查URL是否输入错误。"})
Beispiel #3
0
	def get(self, url):
		article = Article.get_article_by_url(path_to_unicode(url))
		if article and (article.published or self.request.is_admin):
			self.echo('article_mobile.html', {
				'article': article,
				'title': article.title,
				'page': 'article'
			})
			incr_counter('article_counter:%s' % article.key().id(), BLOG_ADMIN_RELATIVE_PATH + 'article_counter/')
		else:
			self.error(404)
			self.echo('message_mobile.html', {
				'page': '404',
				'title': "Can't find out this article",
				'h2': "Can't find out this article.",
				'msg': 'Please check whether you entered a wrong URL.'
			})
Beispiel #4
0
	def get(self, url):
		article = Article.get_article_by_url(path_to_unicode(url))
		if article and (article.published or self.request.is_admin):
			self.echo('article_mobile.html', {
				'article': article,
				'title': article.title,
				'page': 'article'
			})
			incr_counter('article_counter:%s' % article.key().id(), BLOG_ADMIN_RELATIVE_PATH + 'article_counter/')
		else:
			self.error(404)
			self.echo('message_mobile.html', {
				'page': '404',
				'title': '找不到该文章',
				'h2': '找不到该文章',
				'msg': '请检查URL是否输入错误。'
			})
Beispiel #5
0
	def get(self, url):
		article = Article.get_article_by_url(path_to_unicode(url))
		if article and (article.published or self.request.is_admin):
			if self.is_spider():
				self.response.set_last_modified(article.mod_time)
			self.echo('article.html', {
				'article': article,
				'title': article.title,
				'page': 'article'
			})
			incr_counter('article_counter:%s' % article.key().id(), BLOG_ADMIN_RELATIVE_PATH + 'article_counter/')
		else:
			self.error(404)
			self.echo('error.html', {
				'page': '404',
				'title': "Can't find out this article",
				'h2': 'Oh, my god!',
				'msg': 'Something seems to be lost...'
			})
Beispiel #6
0
 def get(self, url):
     article = Article.get_article_by_url(path_to_unicode(url))
     if article and (article.published or self.request.is_admin):
         self.echo('article_mobile.html', {
             'article': article,
             'title': article.title,
             'page': 'article'
         })
         incr_counter('article_counter:%s' % article.key().id(),
                      BLOG_ADMIN_RELATIVE_PATH + 'article_counter/')
     else:
         self.error(404)
         self.echo(
             'message_mobile.html', {
                 'page': '404',
                 'title': '找不到该文章',
                 'h2': '找不到该文章',
                 'msg': '请检查URL是否输入错误。'
             })
Beispiel #7
0
 def get(self, url):
     article = Article.get_article_by_url(path_to_unicode(url))
     if article and (article.published or self.request.is_admin):
         if self.is_spider():
             self.response.set_last_modified(article.mod_time)
         user = self.request.current_user
         self.echo(
             "article.html",
             {
                 "article": article,
                 "can_grade": user and user.flag & USER_FLAGS["active"] and not user.has_graded(article.key()),
                 "title": article.title,
                 "page": "article",
             },
         )
         incr_counter("article_counter:%s" % article.key().id(), BLOG_ADMIN_RELATIVE_PATH + "article_counter/")
     else:
         self.error(404)
         self.echo("error.html", {"page": "404", "title": "找不到该文章", "h2": "糟糕", "msg": "好像弄丢了什么东东,完全找不到了的说…"})
Beispiel #8
0
	def get(self, url):
		article = Article.get_article_by_url(path_to_unicode(url))
		if article and (article.published or self.request.is_admin):
			if self.is_spider():
				self.response.set_last_modified(article.mod_time)
			user = self.request.current_user
			self.echo('article.html', {
				'article': article,
				'can_grade': user and user.flag & USER_FLAGS['active'] and not user.has_graded(article.key()),
				'title': article.title,
				'page': 'article'
			})
			incr_counter('article_counter:%s' % article.key().id(), BLOG_ADMIN_RELATIVE_PATH + 'article_counter/')
		else:
			self.error(404)
			self.echo('error.html', {
				'page': '404',
				'title': '找不到该文章',
				'h2': '糟糕',
				'msg': '好像弄丢了什么东东,完全找不到了的说…'
			})