From faa4e9a466ea6c602dc225ed5dc3725611aa70c0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 22 Jan 2022 07:36:58 +0100 Subject: Merging upstream version 3.3.1. Signed-off-by: Daniel Baumann --- changelog.rst | 12 +++++------- pgcli/__init__.py | 2 +- pgcli/main.py | 21 +++++++++++---------- setup.py | 4 ++-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/changelog.rst b/changelog.rst index 7ce5132..d4bbd39 100644 --- a/changelog.rst +++ b/changelog.rst @@ -1,17 +1,15 @@ -TBD -================ - -Features: ---------- - +3.3.1 (2022/01/18) +================== Bug fixes: ---------- +* Prompt for password when -W is provided even if there is a password in keychain. Fixes #1307. +* Upgrade cli_helpers to 2.2.1 3.3.0 (2022/01/11) -================ +================== Features: --------- diff --git a/pgcli/__init__.py b/pgcli/__init__.py index 88c513e..ff04168 100644 --- a/pgcli/__init__.py +++ b/pgcli/__init__.py @@ -1 +1 @@ -__version__ = "3.3.0" +__version__ = "3.3.1" diff --git a/pgcli/main.py b/pgcli/main.py index 5395f67..e4a2ee3 100644 --- a/pgcli/main.py +++ b/pgcli/main.py @@ -549,6 +549,17 @@ class PGCli: - uninstall keyring: pip uninstall keyring - disable keyring in our configuration: add keyring = False to [main]""" ) + + # Prompt for a password immediately if requested via the -W flag. This + # avoids wasting time trying to connect to the database and catching a + # no-password exception. + # If we successfully parsed a password from a URI, there's no need to + # prompt for it, even with the -W flag + if self.force_passwd_prompt and not passwd: + passwd = click.prompt( + "Password for %s" % user, hide_input=True, show_default=False, type=str + ) + if not passwd and keyring: try: @@ -562,16 +573,6 @@ class PGCli: fg="red", ) - # Prompt for a password immediately if requested via the -W flag. This - # avoids wasting time trying to connect to the database and catching a - # no-password exception. - # If we successfully parsed a password from a URI, there's no need to - # prompt for it, even with the -W flag - if self.force_passwd_prompt and not passwd: - passwd = click.prompt( - "Password for %s" % user, hide_input=True, show_default=False, type=str - ) - def should_ask_for_password(exc): # Prompt for a password after 1st attempt to connect # fails. Don't prompt if the -w flag is supplied diff --git a/setup.py b/setup.py index 68260e0..0cbd192 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ description = "CLI for Postgres Database. With auto-completion and syntax highli install_requirements = [ "pgspecial>=1.11.8", "click >= 4.1", - "Pygments>=2.0,<=2.11.1", # Pygments has to be Capitalcased. WTF? + "Pygments>=2.0", # Pygments has to be Capitalcased. WTF? # We still need to use pt-2 unless pt-3 released on Fedora32 # see: https://github.com/dbcli/pgcli/pull/1197 "prompt_toolkit>=2.0.6,<4.0.0", @@ -16,7 +16,7 @@ install_requirements = [ "sqlparse >=0.3.0,<0.5", "configobj >= 5.0.6", "pendulum>=2.1.0", - "cli_helpers[styles] >= 2.0.0", + "cli_helpers[styles] >= 2.2.1", ] -- cgit v1.2.3