24
24
make_notebook_source_bundle ,
25
25
write_manifest ,
26
26
)
27
+ from rsconnect .environment import Environment
27
28
from rsconnect .http_support import CookieJar
28
29
29
30
from ssl import SSLError
@@ -152,7 +153,7 @@ def post(self, action):
152
153
nb_path = unquote_plus (data ["notebook_path" ].strip ("/" ))
153
154
api_key = data ["api_key" ]
154
155
app_mode = data ["app_mode" ]
155
- environment = data .get ("environment" )
156
+ environment_dict = data .get ("environment" )
156
157
disable_tls_check = data ["disable_tls_check" ]
157
158
cadata = data .get ("cadata" , None )
158
159
extra_files = data .get ("files" , [])
@@ -174,11 +175,11 @@ def post(self, action):
174
175
self .log .exception ("Bundle creation failed" )
175
176
raise web .HTTPError (500 , u"Bundle creation failed: %s" % exc )
176
177
elif app_mode == "jupyter-static" :
177
- if not environment :
178
+ if not environment_dict :
178
179
raise web .HTTPError (400 , "environment is required for jupyter-static app_mode" )
179
180
180
181
try :
181
- bundle = make_notebook_source_bundle (os_path , environment , extra_files )
182
+ bundle = make_notebook_source_bundle (os_path , Environment ( ** environment_dict ) , extra_files )
182
183
except Exception as exc :
183
184
self .log .exception ("Bundle creation failed" )
184
185
raise web .HTTPError (500 , u"Bundle creation failed: %s" % exc )
@@ -252,13 +253,13 @@ def post(self, action):
252
253
return
253
254
254
255
if action == "write_manifest" :
255
- environment = data ["environment" ]
256
+ environment_dict = data ["environment" ]
256
257
nb_path = unquote_plus (data ["notebook_path" ].strip ("/" ))
257
258
relative_dir = dirname (nb_path )
258
259
os_path = self .contents_manager ._get_os_path (nb_path )
259
260
output_dir = dirname (os_path )
260
261
nb_name = os .path .basename (os_path )
261
- created , skipped = write_manifest (relative_dir , nb_name , environment , output_dir )
262
+ created , skipped = write_manifest (relative_dir , nb_name , Environment ( ** environment_dict ) , output_dir )
262
263
self .finish (json .dumps ({"created" : created , "skipped" : skipped }))
263
264
return
264
265
0 commit comments