public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin4][patch] sqleditor connection status minor patch
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin4][patch] sqleditor connection status minor patch
@ 2018-06-05 04:49 Aditya Toshniwal <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Toshniwal @ 2018-06-05 04:49 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
PFA a minor patch for sqleditor. When you disconnect the server with an
open sqleditor tab, exception occurs at the back end. Also, after
connecting server, the sqleditor is not able to connect back because of the
exception. The patch is to handle it.
Kindly review.
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"
Attachments:
[text/x-patch] sqleditor_conn_status.patch (1.5K, 3-sqleditor_conn_status.patch)
download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py
index 013e4dc..a9460dd 100644
--- a/web/pgadmin/tools/sqleditor/__init__.py
+++ b/web/pgadmin/tools/sqleditor/__init__.py
@@ -1480,19 +1480,24 @@ def query_tool_status(trans_id):
if conn and trans_obj and session_obj:
status = conn.transaction_status()
- # Check for the asynchronous notifies statements.
- conn.check_notifies(True)
- notifies = conn.get_notifies()
+ if status is not None:
+ # Check for the asynchronous notifies statements.
+ conn.check_notifies(True)
+ notifies = conn.get_notifies()
- return make_json_response(
- data={
- 'status': status,
- 'message': gettext(
- CONNECTION_STATUS_MESSAGE_MAPPING.get(status),
- ),
- 'notifies': notifies
- }
- )
+ return make_json_response(
+ data={
+ 'status': status,
+ 'message': gettext(
+ CONNECTION_STATUS_MESSAGE_MAPPING.get(status),
+ ),
+ 'notifies': notifies
+ }
+ )
+ else:
+ return internal_server_error(
+ errormsg=gettext("Transaction status check failed.")
+ )
else:
return internal_server_error(
errormsg=gettext("Transaction status check failed.")
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin4][patch] sqleditor connection status minor patch
@ 2018-06-05 10:58 Dave Page <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Page @ 2018-06-05 10:58 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers
Thanks, applied.
On Tue, Jun 5, 2018 at 5:49 AM, Aditya Toshniwal <
[email protected]> wrote:
> Hi Hackers,
>
> PFA a minor patch for sqleditor. When you disconnect the server with an
> open sqleditor tab, exception occurs at the back end. Also, after
> connecting server, the sqleditor is not able to connect back because of the
> exception. The patch is to handle it.
> Kindly review.
>
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-06-05 10:58 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 04:49 [pgAdmin4][patch] sqleditor connection status minor patch Aditya Toshniwal <[email protected]>
2018-06-05 10:58 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox