public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: PATCH: Python2.6 compatibility fixes (pgAdmin4)
Date: Tue, 6 Sep 2016 16:36:12 +0530
Message-ID: <CAKKotZSL4MNp21DUNrUBkh7u2CbhhPpqKhPHVcXjLgfWe-iycA@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
PFA minor patch for Python2.6 compatibility with pgAdmin4.
Please review.
Regards,
Murtuza Zabuawala
EnterpriseDB: 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] python26_compatibility.patch (2.4K, 3-python26_compatibility.patch)
download | inline diff:
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index 538bb3a..23c1489 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -33,7 +33,7 @@ import config
# If script is running under python3, it will not have the xrange function
# defined
winreg = None
-if sys.version_info.major >= 3:
+if sys.version_info[0] >= 3:
xrange = range
if os.name == 'nt':
import winreg
@@ -247,6 +247,7 @@ def create_app(app_name=config.APP_NAME):
'''Add a server to the config database'''
def add_server(user_id, servergroup_id, name, superuser, port, discovery_id, comment):
# Create a server object if needed, and store it.
+ arch_keys = set()
servers = Server.query.filter_by(
user_id=user_id,
discovery_id=svr_discovery_id
@@ -279,12 +280,13 @@ def create_app(app_name=config.APP_NAME):
proc_arch64 = None
if proc_arch == 'x86' and not proc_arch64:
- arch_keys = {0}
+ arch_keys.add(0)
elif proc_arch == 'x86' or proc_arch == 'amd64':
- arch_keys = {winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY}
+ arch_keys.add(winreg.KEY_WOW64_32KEY)
+ arch_keys.add(winreg.KEY_WOW64_64KEY)
for arch_key in arch_keys:
- for server_type in { 'PostgreSQL', 'EnterpriseDB'}:
+ for server_type in ('PostgreSQL', 'EnterpriseDB'):
try:
root_key = winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE,
diff --git a/web/pgadmin/utils/driver/psycopg2/cursor.py b/web/pgadmin/utils/driver/psycopg2/cursor.py
index 1193dc4..c8257ab 100644
--- a/web/pgadmin/utils/driver/psycopg2/cursor.py
+++ b/web/pgadmin/utils/driver/psycopg2/cursor.py
@@ -130,7 +130,7 @@ class DictCursor(_cursor):
"""
if self._odt_desc is None:
self._ordered_description()
- return {k[0]: v for k, v in zip(self._odt_desc, tup)}
+ return dict((k[0], v) for k, v in zip(self._odt_desc, tup))
def _ordered_description(self):
"""
@@ -144,7 +144,7 @@ class DictCursor(_cursor):
return
res = list()
- od = {d[0]: 0 for d in desc}
+ od = dict((d[0], 0) for d in desc)
for d in desc:
dummy = None
idx = od[d.name]
view thread (5+ 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]
Subject: Re: PATCH: Python2.6 compatibility fixes (pgAdmin4)
In-Reply-To: <CAKKotZSL4MNp21DUNrUBkh7u2CbhhPpqKhPHVcXjLgfWe-iycA@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