public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: PATCH: To fix the issue in Debugger module (pgAdmin4)
Date: Tue, 27 Sep 2016 12:10:40 +0530
Message-ID: <CAKKotZSjyeZT_bS8_No-cEftRjqPPptLx+zV2+_DqV=KYZYRcw@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxoyzS4_cST0qJ7CbmxqOry4wGZCQkoiLpcXgjr2N4snPQw@mail.gmail.com>
References: <CAKKotZQz6mGEiky_Szo91tzm_RFvwJTYGriTmuxVYrhcWi5nJg@mail.gmail.com>
<CA+OCxoxkphr1YF6F53j3sTreTMvoBOKqV+wjF6CnxoQ-SA+rzA@mail.gmail.com>
<CAKKotZRMetEEPzFTuqiw_8Vit2_STHSN22=K+5frJBu7=Jp6PQ@mail.gmail.com>
<CAKKotZQGdhiFrtNK0xz8OVLKOA2QCk_yfOZDFT+HEMfELzbk4A@mail.gmail.com>
<CA+OCxoyzS4_cST0qJ7CbmxqOry4wGZCQkoiLpcXgjr2N4snPQw@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi Dave,
PFA updated patch to fix mentioned issue as well as incremental msgs
updates in Messages Tab.
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Mon, Sep 26, 2016 at 6:24 PM, Dave Page <[email protected]> wrote:
> On Mon, Sep 26, 2016 at 1:28 PM, Murtuza Zabuawala
> <[email protected]> wrote:
> > Hi Dave,
> >
> > PFA updated patch to fix `<br>` tag display.
> > Please clear cache & try again with this updated patch.
>
> OK, that fixes the display issue. Regarding the error message, on this
> execution I noticed the following exception:
>
> 2016-09-26 13:52:48,181: INFO werkzeug: 127.0.0.1 - - [26/Sep/2016
> 13:52:48] "GET /debugger/poll_end_execution_result/3629301/ HTTP/1.1"
> 500 -
> Traceback (most recent call last):
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 2000, in __call__
> return self.wsgi_app(environ, start_response)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1991, in wsgi_app
> response = self.make_response(self.handle_exception(e))
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1567, in handle_exception
> reraise(exc_type, exc_value, tb)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1988, in wsgi_app
> response = self.full_dispatch_request()
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1641, in full_dispatch_request
> rv = self.handle_user_exception(e)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1544, in handle_user_exception
> reraise(exc_type, exc_value, tb)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1639, in full_dispatch_request
> rv = self.dispatch_request()
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1625, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask_login.py",
> line 792, in decorated_view
> return func(*args, **kwargs)
> File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/debugger/__init__.py",
> line 1365, in poll_end_execution_result
> statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg
> TypeError: cannot concatenate 'str' and 'NoneType' objects
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] RM_1227_v2.patch (6.7K, 3-RM_1227_v2.patch)
download | inline diff:
diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py
index f7d0e7b..6543b13 100644
--- a/web/pgadmin/tools/debugger/__init__.py
+++ b/web/pgadmin/tools/debugger/__init__.py
@@ -1343,8 +1343,16 @@ def poll_end_execution_result(trans_id):
if conn.connected():
statusmsg = conn.status_message()
status, result, col_info = conn.poll()
- if status == ASYNC_OK and session['functionData'][str(trans_id)]['language'] == 'edbspl':
+ if status == ASYNC_OK and \
+ not session['functionData'][str(trans_id)]['is_func'] and \
+ session['functionData'][str(trans_id)]['language'] == 'edbspl':
status = 'Success'
+ additional_msgs = conn.messages()
+ if len(additional_msgs) > 0:
+ if statusmsg and statusmsg == 'SELECT 1':
+ statusmsg = ''
+ statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg if statusmsg is not None else ''
+
return make_json_response(success=1, info=gettext("Execution Completed."),
data={'status': status, 'status_message': statusmsg})
if result:
@@ -1354,6 +1362,12 @@ def poll_end_execution_result(trans_id):
data={'status': status, 'status_message': result})
else:
status = 'Success'
+ additional_msgs = conn.messages()
+ if len(additional_msgs) > 0:
+ if statusmsg and statusmsg == 'SELECT 1':
+ statusmsg = ''
+ statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg if statusmsg is not None else ''
+
columns = []
# Check column info is available or not
if col_info is not None and len(col_info) > 0:
@@ -1369,6 +1383,12 @@ def poll_end_execution_result(trans_id):
'col_info': columns, 'status_message': statusmsg})
else:
status = 'Busy'
+ additional_msgs = conn.messages()
+ if len(additional_msgs) > 0:
+ if statusmsg and statusmsg == 'SELECT 1':
+ statusmsg = ''
+ statusmsg = "<br>".join(additional_msgs) + "<br>" + statusmsg if statusmsg is not None else ''
+ return make_json_response(data={'status': status, 'result': result, 'status_message': statusmsg})
else:
status = 'NotConnected'
result = gettext('Not connected to server or connection with the server has been closed.')
diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js
index 452617b..babd00c 100644
--- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js
+++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js
@@ -392,6 +392,7 @@ define(
url: baseUrl,
method: 'GET',
success: function(res) {
+ var old_msgs='', new_msgs='';
if (res.data.status === 'Success') {
if(res.data.result == undefined ) {
/*
@@ -411,7 +412,15 @@ define(
);
// Update the message tab of the debugger
- pgTools.DirectDebug.dbmsMessages.$elem.text(res.data.status_message);
+ if (res.data.status_message) {
+ old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html();
+ if(old_msgs) {
+ new_msgs = (old_msgs + '\n' + res.data.status_message).replace(/(?:\r\n|\r|\n)/g, '<br />');
+ } else {
+ new_msgs = res.data.status_message;
+ }
+ pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs);
+ }
// Execution completed so disable the buttons other than "Continue/Start" button because user can still
// start the same execution again.
@@ -439,7 +448,15 @@ define(
);
// Update the message tab of the debugger
- pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message);
+ if (res.data.status_message) {
+ old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html();
+ if(old_msgs) {
+ new_msgs = (old_msgs + '\n' + res.data.status_message).replace(/(?:\r\n|\r|\n)/g, '<br />');
+ } else {
+ new_msgs = res.data.status_message;
+ }
+ pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs);
+ }
// Execution completed so disable the buttons other than "Continue/Start" button because user can still
// start the same execution again.
@@ -454,6 +471,16 @@ define(
else if (res.data.status === 'Busy') {
// If status is Busy then poll the result by recursive call to the poll function
//self.poll_end_execution_result(trans_id);
+ // Update the message tab of the debugger
+ if(res.data.status_message) {
+ old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html();
+ if(old_msgs) {
+ new_msgs = (old_msgs + '\n' + res.data.status_message).replace(/(?:\r\n|\r|\n)/g, '<br />');
+ } else {
+ new_msgs = res.data.status_message;
+ }
+ pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs);
+ }
}
else if (res.data.status === 'NotConnected') {
Alertify.alert(
@@ -473,7 +500,16 @@ define(
function() { }
);
- pgTools.DirectDebug.messages_panel.$container.find('.messages').text(res.data.status_message);
+ if (res.data.status_message) {
+ old_msgs = pgTools.DirectDebug.messages_panel.$container.find('.messages').html();
+ if(old_msgs) {
+ new_msgs = (old_msgs + '\n' + res.data.status_message).replace(/(?:\r\n|\r|\n)/g, '<br />');
+ } else {
+ new_msgs = res.data.status_message;
+ }
+ pgTools.DirectDebug.messages_panel.$container.find('.messages').html(new_msgs);
+ }
+
pgTools.DirectDebug.messages_panel.focus();
// Execution completed so disable the buttons other than "Continue/Start" button because user can still
view thread (21+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: PATCH: To fix the issue in Debugger module (pgAdmin4)
In-Reply-To: <CAKKotZSjyeZT_bS8_No-cEftRjqPPptLx+zV2+_DqV=KYZYRcw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox