From: | Surinder Kumar <surinder(dot)kumar(at)enterprisedb(dot)com> |
---|---|
To: | Dave Cramer <davecramer(at)gmail(dot)com> |
Cc: | pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org> |
Subject: | Re: Fix key error |
Date: | 2017-08-08 04:15:16 |
Message-ID: | CAM5-9D9GhE4ZnG5xFZaAFoeZaDwC9YmNQLRmS0SL0tjJ1TJYBg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-hackers |
Hi,
On Tue, Aug 8, 2017 at 12:23 AM, Dave Cramer <davecramer(at)gmail(dot)com> wrote:
I don't think this line in web/pgadmin/browser/server_groups/servers/types.py
> does what it should.
>
> default_path = config.DEFAULT_BINARY_PATHS[st.stype] or ""
>
> will ever succeed if the key does not exist
>
> Attached patch should work.
>
It can be written as:
default_path = config.DEFAULT_BINARY_PATHS.get(st.stype, "")
Reference link
<https://docs.quantifiedcode.com/python-anti-patterns/correctness/not_using_get_to_return_a_default_value_from_a_dictionary.html#best-practice>
Thanks for the patch.
> Dave Cramer
>
From | Date | Subject | |
---|---|---|---|
Next Message | Ashesh Vashi | 2017-08-08 04:52:45 | Re: [pgAdmin4][Patch]: Allow user to cancel long running queries from dashboard |
Previous Message | Dave Cramer | 2017-08-07 22:50:27 | Can someone tell me what this code does ? |