source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/applications/admin/views/debug/interact.html

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: 8.2 KB
Line 
1{{extend 'layout.html'}}
2{{block sectionclass}}debug{{end}}
3<!-- begin "debug" block -->
4<div class="row-fluid">
5    <div class="applist f60 span7" style="padding-bottom:20px;">
6      <div class="applist_inner">
7        <h2>{{=T("web2py online debugger")}}</h2>
8        {{if filename:}}
9            <h3 style="word-wrap:break-word;">{{=T("Interaction at %s line %s") % (filename, lineno)}}</h3>
10            {{if exception:}}
11                  <h3 class="exception">{{=T("Exception %s", exception['title'])}}</h3>
12            {{pass}}
13                <h5>{{=T("Code listing")}}</h5>
14                {{if lines:}}<div class="inspect" style="width:100%;overflow:auto;background-color:whiteSmoke;margin-bottom:20px;">
15                <pre>{{=CODE('\n'.join([x[1] for x in sorted(lines.items(),key=lambda x: x[0])]),
16                        language='python', link=None, counter=min(lines.keys()),
17                        highlight_line=lineno, context_lines=10)}}</pre></div>
18                {{pass}}
19            <div class="row-fluid">
20                <div class="help span7 alert alert-block alert-info">
21                  <ul class="unstyled">
22                    <li>{{=T("Your application will be blocked until you click an action button (next, step, continue, etc.)")}}</li>
23                    <li>{{=T("You can inspect variables using the console below")}}</li>
24                  </ul>
25                </div>
26            </div>
27            <h3>{{=T("Interactive console")}}</h3>
28            <div class="shell"><div id="wrapper">
29                <div class="row-fluid">
30                    <div class="output-wrapper span11">
31                        <textarea id="output" readonly="readonly">{{=data}}</textarea>
32                    </div>
33                </div>
34                <div class="row-fluid">
35                    <form id="form" action="{{=URL(r=request, f='callback', args=app)}}" method="get" class="span11">
36                        <div id="shellwrapper">
37                            <div class="prompt-wrapper">
38                                <div class="prompt-container">
39                                    <textarea class="prompt" name="statement" id="statement"></textarea>
40                                </div>
41                                <a href="#" rel="tooltip" data-placement="right" data-original-title="{{=T('Type some Python code in here and hit Return (Enter) to execute it.')}}">
42                                    {{=helpicon()}}
43                                    <span>Type some Python code in here and hit Return (Enter) to execute it.</span>
44                                </a>
45                            </div>
46                            <div id="caret"><span>&gt;&gt;&gt;</span></div>
47                            <div id="autoscroll">autoscroll</div>
48                        </div>
49                    </form>
50                </div>
51            </div></div>
52        {{elif request.env.get('wsgi_multiprocess') or not request.env.get('wsgi_multithread'):}}
53              <h3 class="not_paused">{{=T("Unsupported webserver working mode: %s", request.env.get('server_software', ''))}}</h3>
54                <div class="help span7 alert alert-block alert-info">
55                  <ul class="unstyled">
56                    <li><b>{{=T("WARNING:")}} </b>{{=T("This debugger may not work properly if you don't have a threaded webserver or you're using multiple daemon processes.")}}</li>
57                    <li>{{=T("In development, use the default Rocket webserver that is currently supported by this debugger.")}}</li>
58                    <li>{{=T("On production, you'll have to configure your webserver to use one process and multiple threads to use this debugger.")}}</li>
59                  </ul>
60                </div>
61                {{#=BEAUTIFY(request.env)}}
62        {{else:}}
63              <h3 class="not_paused">{{=T("No Interaction yet")}}</h3>
64                <div class="help span7 alert alert-block alert-info">
65                  <ul class="unstyled">
66                    <li>{{=T.M('You need to set up and reach a [[breakpoint %s]] to use the debugger!') % URL('breakpoints')}}</li>
67                    <li>{{=T('To emulate a breakpoint programatically, write:')}}
68                    {{=CODE("from gluon.debug import dbg\n"
69                            "dbg.set_trace() # stop here!\n",
70                            counter=None)}}</li>
71                    <li>{{=T.M('Please [[refresh %s]] this page to see if a breakpoint was hit and debug interaction is required.') %URL('interact')}}</li>
72                  </ul>
73                </div>
74        {{pass}}
75      </div>
76    </div> <!-- /applist -->
77    <div class="sidebar fl60 span5">
78      <div class="sidebar_inner controls" style="margin:0;">
79        <span class="pwdchange pull-right">
80            {{if filename:}}
81                {{=sp_button(URL('step'), T("step"))}}
82                {{=sp_button(URL('next'), T("next"))}}
83                {{=sp_button(URL('ret'), T("return"))}}
84                {{=sp_button(URL('cont'), T("continue"))}}
85                {{=sp_button(URL('stop'), T("stop"))}}
86            {{pass}}
87                {{=button(URL('breakpoints'), T("breakpoints"))}}
88        </span>
89
90        {{if exception:}}
91            <div class="box">
92              <h3>{{=T('Exception %(extype)s: %(exvalue)s', dict(extype=exception['extype'], exvalue=exception['exvalue']))}}</h3>
93              <div class="formfield">
94                   {{=CODE((exception['request']), counter=None)}}
95              </div>
96            </div>
97        {{pass}}
98
99        <div class="box">
100          <h3>{{=T('Locals##debug')}}</h3>
101          <div class="formfield">
102        {{=BEAUTIFY(f_locals)}}
103          </div>
104        </div>
105        <div class="box">
106          <h3>{{=T('Globals##debug')}}</h3>
107          <div class="formfield">
108        {{=BEAUTIFY(f_globals)}}
109          </div>
110        </div>
111      </div>
112    </div>
113
114    <script src="{{=URL('static', 'js/autoscroll.js')}}"></script>
115
116    <script type="text/javascript">
117    var bShellScrolling=0
118    jQuery(document).ready(function(){
119      // jQuery('#statement').focus();  // not usefull most times...
120
121      jQuery('#statement').keyup(function(event){
122        var t=jQuery(this),
123        s=t.val(),
124        o=jQuery('#output'),
125        RETURN = 38;
126        if(s=='\n') t.val('');
127        if(s.length>1 && s.substr(s.length-1,1)=='\n' && s.substr(s.length-2,1)!=':' &&
128        (s.indexOf(':\n ')<0 || s.substr(s.length-2,1)=='\n')) {
129          t.val('');
130          jQuery.post("{{=URL(r=request,f='execute',args=app)}}",
131          {statement:s},function(data){o.html(o.html()+data).attr('scrollTop',o.attr('scrollHeight'));});
132        } else { };
133        if(event.keyCode==RETURN){
134          var i=s.length
135          if(i==0){
136            var s=o.find('table:last pre:first').text();
137            bShellScrolling=o.find('table').length;
138          }else if(bShellScrolling){
139            var i=bShellScrolling
140            if(i<1){
141              return
142            }else{
143              i--
144              var s=o.find('table:nth-child('+(i)+') pre:first').text();
145              bShellScrolling=i
146            }
147          }else if(s.indexOf('\n')<0){
148            var oo=o.find('tr:first-child pre:contains("'+s+'")')
149            if(oo.length==0){
150              return
151            }else if(oo.length==1){
152              s=oo.text();
153            }else{
154              sVar=oo.text();
155              o.html(o.html()+'<dd>'+s+' ?</dd><dt>'+sVar+'</dt>').attr('scrollTop',o.attr('scrollHeight'))
156              return
157            }
158          }else{
159            //multistring expr
160            return;
161          }
162          //  if(s.slice(s.length-1)=='\n'){
163          s=s.slice(0,s.length-1)
164          //    }
165          t.val(s);
166        }
167        if(bShellScrolling && event.keyCode==40){
168          var i=bShellScrolling
169          i++
170          var s=o.find('table:nth-child('+i+') tr:first-child pre').text();
171          if(s){
172            s=s.slice(0,s.length-1)
173            t.val(s);
174            bShellScrolling=i
175          }else{
176            bShellScrolling=0
177            t.val('')
178          }
179        };
180        if(bShellScrolling && (event.keyCode==37 || event.keyCode==39)){
181          bShellScrolling=0;
182        };
183        if(event.keyCode==27){
184          bShellScrolling=0;
185          t.val('');
186        };
187      });
188    });
189    </script>
190</div>
191<!-- end "debug" block -->
Note: See TracBrowser for help on using the repository browser.