예제 #1
0
    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
예제 #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,
     }
예제 #3
0
    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})
예제 #4
0
def ga_track_event_url(application, path):
    return absolute(
        application.reverse_url('tracking-pixel', path))