Skip to content

Commit

Permalink
set last-modified for spider
Browse files Browse the repository at this point in the history
  • Loading branch information
ego008 committed Dec 23, 2011
1 parent c813388 commit 4b008bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ def get(self, id = '', title = ''):
rp = self.get_cookie("rp%s" % id, '')
if rp != obj.password:
tmpl = '_pw'


if self.is_spider():
self.set_header("Last-Modified", obj.last_modified)

self.echo('page%s.html'%tmpl, {
'title': "%s - %s"%(obj.title, SITE_TITLE),
'keywords':obj.keywords,
Expand Down
9 changes: 7 additions & 2 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
##
##数据库配置信息
if debug:
#已经在 setting.py 里设置
pass
MYSQL_DB = 'app_saepy'
MYSQL_USER = 'root'
MYSQL_PASS = '123'
MYSQL_HOST_M = '127.0.0.1'
MYSQL_HOST_S = '127.0.0.1'
MYSQL_PORT = '3306'
else:
import sae.const
MYSQL_DB = sae.const.MYSQL_DB
Expand Down Expand Up @@ -92,6 +96,7 @@ def post_detail_formate(obj):
obj.content = tran_content(obj.content, obj.highlight)
obj.taglist = ', '.join(["""<a href="%s/tag/%s/" rel="tag">%s</a>"""%(BASE_URL, tag, tag) for tag in obj.tags.split(',')])
obj.add_time_fn = time_from_now(int(obj.add_time))
obj.last_modified = timestamp_to_datetime(obj.edit_time)
obj.keywords = obj.tags
obj.description = HTML_REG.sub('',obj.content[:DESCRIPTION_CUT_WORDS])
#get prev and next obj
Expand Down

0 comments on commit 4b008bb

Please sign in to comment.