diff options
| author | Rob van der Linde <rob@catalyst.net.nz> | 2024-02-20 15:19:12 +1300 |
|---|---|---|
| committer | Andrew Bartlett <abartlet@samba.org> | 2024-03-01 04:45:36 +0000 |
| commit | 1d0084673eff07fadfe9029bb9c7092647ed13f5 (patch) | |
| tree | 60db9069c002d93709ad1174adc5209f4e26924f /python | |
| parent | a54706235268cb3c82dae590b79a90cd90e86427 (diff) | |
| download | samba-1d0084673eff07fadfe9029bb9c7092647ed13f5.tar.gz samba-1d0084673eff07fadfe9029bb9c7092647ed13f5.tar.bz2 samba-1d0084673eff07fadfe9029bb9c7092647ed13f5.zip | |
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 <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'python')
| -rw-r--r-- | python/samba/netcmd/domain/models/__init__.py | 2 | ||||
| -rw-r--r-- | python/samba/netcmd/domain/models/constants.py | 25 | ||||
| -rw-r--r-- | python/samba/netcmd/domain/models/model.py | 5 |
3 files changed, 27 insertions, 5 deletions
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 <rob@catalyst.net.nz> +# +# 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 <http://www.gnu.org/licenses/>. +# + +# 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): |
