Skip to content

Commit

Permalink
更新索引,增加singlePost HEAD请求处理
Browse files Browse the repository at this point in the history
git-svn-id: http://micolog.googlecode.com/svn/trunk@155 fd139d67-4554-0410-8437-97b8145f5b4d
  • Loading branch information
[email protected] committed Oct 13, 2010
1 parent 77de750 commit b0c02e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ def pingback_extensions_getPingbacks(self,url):
slug=param[2]
slug=urldecode(slug)
try:
entrie = Entry.all().filter("published =", True).filter('link =', slug).fetch(1)
entry = Entry.all().filter("published =", True).filter('link =', slug).fetch(1)
pings=[]
list=Comment.all().filter('entry =',entry).filter('ctype =',2)

Expand Down Expand Up @@ -777,7 +777,7 @@ def pingback_ping(source_uri, target_uri):

g_blog.tigger_action("pre_ping",source_uri,target_uri)
response = fetch_result(source_uri)
logging.info('source_uri: '+source_uri+'target_uri:'+target_uri)
logging.info('source_uri: '+source_uri+' target_uri:'+target_uri)
except Exception ,e :
#logging.info(e.message)
logging.info('The source URL does not exist.%s'%source_uri)
Expand All @@ -792,7 +792,7 @@ def pingback_ping(source_uri, target_uri):

pingback_post(response,source_uri,target_uri,path_info)
try:

logging.info('Micolog pingback succeed!')
return "Micolog pingback succeed!"
except:
raise Fault(49,"Access denied.")
Expand Down Expand Up @@ -827,6 +827,7 @@ def get_excerpt(response, url_hint, body_limit=1024 * 512):
after = chunk[match.end():]
raw_body = '%s\0%s' % (strip_tags(before).replace('\0', ''),
strip_tags(after).replace('\0', ''))
raw_body=raw_body.replace('\n', '').replace('\t', '')
body_match = re.compile(r'(?:^|\b)(.{0,120})\0(.{0,120})(?:\b|$)') \
.search(raw_body)
if body_match:
Expand Down Expand Up @@ -871,6 +872,7 @@ def pingback_post(response,source_uri, target_uri, slug):
try:
comment.save()
g_blog.tigger_action("pingback_post",comment)
logging.info("PingBack Successfully Added ! From %s"%source_uri)
memcache.delete("/"+entry.link)
return True
except:
Expand Down
4 changes: 4 additions & 0 deletions blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ def get(self,slug=None):


class SinglePost(BasePublicPage):
def head(self,slug=None,postid=None):
if g_blog.allow_pingback :
self.response.headers['X-Pingback']="%s/rpc"%str(g_blog.baseurl)

@cache()
def get(self,slug=None,postid=None):
if postid:
Expand Down
6 changes: 6 additions & 0 deletions index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ indexes:
- name: date
direction: desc

- kind: Comment
properties:
- name: ctype
- name: date
direction: desc

- kind: Comment
properties:
- name: ctype
Expand Down

0 comments on commit b0c02e7

Please sign in to comment.