Пример #1
0
def remove_storage(request, user_profile, keys=REQ(validator=check_list(check_string), default=None)):
    # type: (HttpRequest, UserProfile, Optional[List[str]]) -> HttpResponse
    keys = keys or get_keys_in_bot_storage(user_profile)
    try:
        remove_bot_storage(user_profile, keys)
    except StateError as e:
        return json_error(str(e))
    return json_success()
Пример #2
0
def remove_storage(request,
                   user_profile,
                   keys=REQ(validator=check_list(check_string), default=None)):
    # type: (HttpRequest, UserProfile, Optional[List[str]]) -> HttpResponse
    keys = keys or get_keys_in_bot_storage(user_profile)
    try:
        remove_bot_storage(user_profile, keys)
    except StateError as e:
        return json_error(str(e))
    return json_success()
Пример #3
0
def remove_storage(
    request: HttpRequest,
    user_profile: UserProfile,
    keys: Optional[List[str]] = REQ(json_validator=check_list(check_string),
                                    default=None),
) -> HttpResponse:
    if keys is None:
        keys = get_keys_in_bot_storage(user_profile)
    try:
        remove_bot_storage(user_profile, keys)
    except StateError as e:
        raise JsonableError(str(e))
    return json_success(request)
Пример #4
0
 def remove(self, key: str) -> None:
     remove_bot_storage(self.user_profile, [key])
Пример #5
0
 def remove(self, key: str) -> None:
     remove_bot_storage(self.user_profile, [key])