Ejemplo n.º 1
0
  def to_metaweblog(self,application):
    # kind of throwing fieldnames at the wall and see what sticks,
    # MarsEdit expects different names in the responses to different API calls

    if self.status=='publish':
      url = absolute(application.reverse_url('post',self.slug))
    else:
      url = absolute(application.reverse_url('draft',self.slug))

    rv = {
      'title':self.title,
      # Note we're returning the original, not the display version
      'description': self.original,
      'link': url,
      'permaLink': url,
      #'categories':
      'mt_keywords': ','.join(self['tags']),
      'dateCreated': self.local_date_created(application),
      'date_created_gmt': self.date_created,
      'postid':str(self.id),
      'status':self.status,
      'wp_slug':self.slug,
      'mt_excerpt':self.meta_description,
      'id':str(self.id)
    }


    if self.type =='post':
      rv['post_id'] = str(self.id)
      rv['post_status'] = self.status
    elif self.type == 'page':
      rv['page_id'] = str(self.id)
      rv['page_status'] = self.status

    return rv
Ejemplo n.º 2
0
 def to_wordpress(self,application):
   url = absolute(application.reverse_url('category',self.slug))
   return {
     'categoryId': str(self.id),
     'categoryName': self.name,
     'htmlUrl': url,
     'rssUrl': url,
   }