From e9efc5632965326e88236994c13dabc61477f83b Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Sun, 18 Feb 2024 22:37:23 +0100 Subject: [PATCH] BUG: fix merge errors --- src/linkahead/__init__.py | 2 +- src/linkahead/common/models.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/linkahead/__init__.py b/src/linkahead/__init__.py index 4462974c..d0b5cc42 100644 --- a/src/linkahead/__init__.py +++ b/src/linkahead/__init__.py @@ -45,7 +45,7 @@ from .common.models import (ACL, ALL, FIX, NONE, OBLIGATORY, RECOMMENDED, SUGGESTED, Container, Entity, File, Info, Message, Permissions, Property, Query, QueryTemplate, Record, RecordType, delete, - execute_query, get_global_acl, + execute_query, get_global_acl, Directory, get_known_permissions, raise_errors) from .common.state import State, Transition from .configuration import _read_config_files, configure, get_config diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py index 9b2bfd77..a6d0e78e 100644 --- a/src/linkahead/common/models.py +++ b/src/linkahead/common/models.py @@ -2006,6 +2006,37 @@ class Record(Entity): return Entity.to_xml(self, xml, add_properties=ALL) +class Directory(Record): + """This class represents CaosDB's directory entities.""" + + def __init__(self, name=None, id=None, description=None, path=None): + Record.__init__(self, id=id, name=name, description=description) + self.role = "Directory" + self.datatype = None + + # location in the fileserver + self.path = path + + def to_xml(self, xml=None, add_properties=ALL, local_serialization=False): + """Convert this Directory to an xml element. + + @return: xml element + """ + + if xml is None: + xml = etree.Element("Directory") + + return Entity.to_xml(self, xml=xml, add_properties=add_properties, + local_serialization=local_serialization) + + def add_property(self, property=None, id=None, name=None, description=None, datatype=None, + value=None, unit=None, importance=FIX, inheritance=FIX): + + return super().add_property( + property=property, id=id, name=name, description=description, datatype=datatype, + value=value, unit=unit, importance=importance, inheritance=inheritance) + + class File(Record): """This class represents LinkAhead's file entities. @@ -4669,6 +4700,7 @@ def _parse_single_xml_element(elem): 'recordtype': RecordType, 'property': Property, 'file': File, + 'directory': Directory, 'parent': Parent, 'entity': Entity} -- GitLab