Skip to content

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

coreyleavitt added a commit to coreyleavitt/pykeepass that referenced this pull request Nov 29, 2025
… to None in add_entry

Fixes TypeError when passing password=None to add_entry(), which the
documentation already stated was allowed.

See: libkeepass#418
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