Commit e61a4f1d93966ead1d6bcaa8a0d55fd229d5c591

Authored by Miguel Barão
1 parent d0f5a597
Exists in master and in 1 other branch dev

- removed a lost print

- removed dead code (FileHandler)
Showing 1 changed file with 0 additions and 49 deletions   Show diff stats
@@ -169,54 +169,6 @@ class FileHandler(BaseHandler): @@ -169,54 +169,6 @@ class FileHandler(BaseHandler):
169 await self.flush() 169 await self.flush()
170 170
171 171
172 -  
173 -  
174 -# class FileHandler(BaseHandler):  
175 -# SUPPORTED_METHODS = ['GET']  
176 -# chunk_size = 512 * 1024 # serve up to 512 KiB multiple times  
177 -  
178 -# @tornado.web.authenticated  
179 -# async def get(self):  
180 -# uid = self.current_user  
181 -# ref = self.get_query_argument('ref', None)  
182 -# image = self.get_query_argument('image', None)  
183 -  
184 -# # FIXME does not work when user 0 is reviewing a test  
185 -  
186 -# t = self.testapp.get_student_test(uid)  
187 -# if t is not None:  
188 -# for q in t['questions']:  
189 -# if q['ref'] == ref:  
190 -# filepath = path.join(q['path'], 'public', image)  
191 -  
192 -# try:  
193 -# f = open(filepath, 'rb')  
194 -# except FileNotFoundError:  
195 -# logging.error(f'File not found: {filepath}')  
196 -# except PermissionError:  
197 -# logging.error(f'No permission: {filepath}')  
198 -# else:  
199 -# content_type = mimetypes.guess_type(image)  
200 -# self.set_header("Content-Type", content_type[0])  
201 -  
202 -# # divide the file into chunks and write one chunk at a time, so  
203 -# # that the write does not block the ioloop for very long.  
204 -# with f:  
205 -# chunk = f.read(self.chunk_size)  
206 -# while chunk:  
207 -# try:  
208 -# self.write(chunk) # write the cunk to response  
209 -# await self.flush() # flush the current chunk to socket  
210 -# except iostream.StreamClosedError:  
211 -# break # client closed the connection  
212 -# finally:  
213 -# del chunk  
214 -# await asyncio.sleep(0)  
215 -# chunk = f.read(self.chunk_size)  
216 -  
217 -# raise tornado.web.HTTPError(status_code=404) # Not Found  
218 -  
219 -  
220 # ------------------------------------------------------------------------- 172 # -------------------------------------------------------------------------
221 # Test shown to students 173 # Test shown to students
222 # ------------------------------------------------------------------------- 174 # -------------------------------------------------------------------------
@@ -243,7 +195,6 @@ class TestHandler(BaseHandler): @@ -243,7 +195,6 @@ class TestHandler(BaseHandler):
243 @tornado.web.authenticated 195 @tornado.web.authenticated
244 async def get(self): 196 async def get(self):
245 uid = self.current_user 197 uid = self.current_user
246 - print(uid)  
247 t = self.testapp.get_student_test(uid) # reload page returns same test 198 t = self.testapp.get_student_test(uid) # reload page returns same test
248 if t is None: 199 if t is None:
249 t = await self.testapp.generate_test(uid) 200 t = await self.testapp.generate_test(uid)