def _update_a_draft(self):
        postid = self.get_postid()
        if not postid:
            slog.warning('Please provide a post id!')
            return
        afile, aname = self.conf.get_draft(postid)

        # If output is provided, write the html to a file and abort.
        if self.args.output:
            self._write_html_file(afile)
            return

        html, meta, txt, medias = self._get_and_update_article_content(afile)
        if not html:
            return
        if meta.poststatus == 'draft':
            slog.warning(   'The post status of draft "%s" is "draft", '
                            'please modify it to "publish".'%postid)
            return

        # Update all taxonomy before create a new article.
        self.get_terms_from_wp(['category'])
        self.get_terms_from_wp(['post_tag'])

        if meta.posttype == 'page':
            post = WordPressPage()
        else:
            post = WordPressPost()
            post.terms = self.cache.get_terms_from_meta(meta.category, meta.tags)
            if not post.terms:
                slog.warning('Please provide some terms.')
                return

        post.content= html
        post.title = meta.title
        post.slug = meta.nicename
        post.date = meta.date
        post.user = meta.author
        post.date_modified = meta.modified
        post.post_status = meta.poststatus
        post.comment_status = "open"
        post.ping_status = "open"
        postid = self.wpcall(NewPost(post))

        if postid:
            write_by_templ(afile, afile, {'POSTID':postid, 'SLUG':postid}, True)
        else:
            return

        newfile, newname = None, None
        if meta.posttype == 'page':
            newfile, newname = self.conf.get_article(meta.nicename, meta.posttype)
        else:
            newfile, newname = self.conf.get_article(postid, meta.posttype)

        slog.info((afile, newfile)%'Move "%s" to "%s".')
        shutil.move(afile, newfile)
dataset/ETHPy150Open zrong/wpcmd/wpcmd/update.py/UpdateAction._update_a_draft/swapped operands of `%`