Skip to content

Allow password to be skipped or set to None in add_entry #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rrasmuseklund
Copy link

@rrasmuseklund rrasmuseklund commented May 15, 2025

Fix: Allow skipping password or password=None in add_entry

This PR fixes an issue where skipping or passing None as the password to add_entry would raise a TypeError, due to lxml not accepting None when building XML elements.

According to the documentation:
https://libkeepass.github.io/pykeepass/pykeepass.html#PyKeePass.add_entry

password (str or None): the password of the new entry

The documentation already states that None is allowed, but the code did not support it.

What this PR does

  • Skips adding the <Password> field entirely if password is None
  • Matches the KeePass GUI behavior when no password is provided

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant