@auth
    def _POST(self, *param, **params):
        if not validates_icon(self):
            self.logger.debug("Create Icon is failed, Invalid input value")
            return web.badrequest(add_prefix(self.view.alert, "400"))

        icon_filevalue = self.input.multi_icon.value
        icon_filename = "%s.%s" % (uniq_filename(), imghdr.what(None, icon_filevalue))

        if is_path(icon_filename) is True:
            return web.badrequest("Not to include the path.")

        icon_realpath = ICON_DIR_TPL % (karesansui.dirname, icon_filename)
        icon_webpath = ICON_DIR_TPL % (web.ctx.homepath, icon_filename)

        if os.path.exists(icon_realpath):
            web.conflict(icon_webpath, add_prefix("icon already exists", "409"))

        try:
            create_file(icon_realpath, icon_filevalue)
        except __HOLE__, ioe:
            self.logger.error("Failed to write icon file. - filename=%s" % icon_filename)
            return web.internalerror(add_prefix("Failed to create icon file.", "500"))

        return web.created(icon_webpath, icon_filename)
dataset/ETHPy150Open karesansui/karesansui/karesansui/gadget/icon.py/Icon._POST