Skip to content

Commit bc4e02e

Browse files
committed
Add USE_WRAPPED toggle to users
1 parent b476f05 commit bc4e02e

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

.anvil_editor.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ unique_ids:
22
forms: {}
33
modules:
44
_demo_startup: '1719087683748644303970981.0312'
5+
_users: '1721065127336894381056321.5935'
56
auto_batch: '1720557189347558051799744.9072'
67
tables: '1720711436314890422194670.1993'
78
tables._tables: '1721062590178633669568195.047'

client_code/_users.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from .auto_batch import debatchify_inputs, BatchTable
2+
import anvil.users
3+
4+
5+
def force_login(*args, **kwargs):
6+
return debatchify_inputs(anvil.users.force_login)(*args, **kwargs)
7+
8+
9+
def get_user(*args, **kwargs):
10+
user_row = anvil.users.get_user(*args, **kwargs)
11+
batch_table = BatchTable.of_row(user_row)
12+
return batch_table.get_batch_row(user_row)

client_code/users.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
from .auto_batch import debatchify_inputs, BatchTable
1+
from .auto_batch import USE_WRAPPED
2+
from . import _users
23
import anvil.users
34

45

5-
def force_login(*args, **kwargs):
6-
return debatchify_inputs(anvil.users.force_login)(*args, **kwargs)
7-
8-
9-
def get_user(*args, **kwargs):
10-
user_row = anvil.users.get_user(*args, **kwargs)
11-
batch_table = BatchTable.of_row(user_row)
12-
return batch_table.get_batch_row(user_row)
13-
14-
156
def __getattr__(attr):
16-
return getattr(anvil.users, attr)
7+
if USE_WRAPPED and attr in ('force_login', 'get_user'):
8+
return getattr(_users, attr)
9+
else:
10+
return getattr(anvil.users, attr)

0 commit comments

Comments
 (0)