File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
pydatalab/src/pydatalab/routes/v0_1 Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -177,19 +177,25 @@ def _save_block_to_db(block: DataBlock) -> bool:
177
177
178
178
@BLOCKS .route ("/update-block/" , methods = ["POST" ])
179
179
def update_block ():
180
- """Take in json block data from site, process, and spit
181
- out updated data. May be used, for example, when the user
182
- changes plot parameters and the server needs to generate a new
183
- plot.
180
+ """Updates the server-side data block based on received JSON, including triggering
181
+ any events associated with the given block type.
182
+
184
183
"""
185
184
186
185
request_json = request .get_json ()
187
186
block_data = request_json ["block_data" ]
187
+ event_data = request_json .get ("event_data" , None )
188
188
blocktype = block_data ["blocktype" ]
189
189
save_to_db = request_json .get ("save_to_db" , False )
190
190
191
191
block = BLOCK_TYPES [blocktype ].from_web (block_data )
192
192
193
+ if event_data :
194
+ try :
195
+ block .process_events (event_data )
196
+ except NotImplementedError :
197
+ pass
198
+
193
199
saved_successfully = False
194
200
if save_to_db :
195
201
saved_successfully = _save_block_to_db (block )
You can’t perform that action at this time.
0 commit comments