source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/applications/admin/controllers/toolbar.py

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100755
File size: 774 bytes
Line 
1import os
2from gluon.settings import global_settings, read_file
3#
4
5
6def index():
7    app = request.args(0)
8    return dict(app=app)
9
10
11def profiler():
12    """
13    to use the profiler start web2py with -F profiler.log
14    """
15    KEY = 'web2py_profiler_size'
16    filename = global_settings.cmd_options.profiler_filename
17    data = 'profiler disabled'
18    if filename:
19        if  KEY in request.cookies:
20            size = int(request.cookies[KEY].value)
21        else:
22            size = 0
23        if os.path.exists(filename):
24            data = read_file('profiler.log', 'rb')
25            if size < len(data):
26                data = data[size:]
27            else:
28                size = 0
29            size += len(data)
30            response.cookies[KEY] = size
31    return data
Note: See TracBrowser for help on using the repository browser.