SCOPE_SUBTREE)
from samba.sd_utils import SDUtils
-from .exceptions import (DeleteError, DoesNotExist, FieldError,
- ProtectError, UnprotectError)
+from .exceptions import (DeleteError, FieldError, NotFound, ProtectError,
+ UnprotectError)
from .fields import (DateTimeField, DnField, Field, GUIDField, IntegerField,
StringField)
from .query import Query
res = ldb.search(self.dn, scope=SCOPE_BASE, attrs=attrs)
except LdbError as e:
if e.args[0] == ERR_NO_SUCH_OBJECT:
- raise DoesNotExist(f"Refresh failed, object gone: {self.dn}")
+ raise NotFound(f"Refresh failed, object gone: {self.dn}")
raise
self._apply(ldb, res[0])
expression=cls.build_expression(**kwargs))
except LdbError as e:
if e.args[0] == ERR_NO_SUCH_OBJECT:
- raise DoesNotExist(f"Container does not exist: {base_dn}")
+ raise NotFound(f"Container does not exist: {base_dn}")
raise
return Query(cls, ldb, result)
import re
-from .exceptions import DoesNotExist, MultipleObjectsReturned
+from .exceptions import NotFound, MultipleObjectsReturned
RE_SPLIT_CAMELCASE = re.compile(r"[A-Z](?:[a-z]+|[A-Z]*(?=[A-Z]|$))")
"""Must return EXACTLY one item or raise an exception.
:returns: Model instance
- :raises DoesNotExist: if no results were returned
+ :raises NotFound: if no results were returned
:raises MultipleObjectsReturned: if more than one results were returned
"""
if self.count < 1:
- raise DoesNotExist(
+ raise NotFound(
f"{self.name.capitalize()} matching query not found")
elif self.count > 1:
raise MultipleObjectsReturned(