diff --git a/src/micado/main/MDBObjectMeta.py b/src/micado/main/MDBObjectMeta.py index 294e21a12c2ce61d566baafe5cbd587630e04dce..3e26f2cfec5a77a8d46dcec5e9d4e0258404347e 100644 --- a/src/micado/main/MDBObjectMeta.py +++ b/src/micado/main/MDBObjectMeta.py @@ -178,7 +178,6 @@ class MDBObjectMeta(DBObjectMeta): - _construct_object_from_fitsfile(): filename of FITS file is given. - _construct_object_from_fitsheader(): FITS header is given. - _construct_object_from_attributes(): attributes are given as kwargs. - - _call_other_cls(): class overide is given in CLS (for Templates). _construct_object_from_fitsheader() is called for each extension in the FITS file, as well as the primary HDU. The FITS keywords hierarchically @@ -199,19 +198,7 @@ class MDBObjectMeta(DBObjectMeta): TODO: Fix autocommit, see also _find_existing(). """ - if "CLS" in kwargs: - # TODO: This cannot happen anymore, replace this logic with - # DPR.TYPE/DPR.CATG/DPR.TECH or PRO.CATG checking. - assert False - # The CLS is the name of a derived class. See Template - cls_id = kwargs["CLS"] - kwargs2 = {k: v for k, v in kwargs.items() if k not in ["CLS"]} - obj = cls._call_other_cls( - cls_id=cls_id, - *args, - **kwargs2, - ) - elif "object_id" in kwargs: + if "object_id" in kwargs: # A specific object id is given, delegate to super class. # obj will be None if object_id is None, which happens when # instantiating an object from the database that has a @@ -236,20 +223,6 @@ class MDBObjectMeta(DBObjectMeta): assert not attr_names or issubclass(cls, Recipe) obj = DBObjectMeta.__call__(cls) - elif "header" in kwargs and "CLS" in kwargs["header"]: - # TODO remove - # TODO: This does not work anymore, need to use ID or something. - assert False - # A different class is specified than this one, need to construct - # an instance of that. - # TODO: ESO uses ID where we use CLS, switch to that. - header = kwargs["header"] - cls_id = header["CLS"] - header2 = {k: v for k, v in header.items() if k not in ["CLS"]} - kwargs2 = {k: v for k, v in kwargs.items() if k not in ["header"]} - kwargs2["header"] = header2 - kwargs2["CLS"] = cls_id - obj = cls(autocommit=False, *args, **kwargs2) elif "header" in kwargs: header1 = kwargs["header"] kwargs2 = { @@ -856,7 +829,6 @@ class MDBObjectMeta(DBObjectMeta): >>> from micado.templates.MicadoImgCalDark import \ MicadoImgCalDark >>> header = {'DET__DIT': 1, 'DET__NDIT': 1} - >>> template = Template(CLS="MicadoImgCalDark", header=header) >>> assert isinstance(template, MicadoImgCalDark) Args: