From: Rob van der Linde Date: Tue, 20 Feb 2024 02:19:12 +0000 (+1300) Subject: netcmd: models: move MODELS constant to constants.py to avoid import loop X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=1d0084673eff07fadfe9029bb9c7092647ed13f5 netcmd: models: move MODELS constant to constants.py to avoid import loop query.py and models.py otherwise cause an import loop, query.py needs to import MODELS Signed-off-by: Rob van der Linde Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/netcmd/domain/models/__init__.py b/python/samba/netcmd/domain/models/__init__.py index 8051a5c3648..d9185b51bf0 100644 --- a/python/samba/netcmd/domain/models/__init__.py +++ b/python/samba/netcmd/domain/models/__init__.py @@ -25,9 +25,9 @@ from .auth_policy import (AuthenticationPolicy, StrongNTLMPolicy, from .auth_silo import AuthenticationSilo from .claim_type import ClaimType from .computer import Computer +from .constants import MODELS from .gmsa import GroupManagedServiceAccount from .group import Group -from .model import MODELS from .schema import AttributeSchema, ClassSchema from .site import Site from .subnet import Subnet diff --git a/python/samba/netcmd/domain/models/constants.py b/python/samba/netcmd/domain/models/constants.py new file mode 100644 index 00000000000..d1b3cc133be --- /dev/null +++ b/python/samba/netcmd/domain/models/constants.py @@ -0,0 +1,25 @@ +# Unix SMB/CIFS implementation. +# +# Model constants +# +# Copyright (C) Catalyst.Net Ltd. 2023 +# +# Written by Rob van der Linde +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# Keeps track of registered models. +# This gets populated by the ModelMeta class. +MODELS = {} diff --git a/python/samba/netcmd/domain/models/model.py b/python/samba/netcmd/domain/models/model.py index 42de54fa5c7..3ad26c6b2b8 100644 --- a/python/samba/netcmd/domain/models/model.py +++ b/python/samba/netcmd/domain/models/model.py @@ -28,16 +28,13 @@ from ldb import (ERR_NO_SUCH_OBJECT, FLAG_MOD_ADD, FLAG_MOD_REPLACE, SCOPE_SUBTREE) from samba.sd_utils import SDUtils +from .constants import MODELS from .exceptions import (DeleteError, FieldError, NotFound, ProtectError, UnprotectError) from .fields import (DateTimeField, DnField, Field, GUIDField, IntegerField, StringField) from .query import Query -# Keeps track of registered models. -# This gets populated by the ModelMeta class. -MODELS = {} - class ModelMeta(ABCMeta):