Exemple #1
0
def post(handler, response):
  edit = handler.get_edit(required=True)
  try:
    title = 'Emend > Sites > %s > %s' % (edit.site.domain, edit.original)
    excerpt = edit.as_tweet().encode('utf8')
    url = edit.permalink()
    tb = TrackBack(title=title, excerpt=excerpt, url=url, blog_name=site_name())
    tb.autodiscover(edit.url)
    if tb.ping() == 1:
      response.error = "Didn't find a trackback URI."
    else:
      response.success = 1
  except urlfetch.DownloadError, e:
    logging.error("trackback failed: %s", e);
    response.error = e.message
Exemple #2
0
    site.open += 1
    site.put()
    return edit
  
  edit = db.run_in_transaction(put_edit)
  
  # queue to inserts to bloom
  taskqueue.add(
    url="/tasks/edits/url_sha1_bloom/insert.json",
    params=dict(
      url_sha1=edit.url_sha1,
    ),
  )
  
  # clear cache
  handler.invalidate()
  
  # fiddle user's count
  edit.author.open += 1
  edit.author.put()
    
  # tweet
  edit.tweet()
  
  # ping blogsearch
  host_url = 'http://%s' % handler.host()
  changes_url = '%s.atom' % host_url
  blogsearch.ping(name=site_name(), url=host_url, changesURL=changes_url)
  
  handler.redirect(edit.permalink())