Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# test whether this can be opened with pstats
try:
pstats.Stats(sfilename)
except:
os.remove(sfilename)
error = 'There was an error parsing {0} with pstats.'
error = error.format(filename)
self.render('upload.html', error=error)
else:
self.redirect('viz/' + filename)
class JSONHandler(handler.Handler):
"""
Handler for requesting the JSON representation of a profile.
"""
_timer = None
_pool = None
_timeout = None
_result = None
@asynchronous
def get(self, prof_name):
if self.request.path.startswith('/json/file/'):
if self.settings['single_user_mode']:
if prof_name[0] != '/' and platform.system() != 'Windows':
prof_name = '/' + prof_name
filename = os.path.abspath(prof_name)