def to_metaweblog(self, application): 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, 'description': self.original, 'link': url, 'permaLink': url, 'categories': [ cat.to_metaweblog(application) for cat in self['categories']], 'mt_keywords': ','.join(self['tags']), 'dateCreated': self.local_date_created(application), 'date_created_gmt': self.date_created, 'postid': str(self.id), 'id': str(self.id), 'status': self.status, 'wp_slug': self.slug, 'mt_excerpt': self.meta_description, } 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
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, }
def metaWeblog_newMediaObject(self, blogid, user, password, struct): name = struct['name'] content = struct['bits'].data # xmlrpclib created a 'Binary' object content_type = struct['type'] mlink = yield self.store_image(name, content, content_type) full_link = absolute( os.path.join(opts.base_url, 'media', mlink)) self.result({ 'file': name, 'url': full_link, 'type': content_type})
def ga_track_event_url(application, path): return absolute( application.reverse_url('tracking-pixel', path))