Skip to content

Commit 1d4873f

Browse files
author
B1nj0y
committed
fix a bug for running IPerl in notebook-http mode
1 parent 05e7148 commit 1d4873f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

kernel_gateway/notebook_http/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def _handle_request(self):
184184
'headers' : headers_to_dict(self.request.headers)
185185
})
186186
# Turn the request string into a valid code string
187-
request_code = format_request(request)
187+
request_code = format_request(request, self.kernel_name)
188188

189189
# Run the request and source code and yield until there's a result
190190
access_log.debug('Request code for notebook cell is: {}'.format(request_code))

kernel_gateway/notebook_http/request_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
APPLICATION_JSON = 'application/json'
1313
TEXT_PLAIN = 'text/plain'
1414

15-
def format_request(bundle):
15+
def format_request(bundle, kernel_name):
1616
"""Creates an assignment statement of bundle JSON-encoded to a variable
1717
named `REQUEST`.
1818
@@ -22,7 +22,10 @@ def format_request(bundle):
2222
`REQUEST = "<json-encoded expression>"`
2323
"""
2424
bundle = json.dumps(bundle)
25-
statement = "REQUEST = {}".format(bundle)
25+
if kernel_name == 'iperl':
26+
statement = "my $REQUEST = {}".format(bundle)
27+
else:
28+
statement = "REQUEST = {}".format(bundle)
2629
return statement
2730

2831
def parameterize_path(path):

0 commit comments

Comments
 (0)