def editPost(self, postid, username, password, struct, publish):
     """See IMetaWeblogAPI.
     """
     struct = CaselessDict(struct)
     entry = IUIDManager(self.context).getByUID(postid)
     entry = IWeblogEntry(entry)
     body  = struct.get('description')
     excerpt, text = self.extractExcerptFromBody(body)
     title = struct.get('title')
     topics = struct.get('categories')
     entry.edit(title, excerpt, text, topics)
     if publish:
         IWorkflowedWeblogEntry(entry).publish()
     return True
 def newPost(self, blogid, username, password, struct, publish):
     """See IMetaWeblogAPI.
     """
     struct = CaselessDict(struct)
     weblog = IUIDManager(self.context).getByUID(blogid)
     weblog = IWeblog(weblog)
     # preparing the ingredients:
     body  = struct.get('description')
     # if the body contains an excerpt, we extract it:
     excerpt, text = self.extractExcerptFromBody(body)
     title = struct.get('title')
     topics = struct.get('categories')
     entry = weblog.addEntry(title=title,
                             excerpt=excerpt,
                             text=text,
                             topics=topics,)
     if publish:
         IWorkflowedWeblogEntry(entry).publish()
     return IUIDManager(entry).getUID()