##// END OF EJS Templates
Fix various review comments
Thomas Kluyver -
Show More
@@ -277,7 +277,7 b' class FileContentsManager(ContentsManager):'
277 277 Whether to include the contents in the reply
278 278 type_ : str, optional
279 279 The requested type - 'file', 'notebook', or 'directory'.
280 Will raise HTTPError 406 if the content doesn't match.
280 Will raise HTTPError 400 if the content doesn't match.
281 281 format : str, optional
282 282 The requested format for file contents. 'text' or 'base64'.
283 283 Ignored if this returns a notebook or directory model.
@@ -35,7 +35,7 b' class API(object):'
35 35 def __init__(self, base_url):
36 36 self.base_url = base_url
37 37
38 def _req(self, verb, path, body=None):
38 def _req(self, verb, path, body=None, params=None):
39 39 response = requests.request(verb,
40 40 url_path_join(self.base_url, 'api/contents', path),
41 41 data=body,
@@ -47,14 +47,12 b' class API(object):'
47 47 return self._req('GET', path)
48 48
49 49 def read(self, path, type_=None, format=None):
50 query = []
50 params = {}
51 51 if type_ is not None:
52 query.append('type=' + type_)
52 params['type'] = type_
53 53 if format is not None:
54 query.append('format=' + format)
55 if query:
56 path += '?' + '&'.join(query)
57 return self._req('GET', path)
54 params['format'] = format
55 return self._req('GET', path, params=params)
58 56
59 57 def create_untitled(self, path='/', ext='.ipynb'):
60 58 body = None
@@ -87,10 +87,10 b' define(['
87 87 error : this.create_basic_error_handler(options.error)
88 88 };
89 89 var url = this.api_url(path);
90 if (options.type) {
91 url += '?type=' + options.type;
92 }
93 $.ajax(url, settings);
90 params = {};
91 if (options.type) { params.type = options.type; }
92 if (options.format) { params.format = options.format; }
93 $.ajax(url + '?' + $.param(params), settings);
94 94 };
95 95
96 96
General Comments 0
You need to be logged in to leave comments. Login now