Skip to content

Commit a65804a

Browse files
committed
rename _set_string_field protect -> protected
1 parent a665af7 commit a65804a

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

pykeepass/entry.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,20 @@ def _get_string_field(self, key):
9494
if field is not None:
9595
return field.text
9696

97-
def _set_string_field(self, key, value, protect=False):
97+
def _set_string_field(self, key, value, protected=True):
9898
"""Create or overwrite a string field in an Entry
9999
100100
Args:
101101
key (str): name of field
102102
value (str): value of field
103-
protect (bool): mark whether the field should be protected in memory
103+
protected (bool): mark whether the field should be protected in memory
104104
in other tools. This property is ignored in PyKeePass and all
105105
fields are decrypted immediately upon opening the database.
106106
"""
107107
field = self._xpath('String/Key[text()="{}"]/..'.format(key), first=True)
108108
if field is not None:
109109
self._element.remove(field)
110-
if protect:
111-
self._element.append(E.String(E.Key(key), E.Value(value, Protected="False")))
112-
else:
113-
self._element.append(E.String(E.Key(key), E.Value(value)))
110+
self._element.append(E.String(E.Key(key), E.Value(value, Protected=str(protected))))
114111

115112
def _get_string_field_keys(self, exclude_reserved=False):
116113
results = [x.find('Key').text for x in self._element.findall('String')]

0 commit comments

Comments
 (0)