Merge pull request #819 from jrnl-org/develop

Merge latest develop into master for v2.2-beta2
This commit is contained in:
Jonathan Wren 2020-01-25 13:17:15 -08:00 committed by GitHub
commit caedf1ae7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -12,6 +12,11 @@
- Password confirmation [\#706](https://github.com/jrnl-org/jrnl/pull/706) ([pspeter](https://github.com/pspeter)) - Password confirmation [\#706](https://github.com/jrnl-org/jrnl/pull/706) ([pspeter](https://github.com/pspeter))
- Pretty print journal entries [\#692](https://github.com/jrnl-org/jrnl/pull/692) ([alichtman](https://github.com/alichtman)) - Pretty print journal entries [\#692](https://github.com/jrnl-org/jrnl/pull/692) ([alichtman](https://github.com/alichtman))
**Fixed bugs:**
- Close temp file before passing it to editor to prevent file locking issues in Windows [\#792](https://github.com/jrnl-org/jrnl/pull/792) ([micahellison](https://github.com/micahellison))
- Fix crash while encrypting a journal on first run without saving password [\#789](https://github.com/jrnl-org/jrnl/pull/789) ([dbxnr](https://github.com/dbxnr))
**Build:** **Build:**
- Change PyPI auth method in build pipeline [\#807](https://github.com/jrnl-org/jrnl/pull/807) ([wren](https://github.com/wren)) - Change PyPI auth method in build pipeline [\#807](https://github.com/jrnl-org/jrnl/pull/807) ([wren](https://github.com/wren))

View file

@ -103,7 +103,7 @@ def set_keychain(journal_name, password):
if password is None: if password is None:
try: try:
keyring.delete_password("jrnl", journal_name) keyring.delete_password("jrnl", journal_name)
except RuntimeError: except keyring.errors.PasswordDeleteError:
pass pass
else: else:
keyring.set_password("jrnl", journal_name, password) keyring.set_password("jrnl", journal_name, password)
@ -142,21 +142,26 @@ def scope_config(config, journal_name):
def get_text_from_editor(config, template=""): def get_text_from_editor(config, template=""):
filehandle, tmpfile = tempfile.mkstemp(prefix="jrnl", text=True, suffix=".txt") filehandle, tmpfile = tempfile.mkstemp(prefix="jrnl", text=True, suffix=".txt")
os.close(filehandle)
with open(tmpfile, "w", encoding="utf-8") as f: with open(tmpfile, "w", encoding="utf-8") as f:
if template: if template:
f.write(template) f.write(template)
try: try:
subprocess.call( subprocess.call(
shlex.split(config["editor"], posix="win" not in sys.platform) + [tmpfile] shlex.split(config["editor"], posix="win" not in sys.platform) + [tmpfile]
) )
except AttributeError: except AttributeError:
subprocess.call(config["editor"] + [tmpfile]) subprocess.call(config["editor"] + [tmpfile])
with open(tmpfile, "r", encoding="utf-8") as f: with open(tmpfile, "r", encoding="utf-8") as f:
raw = f.read() raw = f.read()
os.close(filehandle)
os.remove(tmpfile) os.remove(tmpfile)
if not raw: if not raw:
print("[Nothing saved to file]", file=sys.stderr) print("[Nothing saved to file]", file=sys.stderr)
return raw return raw