author | Arthur Lutz <arthur.lutz@logilab.fr> |
Fri, 31 Jan 2020 16:52:24 +0100 | |
branch | 3.27 |
changeset 12861 | 1983923e51cc |
parent 12795 | 30448f475a35 |
permissions | -rw-r--r-- |
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
1 |
# copyright 2019 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
3 |
# |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
4 |
# This file is part of CubicWeb. |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
5 |
# |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
9 |
# any later version. |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
10 |
# |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
14 |
# details. |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
15 |
# |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
18 |
|
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
19 |
from pyramid_debugtoolbar.panels import DebugPanel |
12776
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
20 |
|
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
21 |
from cubicweb.debug import subscribe_to_debug_channel, unsubscribe_to_debug_channel |
12777
7c4216ed7497
[debug-toolbar/display_source_code] add links to files in tracebacks
Laurent Peuch <cortex@worlddomination.be>
parents:
12776
diff
changeset
|
22 |
from cubicweb.misc.source_highlight import highlight_html, generate_css, has_pygments |
7c4216ed7497
[debug-toolbar/display_source_code] add links to files in tracebacks
Laurent Peuch <cortex@worlddomination.be>
parents:
12776
diff
changeset
|
23 |
from cubicweb.pyramid.debug_source_code import source_code_url, source_code_url_in_stack |
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
24 |
|
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
25 |
|
12764
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
26 |
class CubicWebDebugPanel(DebugPanel): |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
27 |
""" |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
28 |
CubicWeb general debug panel |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
29 |
""" |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
30 |
|
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
31 |
""" |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
32 |
Excepted formats: |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
33 |
Controller: { |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
34 |
"kind": ctrlid, |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
35 |
"request": req, |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
36 |
"path": req.path, |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
37 |
"controller": controller, |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
38 |
} |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
39 |
""" |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
40 |
|
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
41 |
name = 'CubicWeb' |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
42 |
nav_title = 'CubicWeb' |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
43 |
title = 'CubicWeb general panel' |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
44 |
|
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
45 |
has_content = True |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
46 |
template = 'cubicweb.pyramid:debug_toolbar_templates/cw.dbtmako' |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
47 |
|
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
48 |
def __init__(self, request): |
12776
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
49 |
self.data = { |
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
50 |
'controller': None, |
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
51 |
'source_code_url': source_code_url, |
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
52 |
} |
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
53 |
|
12764
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
54 |
subscribe_to_debug_channel("controller", self.collect_controller) |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
55 |
|
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
56 |
def collect_controller(self, controller): |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
57 |
self.data["controller"] = controller |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
58 |
|
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
59 |
def process_response(self, response): |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
60 |
unsubscribe_to_debug_channel("controller", self.collect_controller) |
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
61 |
|
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
62 |
|
12768
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
63 |
class RegistryDecisionsDebugPanel(DebugPanel): |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
64 |
""" |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
65 |
CubicWeb registry decisions debug panel |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
66 |
""" |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
67 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
68 |
name = 'RegistryDecisions' |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
69 |
title = 'Registry Decisions' |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
70 |
nav_title = 'Registry Decisions' |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
71 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
72 |
has_content = True |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
73 |
template = 'cubicweb.pyramid:debug_toolbar_templates/registry_decisions.dbtmako' |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
74 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
75 |
def __init__(self, request): |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
76 |
# clear on every new response |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
77 |
self.data = { |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
78 |
'registry_decisions': [], |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
79 |
'vreg': None, |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
80 |
'highlight': highlight_html, |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
81 |
'generate_css': generate_css, |
12776
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
82 |
'source_code_url': source_code_url, |
12768
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
83 |
} |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
84 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
85 |
subscribe_to_debug_channel("vreg", self.collect_vreg) |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
86 |
subscribe_to_debug_channel("registry_decisions", self.collect_registry_decisions) |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
87 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
88 |
def collect_vreg(self, message): |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
89 |
self.data["vreg"] = message["vreg"] |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
90 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
91 |
def collect_registry_decisions(self, decision): |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
92 |
# decision = { |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
93 |
# "all_objects": [], |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
94 |
# "end_score": int, |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
95 |
# "winners": [], |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
96 |
# "registry": obj, |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
97 |
# "args": args, |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
98 |
# "kwargs": kwargs, |
12795
30448f475a35
[comment] comment didn't matched reality
Laurent Peuch <cortex@worlddomination.be>
parents:
12777
diff
changeset
|
99 |
# "self": registry, |
12768
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
100 |
# } |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
101 |
decision["key"] = None |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
102 |
self.data["registry_decisions"].append(decision) |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
103 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
104 |
def link_registry_to_their_key(self): |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
105 |
if self.data["vreg"]: |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
106 |
# use "id" here to be hashable |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
107 |
registry_to_key = {id(registry): key for key, registry in self.data["vreg"].items()} |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
108 |
for decision in self.data["registry_decisions"]: |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
109 |
decision["key"] = registry_to_key.get(id(decision["self"])) |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
110 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
111 |
def process_response(self, response): |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
112 |
unsubscribe_to_debug_channel("registry_decisions", self.collect_registry_decisions) |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
113 |
unsubscribe_to_debug_channel("vreg", self.collect_vreg) |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
114 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
115 |
self.link_registry_to_their_key() |
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
116 |
|
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
117 |
|
12766
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
118 |
class RegistryDebugPanel(DebugPanel): |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
119 |
""" |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
120 |
CubicWeb registry content and decisions debug panel |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
121 |
""" |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
122 |
|
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
123 |
name = 'Registry' |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
124 |
title = 'Registry Store' |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
125 |
nav_title = 'Registry Store' |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
126 |
|
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
127 |
has_content = True |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
128 |
template = 'cubicweb.pyramid:debug_toolbar_templates/registry.dbtmako' |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
129 |
|
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
130 |
def __init__(self, request): |
12776
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
131 |
self.data = { |
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
132 |
'vreg': None, |
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
133 |
'source_code_url': source_code_url, |
3cbcbaead477
[debug-toolbar] link to source code of all objects/classes
Laurent Peuch <cortex@worlddomination.be>
parents:
12768
diff
changeset
|
134 |
} |
12766
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
135 |
subscribe_to_debug_channel("vreg", self.collect_vreg) |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
136 |
|
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
137 |
def collect_vreg(self, message): |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
138 |
self.data["vreg"] = message["vreg"] |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
139 |
|
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
140 |
def process_response(self, response): |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
141 |
unsubscribe_to_debug_channel("vreg", self.collect_vreg) |
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
142 |
|
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
143 |
|
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
144 |
class RQLDebugPanel(DebugPanel): |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
145 |
""" |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
146 |
CubicWeb RQL debug panel |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
147 |
""" |
12761
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
148 |
|
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
149 |
""" |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
150 |
Excepted formats: |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
151 |
SQL: { |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
152 |
'rql_query_tracing_token': 'some_token', |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
153 |
'args': {dict with some args}, |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
154 |
'rollback': False|True, |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
155 |
'time': time_in_float, |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
156 |
'sql':_sql_query_as_a_string, |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
157 |
} |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
158 |
""" |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
159 |
|
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
160 |
name = 'RQL' |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
161 |
title = 'RQL queries' |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
162 |
nav_title = 'RQL' |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
163 |
nav_subtitle_style = 'progress-bar-info' |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
164 |
|
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
165 |
has_content = True |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
166 |
template = 'cubicweb.pyramid:debug_toolbar_templates/rql.dbtmako' |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
167 |
|
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
168 |
def __init__(self, request): |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
169 |
self.data = { |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
170 |
'rql_queries': [], |
12761
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
171 |
'sql_queries': [], |
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
172 |
'highlight': highlight_html, |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
173 |
'generate_css': generate_css, |
12777
7c4216ed7497
[debug-toolbar/display_source_code] add links to files in tracebacks
Laurent Peuch <cortex@worlddomination.be>
parents:
12776
diff
changeset
|
174 |
'has_pygments': has_pygments, |
7c4216ed7497
[debug-toolbar/display_source_code] add links to files in tracebacks
Laurent Peuch <cortex@worlddomination.be>
parents:
12776
diff
changeset
|
175 |
'source_code_url_in_stack': source_code_url_in_stack, |
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
176 |
} |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
177 |
subscribe_to_debug_channel("rql", self.collect_rql_queries) |
12761
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
178 |
subscribe_to_debug_channel("sql", self.collect_sql_queries) |
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
179 |
|
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
180 |
@property |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
181 |
def nav_subtitle(self): |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
182 |
return '%d' % len(self.data['rql_queries']) |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
183 |
|
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
184 |
def collect_rql_queries(self, rql_query): |
12761
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
185 |
rql_query["generated_sql_queries"] = [] |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
186 |
|
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
187 |
# link sql queries to rql's one |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
188 |
for sql_query in self.data["sql_queries"]: |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
189 |
if sql_query["rql_query_tracing_token"] == rql_query["rql_query_tracing_token"]: |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
190 |
rql_query["generated_sql_queries"].append(sql_query) |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
191 |
|
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
192 |
self.data["rql_queries"].append(rql_query) |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
193 |
|
12761
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
194 |
def collect_sql_queries(self, sql_query): |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
195 |
self.data["sql_queries"].append(sql_query) |
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
196 |
|
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
197 |
def process_response(self, response): |
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
198 |
unsubscribe_to_debug_channel("rql", self.collect_rql_queries) |
12761
10b8352b0208
[debug-toolbar/rql] display sql queries generated by rql ones
Laurent Peuch <cortex@worlddomination.be>
parents:
12760
diff
changeset
|
199 |
unsubscribe_to_debug_channel("sql", self.collect_sql_queries) |
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
200 |
|
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
201 |
|
12765
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
202 |
class SQLDebugPanel(DebugPanel): |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
203 |
""" |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
204 |
CubicWeb SQL debug panel |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
205 |
""" |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
206 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
207 |
""" |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
208 |
Excepted formats: |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
209 |
SQL: { |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
210 |
'rql_query_tracing_token': 'some_token', |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
211 |
'args': {dict with some args}, |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
212 |
'rollback': False|True, |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
213 |
'time': time_in_float, |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
214 |
'sql':_sql_query_as_a_string, |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
215 |
} |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
216 |
""" |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
217 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
218 |
name = 'SQL' |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
219 |
title = 'SQL queries' |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
220 |
nav_title = 'SQL' |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
221 |
nav_subtitle_style = 'progress-bar-info' |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
222 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
223 |
has_content = True |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
224 |
template = 'cubicweb.pyramid:debug_toolbar_templates/sql.dbtmako' |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
225 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
226 |
def __init__(self, request): |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
227 |
self.data = { |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
228 |
'rql_queries': [], |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
229 |
'sql_queries': [], |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
230 |
'highlight': highlight_html, |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
231 |
'generate_css': generate_css, |
12777
7c4216ed7497
[debug-toolbar/display_source_code] add links to files in tracebacks
Laurent Peuch <cortex@worlddomination.be>
parents:
12776
diff
changeset
|
232 |
'has_pygments': has_pygments, |
7c4216ed7497
[debug-toolbar/display_source_code] add links to files in tracebacks
Laurent Peuch <cortex@worlddomination.be>
parents:
12776
diff
changeset
|
233 |
'source_code_url_in_stack': source_code_url_in_stack, |
12765
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
234 |
} |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
235 |
subscribe_to_debug_channel("rql", self.collect_rql_queries) |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
236 |
subscribe_to_debug_channel("sql", self.collect_sql_queries) |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
237 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
238 |
@property |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
239 |
def nav_subtitle(self): |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
240 |
return len(self.data['sql_queries']) |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
241 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
242 |
def collect_rql_queries(self, rql_query): |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
243 |
self.data["rql_queries"].append(rql_query) |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
244 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
245 |
# link sql queries to rql's one |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
246 |
for sql_query in self.data["sql_queries"]: |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
247 |
if sql_query["rql_query_tracing_token"] == rql_query["rql_query_tracing_token"]: |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
248 |
sql_query["from_rql_query"] = rql_query |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
249 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
250 |
def collect_sql_queries(self, sql_query): |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
251 |
sql_query["from_rql_query"] = None |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
252 |
self.data["sql_queries"].append(sql_query) |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
253 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
254 |
def process_response(self, response): |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
255 |
unsubscribe_to_debug_channel("rql", self.collect_rql_queries) |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
256 |
unsubscribe_to_debug_channel("sql", self.collect_sql_queries) |
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
257 |
|
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
258 |
|
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
259 |
def includeme(config): |
12764
fb97669efcaa
[debug-toolbar] add cw general panel with controller
Laurent Peuch <cortex@worlddomination.be>
parents:
12763
diff
changeset
|
260 |
config.add_debugtoolbar_panel(CubicWebDebugPanel) |
12768
7d2c61d40fe9
[debug-toolbar] add registry decisions debug panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12766
diff
changeset
|
261 |
config.add_debugtoolbar_panel(RegistryDecisionsDebugPanel) |
12766
682d0790997f
[debug-toolbar] add registry panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12765
diff
changeset
|
262 |
config.add_debugtoolbar_panel(RegistryDebugPanel) |
12760
d5ae5abd0876
[debug-toolbar/rql] add RQL panel
Laurent Peuch <cortex@worlddomination.be>
parents:
diff
changeset
|
263 |
config.add_debugtoolbar_panel(RQLDebugPanel) |
12765
771c99f16780
[debug-toolbar] add sql panel
Laurent Peuch <cortex@worlddomination.be>
parents:
12764
diff
changeset
|
264 |
config.add_debugtoolbar_panel(SQLDebugPanel) |