Skip to content
Snippets Groups Projects

Draft: ENH: file system: import

Open Timm Fitschen requested to merge f-filesystem-import into f-filesystem-link
Files
2
+ 17
10
@@ -1606,14 +1606,6 @@ class Parent(Entity):
return super().to_xml(xml=xml, add_properties=add_properties)
class _EntityWrapper(object):
pass
class _ConcreteProperty(_EntityWrapper):
pass
class Property(Entity):
"""CaosDB's Property object."""
@@ -1858,7 +1850,8 @@ class Link(Entity):
class Directory(Record):
"""This class represents CaosDB's directory entities."""
def __init__(self, name=None, id=None, description=None, path=None):
def __init__(self, name=None, id=None, description=None, path=None,
import_file=False, recursive_import=False):
Record.__init__(self, id=id, name=name, description=description)
self.role = "Directory"
self.datatype = None
@@ -1866,6 +1859,9 @@ class Directory(Record):
# location in the fileserver
self.path = path
self.recursive_import = recursive_import
self.import_file = import_file or recursive_import
def to_xml(self, xml=None, add_properties=ALL, local_serialization=False):
"""Convert this Directory to an xml element.
@@ -1913,11 +1909,13 @@ class File(Record):
Deprecated.
thumbnail : str
Deprecated.
import_file : bool
Import the file (don't upload it, its already there). Default: `False`
"""
def __init__(self, name=None, id=None, description=None,
path=None, file=None, pickup=None,
thumbnail=None):
thumbnail=None, import_file=False):
Record.__init__(self, id=id, name=name, description=description)
self.role = "File"
self.datatype = None
@@ -1927,6 +1925,9 @@ class File(Record):
# local file path or pointer to local file
self.file = file
self.import_file = import_file
if thumbnail is not None:
warn(DeprecationWarning(
"The thumbnail feature has been removed from the CaosDB "
@@ -3455,6 +3456,8 @@ class Container(list):
if hasattr(entity, '_upload') and entity._upload is not None:
entity_xml.set("upload", entity._upload)
elif hasattr(entity, 'import_file') and entity.import_file is True:
entity_xml.set("import", "true")
insert_xml.append(entity_xml)
@@ -3601,6 +3604,10 @@ class Container(list):
if hasattr(entity, '_upload') and entity._upload is not None:
entity_xml.set("upload", entity._upload)
elif hasattr(entity, 'recursive_import') and entity.recursive_import is True:
entity_xml.set("recursive_import", "true")
elif hasattr(entity, 'import_file') and entity.import_file is True:
entity_xml.set("import", "true")
insert_xml.append(entity_xml)
if len(self) > 0 and len(insert_xml) < 1:
Loading