[pgAdmin][RM4419] Debugger does not work on python 2.7

Aditya Toshniwal <[email protected]>
Newsgroups gmane.comp.db.postgresql.pgadmin.devel
Message-ID <CAM9w-_myicDVGWdtedV4zipjPB5_jmC9pvsLBoO432cyLjUsyg@mail.gmail.com>
Hi Hackers,

Attached is the patch to fix an issue where debugger throws error and
doesn't work when using Python 2.7.
Also fixed a small issue where reload warning was thrown on closing
debugger, which should applicable only if opened in new tab.

Kindly review.

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
RM4419.patch (application/octet-stream, 1.6 KB)
diff --git a/web/pgadmin/tools/debugger/static/js/direct.js b/web/pgadmin/tools/debugger/static/js/direct.js
index fab16604..123b9cf1 100644
--- a/web/pgadmin/tools/debugger/static/js/direct.js
+++ b/web/pgadmin/tools/debugger/static/js/direct.js
@@ -1541,8 +1541,6 @@ define([
         });
       this.panels = [];
 
-      pgBrowser.bind_beforeunload();
-
       // Below code will be executed for indirect debugging
       // indirect debugging - 0  and for direct debugging - 1
       if (trans_id != undefined && !debug_type) {
@@ -1853,6 +1851,7 @@ define([
                * instead, a poller is set up who will check
                */
               if(self.preferences.debugger_new_browser_tab) {
+                pgBrowser.bind_beforeunload();
                 let pollIntervalId = setInterval(()=>{
                   if(window.opener && window.opener.pgAdmin) {
                     self.reflectPreferences();
diff --git a/web/pgadmin/tools/debugger/utils/debugger_instance.py b/web/pgadmin/tools/debugger/utils/debugger_instance.py
index 82d79f6e..66393801 100644
--- a/web/pgadmin/tools/debugger/utils/debugger_instance.py
+++ b/web/pgadmin/tools/debugger/utils/debugger_instance.py
@@ -14,12 +14,12 @@ import random
 debugger_sessions_lock = Lock()
 
 
-class DebuggerInstance:
+class DebuggerInstance(object):
     def __init__(self, trans_id=None):
         if trans_id is None:
             self._trans_id = str(random.randint(1, 9999999))
         else:
-            self._trans_id = trans_id
+            self._trans_id = str(trans_id)
 
         self._function_data = None
         self._debugger_data = None
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.