mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-25 07:23:28 +00:00
Item: assert type also in property getter
also: fixed Item.xattrs to be StableDict (not just a dict, as the msgpack unpacker gives us)
This commit is contained in:
parent
7b138cc710
commit
9d684120a2
1 changed files with 6 additions and 1 deletions
|
@ -207,6 +207,8 @@ class PropDict:
|
||||||
raise AttributeError(attr_error_msg) from None
|
raise AttributeError(attr_error_msg) from None
|
||||||
if decode is not None:
|
if decode is not None:
|
||||||
value = decode(value)
|
value = decode(value)
|
||||||
|
if not isinstance(value, value_type):
|
||||||
|
raise TypeError(type_error_msg)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def _set(self, value):
|
def _set(self, value):
|
||||||
|
@ -392,7 +394,10 @@ class Item(PropDict):
|
||||||
v = fix_timestamp(v)
|
v = fix_timestamp(v)
|
||||||
if k in ('acl_access', 'acl_default', 'acl_extended', 'acl_nfs4'):
|
if k in ('acl_access', 'acl_default', 'acl_extended', 'acl_nfs4'):
|
||||||
v = fix_bytes_value(d, k)
|
v = fix_bytes_value(d, k)
|
||||||
# TODO: xattrs
|
if k == 'xattrs':
|
||||||
|
if not isinstance(v, StableDict):
|
||||||
|
v = StableDict(v)
|
||||||
|
# TODO: xattrs key/value types
|
||||||
self._dict[k] = v
|
self._dict[k] = v
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue