Skip to content

Add NoneType check to class Entry #435

Description

@langer69

In class Entry

def __init__(self, title=None, username=None, password=None, url=None,
notes=None, otp=None, tags=None, expires=False, expiry_time=None,
icon=None, autotype_sequence=None, autotype_enabled=True, autotype_window=None,
element=None, kp=None):

title, username, password accept None as input.
self._element.append(E.String(E.Key('Title'), E.Value(title or "")))
self._element.append(E.String(E.Key('UserName'), E.Value(username or "")))
self._element.append(
E.String(E.Key('Password'), E.Value(password or "", Protected="True"))
)

But E.Value() reject None.
Since keepass allows entry with no title username or password,this will cause exception.

if title:
    self._element.append(E.String(E.Key('Title'), E.Value(title)))
if username:
    self._element.append(E.String(E.Key('UserName'), E.Value(username)))
if password:
    self._element.append(E.String(E.Key('Password'), E.Value(password, Protected="True")))

I think add NoneType check would be better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions