From 42e9924273a032ebd32ecd6191d04e5778b756d8 Mon Sep 17 00:00:00 2001 From: wassaf shahzad Date: Tue, 22 Aug 2023 00:42:34 -0700 Subject: [PATCH 1/4] added support for limits in pagination (#1646) --- reflex/components/datadisplay/datatable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reflex/components/datadisplay/datatable.py b/reflex/components/datadisplay/datatable.py index 880e375406..2fe6528739 100644 --- a/reflex/components/datadisplay/datatable.py +++ b/reflex/components/datadisplay/datatable.py @@ -1,6 +1,6 @@ """Table components.""" -from typing import Any, List +from typing import Any, Dict, List, Union from reflex.components.component import Component from reflex.components.tags import Tag @@ -38,7 +38,7 @@ class DataTable(Gridjs): resizable: Var[bool] # Enable pagination. - pagination: Var[bool] + pagination: Var[Union[bool, Dict]] @classmethod def create(cls, *children, **props): From 196bdc51010c5abf4ba212d9cda9619503084ce0 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Tue, 22 Aug 2023 14:07:36 -0700 Subject: [PATCH 2/4] model: only pass "check_same_thread" arg for sqlite database (#1662) --- reflex/model.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/reflex/model.py b/reflex/model.py index 4bc55912ce..2e9d275b5c 100644 --- a/reflex/model.py +++ b/reflex/model.py @@ -43,12 +43,9 @@ def get_engine(url: Optional[str] = None): ) # Print the SQL queries if the log level is INFO or lower. echo_db_query = os.environ.get("SQLALCHEMY_ECHO") == "True" - return sqlmodel.create_engine( - url, - echo=echo_db_query, - # Needed for the admin dash. - connect_args={"check_same_thread": False}, - ) + # Needed for the admin dash on sqlite. + connect_args = {"check_same_thread": False} if url.startswith("sqlite") else {} + return sqlmodel.create_engine(url, echo=echo_db_query, connect_args=connect_args) class Model(Base, sqlmodel.SQLModel): From 6c80a0f1ebc6444334e18b7f0fa12919309b4b84 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Tue, 22 Aug 2023 17:07:15 -0700 Subject: [PATCH 3/4] pyproject.toml: requires python-engineio!=4.6.0 (#1663) --- poetry.lock | 16 +--------------- pyproject.toml | 1 + 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/poetry.lock b/poetry.lock index 0700cef0ad..514b8ffcc4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1346,20 +1346,6 @@ files = [ [package.dependencies] six = ">=1.5" -[[package]] -name = "python-dotenv" -version = "0.13.0" -description = "Add .env support to your django/flask apps in development and deployments" -optional = false -python-versions = "*" -files = [ - {file = "python-dotenv-0.13.0.tar.gz", hash = "sha256:3b9909bc96b0edc6b01586e1eed05e71174ef4e04c71da5786370cebea53ad74"}, - {file = "python_dotenv-0.13.0-py2.py3-none-any.whl", hash = "sha256:25c0ff1a3e12f4bde8d592cc254ab075cfe734fc5dd989036716fd17ee7e5ec7"}, -] - -[package.extras] -cli = ["click (>=5.0)"] - [[package]] name = "python-engineio" version = "4.5.1" @@ -2139,4 +2125,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "7ba5a63b5a857eaa7e48c4addedd829727d6a074b60a1430e52ea7530547686a" +content-hash = "2b00be45f1c3b5118e2d54b315991c37f65e9da3fa081dab6adb4c7bb1205c74" diff --git a/pyproject.toml b/pyproject.toml index 307153586c..e58b983e24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ importlib-metadata = {version = "^6.7.0", python = ">=3.7, <3.8"} alembic = "^1.11.1" platformdirs = "^3.10.0" distro = {version = "^1.8.0", platform = "linux"} +python-engineio = "!=4.6.0" [tool.poetry.group.dev.dependencies] pytest = "^7.1.2" From 57855f56a10a7d9afafea6ad3c2af568cbef02f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Brand=C3=A9ho?= Date: Wed, 23 Aug 2023 10:10:51 +0200 Subject: [PATCH 4/4] add type conversion for int,float in built-in setters (#1660) --- reflex/vars.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/reflex/vars.py b/reflex/vars.py index 0373ca06a8..2db292c1e6 100644 --- a/reflex/vars.py +++ b/reflex/vars.py @@ -30,7 +30,7 @@ from reflex import constants from reflex.base import Base -from reflex.utils import format, types +from reflex.utils import console, format, types if TYPE_CHECKING: from reflex.state import State @@ -831,7 +831,16 @@ def setter(state: State, value: Any): state: The state within which we add the setter function. value: The value to set. """ - setattr(state, self.name, value) + if self.type_ in [int, float]: + try: + value = self.type_(value) + setattr(state, self.name, value) + except ValueError: + console.warn( + f"{self.name}: Failed conversion of {value} to '{self.type_.__name__}'. Value not set.", + ) + else: + setattr(state, self.name, value) setter.__qualname__ = self.get_setter_name()