Skip to content
Snippets Groups Projects
Verified Commit d2fb4286 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: file storage: link

parent 769db33e
Branches
No related tags found
1 merge request!87Draft: ENH: file system: link
Pipeline #31791 passed
...@@ -1396,7 +1396,7 @@ def _parse_value(datatype, value): ...@@ -1396,7 +1396,7 @@ def _parse_value(datatype, value):
# This is for a special case, where the xml parser could not differentiate # This is for a special case, where the xml parser could not differentiate
# between single values and lists with one element. As # between single values and lists with one element. As
if hasattr(value, "__len__") and len(value) == 1: if hasattr(value, "__len__") and len(value) == 1 and not isinstance(value, str):
return _parse_value(datatype, value[0]) return _parse_value(datatype, value[0])
# deal with references # deal with references
...@@ -1450,23 +1450,12 @@ class QueryTemplate(): ...@@ -1450,23 +1450,12 @@ class QueryTemplate():
self.description = description self.description = description
self.query = query self.query = query
self._cuid = None self._cuid = None
self.value = None
self.datatype = None
self.messages = _Messages() self.messages = _Messages()
self.properties = None
self.parents = None
self.path = None
self.file = None
self._checksum = None
self._size = None
self._upload = None
self.unit = None
self.acl = None self.acl = None
self.permissions = None self.permissions = None
self.is_valid = lambda: False self.is_valid = lambda: False
self.is_deleted = lambda: False self.is_deleted = lambda: False
self.version = None self.version = None
self.state = None
def retrieve(self, raise_exception_on_error=True, unique=True, sync=True, def retrieve(self, raise_exception_on_error=True, unique=True, sync=True,
flags=None): flags=None):
...@@ -2556,31 +2545,13 @@ def _basic_sync(e_local, e_remote): ...@@ -2556,31 +2545,13 @@ def _basic_sync(e_local, e_remote):
"this client did't know about it yet.".format( "this client did't know about it yet.".format(
e_remote.role, e_local.role)) e_remote.role, e_local.role))
e_local.id = e_remote.id for attr in ["path", "link_target", "_checksum", "_size", "datatype",
e_local.name = e_remote.name "unit", "value", "properties", "parents", "messages", "acl",
e_local.description = e_remote.description "permissions", "is_valid", "is_deleted", "version", "state",
e_local.path = e_remote.path "query", "affiliation", "id", "name", "description"]:
e_local.link_target = e_remote.link_target
e_local._checksum = e_remote._checksum if hasattr(e_remote, attr):
e_local._size = e_remote._size setattr(e_local, attr, getattr(e_remote, attr))
e_local.datatype = e_remote.datatype
e_local.unit = e_remote.unit
e_local.value = e_remote.value
e_local.properties = e_remote.properties
e_local.parents = e_remote.parents
e_local.messages = e_remote.messages
e_local.acl = e_remote.acl
e_local.permissions = e_remote.permissions
e_local.is_valid = e_remote.is_valid
e_local.is_deleted = e_remote.is_deleted
e_local.version = e_remote.version
e_local.state = e_remote.state
if hasattr(e_remote, "query"):
e_local.query = e_remote.query
if hasattr(e_remote, "affiliation"):
e_local.affiliation = e_remote.affiliation
return e_local return e_local
...@@ -3064,6 +3035,7 @@ class Container(list): ...@@ -3064,6 +3035,7 @@ class Container(list):
for local_entity in self: for local_entity in self:
if (sync_dict[local_entity] is None if (sync_dict[local_entity] is None
and hasattr(local_entity, "path")
and local_entity.path is not None): and local_entity.path is not None):
sync_remote_entities = [] sync_remote_entities = []
......
...@@ -87,3 +87,9 @@ def test_parsing_of_references(): ...@@ -87,3 +87,9 @@ def test_parsing_of_references():
entity = db.Record(name="bla") entity = db.Record(name="bla")
assert id(_parse_value(dtype, entity)) == id(entity) assert id(_parse_value(dtype, entity)) == id(entity)
def test_parsing_of_single_list_item_str_len_one():
db.Record().add_property("blub", datatype=db.LIST(db.TEXT), value=["a"])
db.Record().add_property("blub", datatype=db.LIST(db.INTEGER), value=[1])
db.Record().add_property("blub", datatype=db.LIST("bla"), value=["a"])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment