def _dump_post(self, post): url = url_for(post, _external=True) entry = self.atom('entry', {'{%s}base' % XML_NS: url}) self.atom('title', text=post.title, type='text', parent=entry) self.atom('id', text=post.uid, parent=entry) self.atom('updated', text=format_iso8601(post.last_update), parent=entry) self.atom('published', text=format_iso8601(post.pub_date), parent=entry) self.atom('link', href=url, parent=entry) author = self.atom('author', parent=entry) author.attrib[self.z.dependency] = self.users[post.author.id] \ .attrib['dependency'] self.atom('name', text=post.author.display_name, parent=author) self.atom('email', text=post.author.email, parent=author) self.z('slug', text=post.slug, parent=entry) self.z('comments_enabled', text=post.comments_enabled and 'yes' or 'no', parent=entry) self.z('pings_enabled', text=post.pings_enabled and 'yes' or 'no', parent=entry) self.z('status', text=str(post.status), parent=entry) self.z('content_type', text=str(post.content_type), parent=entry) self.atom('content', type='text', text=post.text, parent=entry) self.atom('content', type='html', text=post.body.to_html(), parent=entry) if post.intro: self.atom('summary', type='html', text=post.intro.to_html(), parent=entry) for category in post.categories: attrib = dict(term=category.slug, scheme=ZINE_CATEGORY_URI) if category.slug != category.name: attrib['label'] = category.name element = self.atom('category', attrib=attrib, parent=entry) if category.description: self.rezine.description(category.description, parent=element) for tag in post.tags: attrib = dict(term=tag.slug, scheme=ZINE_TAG_URI) if tag.slug != tag.name: attrib['label'] = tag.name self.atom('category', attrib=attrib, parent=entry) self.z('parser_data', text=dump_parser_data(post.parser_data).encode('base64'), parent=entry) for c in post.comments: comment = self.z('comment', parent=entry) comment.attrib['id'] = str(c.id) author = self.z('author', parent=comment) self.z('name', text=c.author, parent=author) self.z('email', text=c.email, parent=author) self.z('uri', text=c.www, parent=author) if c.user is not None: author.attrib['dependency'] = self.users[c.user.id] \ .attrib['dependency'] self.z('published', text=format_iso8601(c.pub_date), parent=comment) self.z('blocked', text=c.blocked and 'yes' or 'no', parent=comment) self.z('is_pingback', text=c.is_pingback and 'yes' or 'no', parent=comment) self.z('status', text=str(c.status), parent=comment), self.z('blocked_msg', text=str(c.blocked_msg or ''), parent=comment) self.z('parent', text=c.parent_id is not None and str(c.parent_id) or '', parent=comment) self.z('submitter_ip', text=c.submitter_ip, parent=comment) self.z('content', type='html', text=c.body.to_html(), parent=comment) self.z('content', type='text', text=c.text, parent=comment) self.z('parser_data', text=dump_parser_data(c.parser_data).encode('base64'), parent=comment) for participant in self.participants: participant.process_post(entry, post) return entry
def process_bind_param(self, value, dialect): if value is None: return from rezine.utils.zeml import dump_parser_data return dump_parser_data(value)