Hi Team,

Please find patches for below issues,

1) Login Issue fixed, As encryption/decryption returns output in bytes
datatype it fails to authenticate in python3.
2) Added NoneType exception handling in settings & server modules while
returning json response.
3) Updated module for python3 in requirements file.

Please review my changes & do the needful.


Regards,
Murtuza Zabuawala
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 8125bfe..c524c1f 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -98,6 +98,9 @@ class Connection(BaseConnection):
                 return unauthorized(gettext("Unauthorized Request."))
 
             password = decrypt(encpass, user.password)
+            # password is in bytes, for python3 we need it in string
+            if isinstance(password, bytes):
+                password = password.decode()
 
         try:
             import os
diff --git a/requirements_py2.txt b/requirements_py2.txt
index c7b1d4c..45f827a 100644
--- a/requirements_py2.txt
+++ b/requirements_py2.txt
@@ -26,4 +26,3 @@ six==1.9.0
 speaklater==1.3
 pycrypto==2.6.1
 wsgiref==0.1.2
-pycrypto==2.6.1
diff --git a/requirements_py3.txt b/requirements_py3.txt
index 5b9bc90..45ebdd8 100644
--- a/requirements_py3.txt
+++ b/requirements_py3.txt
@@ -14,7 +14,7 @@ SQLAlchemy==0.9.8
 WTForms==2.0.2
 Werkzeug==0.9.6
 argparse==1.3.0
-beautifulsoup4==4.3.2
+beautifulsoup4==4.4.1
 blinker==1.3
 django-htmlmin==0.8.0
 html5lib==1.0b3
@@ -24,4 +24,4 @@ psycopg2==2.5.2
 pytz==2014.10
 six==1.9.0
 speaklater==1.3
-pycrypto==2.6.1
+pycrypto==2.6.1
\ No newline at end of file
diff --git a/web/pgadmin/settings/__init__.py b/web/pgadmin/settings/__init__.py
index 99359b3..2cbbf32 100644
--- a/web/pgadmin/settings/__init__.py
+++ b/web/pgadmin/settings/__init__.py
@@ -75,9 +75,15 @@ def store(setting=None, value=None):
         success = 0
         errormsg = e.message
 
+    try:
+        info = traceback.format_exc()
+    except Exception as e:
+        info = str(e)
+
+
     return make_json_response(success=success,
                               errormsg=errormsg,
-                              info=traceback.format_exc(),
+                              info=info,
                               result=request.form)
 
 @blueprint.route("/get", methods=['POST'])
@@ -100,7 +106,12 @@ def get(setting=None, default=None):
         success = 0
         errormsg = e.message
 
+    try:
+        info = traceback.format_exc()
+    except Exception as e:
+        info = str(e)
+
     return make_json_response(success=success,
                               errormsg=errormsg,
-                              info=traceback.format_exc(),
+                              info=info,
                               result=request.form)
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index db56dbd..22f3c4d 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -238,8 +238,13 @@ class ServerNode(NodeView):
                     success=0,
                     errormsg=e.message)
 
+        try:
+            info = traceback.format_exc()
+        except Exception as e:
+            info = str(e)
+
         return make_json_response(success=1,
-                                  info=traceback.format_exc())
+                                  info=info)
 
     def update(self, gid, sid):
         """Update the server settings"""
-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to