@@ -714,17 +714,17 @@ def _generate_scripts_html(self):
714
714
)
715
715
)
716
716
717
+ self ._inline_scripts .extend (_callback .GLOBAL_INLINE_SCRIPTS )
718
+ _callback .GLOBAL_INLINE_SCRIPTS .clear ()
719
+
717
720
return "\n " .join (
718
721
[
719
722
format_tag ("script" , src )
720
723
if isinstance (src , dict )
721
724
else '<script src="{}"></script>' .format (src )
722
725
for src in srcs
723
726
]
724
- + [
725
- "<script>{}</script>" .format (src )
726
- for src in (self ._inline_scripts + _callback .GLOBAL_INLINE_SCRIPTS )
727
- ]
727
+ + ["<script>{}</script>" .format (src ) for src in self ._inline_scripts ]
728
728
)
729
729
730
730
def _generate_config_html (self ):
@@ -1343,7 +1343,7 @@ def _setup_server(self):
1343
1343
self ._generate_css_dist_html ()
1344
1344
1345
1345
# Copy over global callback data structures assigned with `dash.callback`
1346
- for k in _callback .GLOBAL_CALLBACK_MAP :
1346
+ for k in list ( _callback .GLOBAL_CALLBACK_MAP ) :
1347
1347
1348
1348
if k in self .callback_map :
1349
1349
raise DuplicateCallback (
@@ -1353,9 +1353,10 @@ def _setup_server(self):
1353
1353
+ "assigned with `app.callback`."
1354
1354
)
1355
1355
1356
- self .callback_map [k ] = _callback .GLOBAL_CALLBACK_MAP [ k ]
1356
+ self .callback_map [k ] = _callback .GLOBAL_CALLBACK_MAP . pop ( k )
1357
1357
1358
1358
self ._callback_list .extend (_callback .GLOBAL_CALLBACK_LIST )
1359
+ _callback .GLOBAL_CALLBACK_LIST .clear ()
1359
1360
1360
1361
def _add_assets_resource (self , url_path , file_path ):
1361
1362
res = {"asset_path" : url_path , "filepath" : file_path }
@@ -1434,16 +1435,17 @@ def csp_hashes(self, hash_algorithm="sha256"):
1434
1435
1435
1436
method = getattr (hashlib , hash_algorithm )
1436
1437
1438
+ self ._inline_scripts .extend (_callback .GLOBAL_INLINE_SCRIPTS )
1439
+ _callback .GLOBAL_INLINE_SCRIPTS .clear ()
1440
+
1437
1441
return [
1438
1442
"'{hash_algorithm}-{base64_hash}'" .format (
1439
1443
hash_algorithm = hash_algorithm ,
1440
1444
base64_hash = base64 .b64encode (
1441
1445
method (script .encode ("utf-8" )).digest ()
1442
1446
).decode ("utf-8" ),
1443
1447
)
1444
- for script in (
1445
- self ._inline_scripts + [self .renderer ] + _callback .GLOBAL_INLINE_SCRIPTS
1446
- )
1448
+ for script in (self ._inline_scripts + [self .renderer ])
1447
1449
]
1448
1450
1449
1451
def get_asset_url (self , path ):
0 commit comments