public inbox for [email protected]  
help / color / mirror / Atom feed
PATCH: Python2.6 compatibility fixes (pgAdmin4)
5+ messages / 3 participants
[nested] [flat]

* PATCH: Python2.6 compatibility fixes (pgAdmin4)
@ 2016-09-06 11:06  Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Murtuza Zabuawala @ 2016-09-06 11:06 UTC (permalink / raw)
  To: pgadmin-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]


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PATCH: Python2.6 compatibility fixes (pgAdmin4)
@ 2016-09-06 11:08  Murtuza Zabuawala <[email protected]>
  parent: Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Murtuza Zabuawala @ 2016-09-06 11:08 UTC (permalink / raw)
  To: pgadmin-hackers

+++ Adding related RM.

RM#1636 & RM#1659

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, Sep 6, 2016 at 4:36 PM, Murtuza Zabuawala <
[email protected]> wrote:

> Hi,
>
> PFA minor patch for Python2.6 compatibility with pgAdmin4.
> Please review.
>
>
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PATCH: Python2.6 compatibility fixes (pgAdmin4)
@ 2016-09-06 13:22  Dave Page <[email protected]>
  parent: Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Dave Page @ 2016-09-06 13:22 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

Thanks, patch applied.

On Tue, Sep 6, 2016 at 12:08 PM, Murtuza Zabuawala
<[email protected]> wrote:
> +++ Adding related RM.
>
> RM#1636 & RM#1659
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Tue, Sep 6, 2016 at 4:36 PM, Murtuza Zabuawala
> <[email protected]> wrote:
>>
>> Hi,
>>
>> PFA minor patch for Python2.6 compatibility with pgAdmin4.
>> Please review.
>>
>>
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



-- 
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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PATCH: Python2.6 compatibility fixes (pgAdmin4)
@ 2016-09-09 12:53  Surinder Kumar <[email protected]>
  parent: Dave Page <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Surinder Kumar @ 2016-09-09 12:53 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: Murtuza Zabuawala <[email protected]>; pgadmin-hackers

*Please find attached patch with following fix:*

1) While running pgAdmin4 with latest git pull on Windows x64 environment,
I got an exception on terminal console,

> NameError
> NameError: global name 'arch_keys' is not defined​


*​Issue:​* arch_keys was defined inside the method add_server, but used
outside the method.

I have handled this issue in attached patch.

On Tue, Sep 6, 2016 at 6:52 PM, Dave Page <[email protected]> wrote:

> Thanks, patch applied.
>
> On Tue, Sep 6, 2016 at 12:08 PM, Murtuza Zabuawala
> <[email protected]> wrote:
> > +++ Adding related RM.
> >
> > RM#1636 & RM#1659
> >
> > --
> > Regards,
> > Murtuza Zabuawala
> > EnterpriseDB: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
> >
> > On Tue, Sep 6, 2016 at 4:36 PM, Murtuza Zabuawala
> > <[email protected]> wrote:
> >>
> >> Hi,
> >>
> >> PFA minor patch for Python2.6 compatibility with pgAdmin4.
> >> Please review.
> >>
> >>
> >> Regards,
> >> Murtuza Zabuawala
> >> EnterpriseDB: http://www.enterprisedb.com
> >> The Enterprise PostgreSQL Company
> >
> >
>
>
>
> --
> 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
>


-- 
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] py_26_fix.patch (842B, 3-py_26_fix.patch)
  download | inline diff:
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index 23c1489..d988172 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -247,7 +247,6 @@ 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
@@ -272,6 +271,7 @@ def create_app(app_name=config.APP_NAME):

         # Figure out what servers are present
         if winreg is not None:
+            arch_keys = set()
             proc_arch = os.environ['PROCESSOR_ARCHITECTURE'].lower()

             try:


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PATCH: Python2.6 compatibility fixes (pgAdmin4)
@ 2016-09-09 13:51  Dave Page <[email protected]>
  parent: Surinder Kumar <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Dave Page @ 2016-09-09 13:51 UTC (permalink / raw)
  To: Surinder Kumar <[email protected]>; +Cc: Murtuza Zabuawala <[email protected]>; pgadmin-hackers

Thanks, applied.

On Fri, Sep 9, 2016 at 1:53 PM, Surinder Kumar
<[email protected]> wrote:
> Please find attached patch with following fix:
>
> 1) While running pgAdmin4 with latest git pull on Windows x64 environment, I
> got an exception on terminal console,
>>
>> NameError
>> NameError: global name 'arch_keys' is not defined
>
>
> Issue: arch_keys was defined inside the method add_server, but used outside
> the method.
>
> I have handled this issue in attached patch.
>
> On Tue, Sep 6, 2016 at 6:52 PM, Dave Page <[email protected]> wrote:
>>
>> Thanks, patch applied.
>>
>> On Tue, Sep 6, 2016 at 12:08 PM, Murtuza Zabuawala
>> <[email protected]> wrote:
>> > +++ Adding related RM.
>> >
>> > RM#1636 & RM#1659
>> >
>> > --
>> > Regards,
>> > Murtuza Zabuawala
>> > EnterpriseDB: http://www.enterprisedb.com
>> > The Enterprise PostgreSQL Company
>> >
>> > On Tue, Sep 6, 2016 at 4:36 PM, Murtuza Zabuawala
>> > <[email protected]> wrote:
>> >>
>> >> Hi,
>> >>
>> >> PFA minor patch for Python2.6 compatibility with pgAdmin4.
>> >> Please review.
>> >>
>> >>
>> >> Regards,
>> >> Murtuza Zabuawala
>> >> EnterpriseDB: http://www.enterprisedb.com
>> >> The Enterprise PostgreSQL Company
>> >
>> >
>>
>>
>>
>> --
>> 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
>
>



-- 
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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2016-09-09 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06 11:06 PATCH: Python2.6 compatibility fixes (pgAdmin4) Murtuza Zabuawala <[email protected]>
2016-09-06 11:08 ` Murtuza Zabuawala <[email protected]>
2016-09-06 13:22   ` Dave Page <[email protected]>
2016-09-09 12:53     ` Surinder Kumar <[email protected]>
2016-09-09 13:51       ` 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