def get_not_conflict_poolname(self, account, path):
        ret = False
        new_path = path
        pool_dbo = DboPool(self.application.sql_client)
        current_user = {
            'account': account,
            'poolid': pool_dbo.get_root_pool(account)
        }
        metadata_manager = MetaManager(self.application.sql_client,
                                       current_user, new_path)
        if not metadata_manager.get_path() is None:
            for i in range(100000):
                new_path = "%s(%d)" % (path, i)
                metadata_manager.init_with_path(current_user, new_path)
                if metadata_manager.get_path() is None:
                    #bingo
                    ret = True
                    break
        else:
            #bingo
            ret = True

        return ret, new_path
    def post(self):
        self.set_header('Content-Type', 'application/json')
        auth_dbo = self.db_account

        errorMessage = ""
        errorCode = 0
        is_pass_check = True

        if auth_dbo is None:
            errorMessage = "database return null"
            errorCode = 1001
            is_pass_check = False

        #logging.info("body:"+self.request.body)
        _body = None
        if is_pass_check:
            is_pass_check = False
            try:
                _body = json.loads(self.request.body)
                is_pass_check = True
            except Exception:
                #raise BadRequestError('Wrong JSON', 3009)
                errorMessage = "wrong json format"
                errorCode = 1003
                pass

        path = None
        if is_pass_check:
            is_pass_check = False
            if _body:
                try:
                    if 'path' in _body:
                        path = _body['path']
                    is_pass_check = True
                except Exception:
                    errorMessage = "parse json fail"
                    errorCode = 1004
                    pass

        if is_pass_check:
            ret, errorMessage = self.check_path(path)
            if not ret:
                is_pass_check = False
                errorCode = 1010

        if is_pass_check:
            if path == "/":
                path = ""

            if len(path) == 0:
                # empty is not allow in this API.
                errorMessage = "path is empty"
                errorCode = 1013
                is_pass_check = False

        if is_pass_check:
            if self.current_user['poolid'] is None:
                errorMessage = "no unshare permission"
                errorCode = 1015
                is_pass_check = False

        old_real_path = None
        old_poolid = None
        if is_pass_check:
            self.metadata_manager = MetaManager(self.application.sql_client,
                                                self.current_user, path)

            old_real_path = self.metadata_manager.real_path
            old_poolid = self.metadata_manager.poolid
            if not old_real_path is None:
                if not os.path.exists(old_real_path):
                    # path not exist
                    errorMessage = "real path is not exist"
                    errorCode = 1020
                    is_pass_check = False
            else:
                errorMessage = "no permission"
                errorCode = 1030
                is_pass_check = False

        new_real_path = None
        new_poolid = None
        to_metadata_manager = None
        if is_pass_check:
            to_metadata_manager = MetaManager(self.application.sql_client,
                                              self.current_user, "")
            to_metadata_manager.init_with_path(self.current_user,
                                               path,
                                               check_shared_pool=False)

            new_real_path = to_metadata_manager.real_path
            new_poolid = to_metadata_manager.poolid
            if not new_real_path is None:
                if os.path.exists(new_real_path):
                    # path exist, conflict, @_@; delete or not?
                    self._deletePath(new_real_path)
            else:
                errorMessage = "no permission"
                errorCode = 1030
                is_pass_check = False

        if is_pass_check:
            is_pass_check, errorMessage, errorCode = self._revokeShareCode(
                old_poolid)

        if is_pass_check:
            current_metadata = None
            is_pass_check, current_metadata, errorMessage = to_metadata_manager.move_metadata(
                self.metadata_manager.poolid, self.metadata_manager.db_path)

        if is_pass_check:
            is_pass_check = self.move_shared_folder_back(
                old_poolid, new_real_path)
            if not is_pass_check:
                errorMessage = "pool folder not exist or target folder conflict"
                errorCode = 1040
                is_pass_check = False

        if is_pass_check:
            is_pass_check, current_metadata, errorMessage = self.remove_shared_folder_pool(
                old_poolid)

        ret_dict = {'path': path}

        if is_pass_check:
            # every thing is correct
            self.write(ret_dict)

            folder_id = 0
            current_metadata = to_metadata_manager.get_path()
            if not current_metadata is None:
                folder_id = current_metadata["id"]
            self.set_header("oid", folder_id)
        else:
            self.set_status(400)
            self.write(dict(error=dict(message=errorMessage, code=errorCode)))
            logging.error(
                '%s' %
                (str(dict(error=dict(message=errorMessage, code=errorCode)))))