66import traceback
77
88from tornado import web
9- from tornado .httpclient import AsyncHTTPClient , HTTPClientError
9+ from tornado .httpclient import AsyncHTTPClient , HTTPError
1010from tornado import gen
1111from textwrap import dedent
1212from urllib .parse import urlparse
@@ -61,7 +61,7 @@ def check_for_local_formgrader(self, config):
6161 http_client = AsyncHTTPClient ()
6262 try :
6363 response = yield http_client .fetch (url , headers = header )
64- except HTTPClientError :
64+ except HTTPError :
6565 # local formgrader isn't running
6666 self .log .warning ("Local formgrader does not seem to be running" )
6767 raise gen .Return ([])
@@ -74,9 +74,11 @@ def check_for_local_formgrader(self, config):
7474 self .log .error (traceback .format_exc ())
7575 raise gen .Return ([])
7676
77+ coursedir = CourseDirectory (config = config )
78+
7779 if status :
7880 raise gen .Return ([{
79- 'course_id' : config . CourseDirectory .course_id ,
81+ 'course_id' : coursedir .course_id ,
8082 'url' : base_url + '/formgrader' ,
8183 'kind' : 'local'
8284 }])
@@ -95,6 +97,7 @@ def check_for_noauth_jupyterhub_formgraders(self, config):
9597 # We are running on JupyterHub, so maybe there's a formgrader
9698 # service. Check if we have a course id and if so guess the path to the
9799 # formgrader.
100+
98101 coursedir = CourseDirectory (config = config )
99102 if not coursedir .course_id :
100103 raise gen .Return ([])
@@ -168,6 +171,7 @@ def get(self):
168171 courses = []
169172 local_courses = yield self .check_for_local_formgrader (config )
170173 jhub_courses = yield self .check_for_jupyterhub_formgraders (config )
174+
171175 courses .extend (local_courses )
172176 courses .extend (jhub_courses )
173177
0 commit comments