def manage_editPost(self, title, author, body, tags=[], date=u'', publish=1, comment_allowed=1, sendping=1, REQUEST=None): """ Editor """ self.title = title self.author = author self.body = cleanBody(self, body) self.tags = prepareTags(tags) self.date = DateTime.DateTime(date) self.comment_allowed = comment_allowed self.reference_allowed = comment_allowed self.published = publish self.reindex_object() if self.inCommunity(): # We are in a Bitakora Community, so catalog the post there cat = self.getParentNode().getParentNode().get('Catalog', 'None') if cat is not None: cat.catalog_object(self, '/'.join(self.getPhysicalPath())) if sendping: tech_pings = Future(sendPing, self.absolute_url(), self.blog_title()) pingbacks = Future(postPingBacks, self.body, self.absolute_url()) if REQUEST is not None: return REQUEST.RESPONSE.redirect('%s/edit?msg=%s' % (self.absolute_url(), 'Post edited succesfully'))
def manage_addPost(self, title, author, body, tags=[], date=DateTime.DateTime(), publish=1, comment_allowed=1, not_clean=0, sendping=1, REQUEST=None): """ Called from ZMI when creating new posts """ if not title and REQUEST is not None: return REQUEST.RESPONSE.redirect('%s/post?msg=%s' % (self.blogurl(), 'You must provide at least the title of the post')) newid = self.createId(title) newtitle = clean(title) newauthor = clean(author) if not_clean: newbody = body else: newbody = cleanBody(self, body) newtags = prepareTags(tags) newdate = DateTime.DateTime(date) while hasattr(self, newid): newid = self.createNewId(newid) post = Post(newid, newtitle, newauthor, newbody, newtags, newdate, publish, comment_allowed) self._setObject(str(newid), post) post = self.get(newid) if self.inCommunity(): # We are in a Bitakora Community, so catalog the post there cat = self.getParentNode().get('Catalog', 'None') if cat is not None: cat.catalog_object(post, '/'.join(post.getPhysicalPath())) self.postcount = self.postcount + 1 if sendping: tech_pings = Future(sendPing, self.absolute_url(), self.blog_title()) pingbacks = Future(postPingBacks, newbody, post.absolute_url()) if REQUEST is not None: return REQUEST.RESPONSE.redirect('%s/admin?msg=%s' % (self.absolute_url(), 'Post added succesfully')) return newid