scim2-models 0.6.1__py3-none-any.whl → 0.6.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,6 +52,21 @@ class SCIMException(Exception):
52
52
  {"scim_type": self.scim_type, "status": self.status, **self.context},
53
53
  )
54
54
 
55
+ @classmethod
56
+ def from_error(cls, error: "Error") -> "SCIMException":
57
+ """Create an exception from a SCIM Error object.
58
+
59
+ :param error: The SCIM Error object to convert.
60
+ :return: The appropriate SCIMException subclass instance.
61
+ """
62
+ from .messages.error import Error
63
+
64
+ if not isinstance(error, Error):
65
+ raise TypeError(f"Expected Error, got {type(error).__name__}")
66
+
67
+ exception_class = _SCIM_TYPE_TO_EXCEPTION.get(error.scim_type or "", cls)
68
+ return exception_class(detail=error.detail)
69
+
55
70
 
56
71
  class InvalidFilterException(SCIMException):
57
72
  """The specified filter syntax was invalid.
@@ -263,3 +278,17 @@ class SensitiveException(SCIMException):
263
278
  "The specified request cannot be completed, due to the passing of sensitive "
264
279
  "information in a request URI"
265
280
  )
281
+
282
+
283
+ _SCIM_TYPE_TO_EXCEPTION: dict[str, type[SCIMException]] = {
284
+ "invalidFilter": InvalidFilterException,
285
+ "tooMany": TooManyException,
286
+ "uniqueness": UniquenessException,
287
+ "mutability": MutabilityException,
288
+ "invalidSyntax": InvalidSyntaxException,
289
+ "invalidPath": InvalidPathException,
290
+ "noTarget": NoTargetException,
291
+ "invalidValue": InvalidValueException,
292
+ "invalidVers": InvalidVersionException,
293
+ "sensitive": SensitiveException,
294
+ }
@@ -180,7 +180,7 @@ class Address(ComplexAttribute):
180
180
 
181
181
  primary: bool | None = None
182
182
  """A Boolean value indicating the 'primary' or preferred attribute value
183
- for this attribute, e.g., the preferred photo or thumbnail."""
183
+ for this attribute, e.g., the preferred address."""
184
184
 
185
185
 
186
186
  class Entitlement(ComplexAttribute):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: scim2-models
3
- Version: 0.6.1
3
+ Version: 0.6.2
4
4
  Summary: SCIM2 models serialization and validation with pydantic
5
5
  Keywords: scim,scim2,provisioning,pydantic,rfc7643,rfc7644
6
6
  Author: Yaal Coop
@@ -4,7 +4,7 @@ scim2_models/attributes.py,sha256=v_bjJSdBmPlGh20W2Y57PIZnqvMTYHQyJuJLfQjGmwc,18
4
4
  scim2_models/base.py,sha256=dB0idU8apEwPwJpax1EWYX-omxcIy9Z4DMjNhrwTJAg,22407
5
5
  scim2_models/constants.py,sha256=9egq8JW0dFAqPng85CiHoH5T6pRtYL87-gC0C-IMGsk,573
6
6
  scim2_models/context.py,sha256=RjgMIvWPr8f41qbVL1sjaDnm9GRKyrCrgfC4npwwcMg,9149
7
- scim2_models/exceptions.py,sha256=0rvJTRM3CbaB2-T_PAhii5W-YEvTY31scPdrauGJi0M,7655
7
+ scim2_models/exceptions.py,sha256=_LbknoZrCrCaL7tKYrRF_G0vtru56OYrrqBARySAVXk,8684
8
8
  scim2_models/messages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  scim2_models/messages/bulk.py,sha256=fWm9s88FHa66Aa0XeLcN7HurHp98JhlqM1rkEnIKZ8A,2429
10
10
  scim2_models/messages/error.py,sha256=gbHxf47ZIamnZAgD7cNAwHXxEZsf36PTdtcejesYIy0,12138
@@ -22,9 +22,9 @@ scim2_models/resources/resource.py,sha256=0Y8xloQk6tWQ9L7gW__qlUkU55mpYAsxfpeuFu
22
22
  scim2_models/resources/resource_type.py,sha256=IDzUcv9_XiAHOpaaG9j24sa-nNKY6i0wPDTTrxNqJgQ,3297
23
23
  scim2_models/resources/schema.py,sha256=wDh8G1oxCgyQcmChz30bVNPjyksYcgxD66k0mB1VIdI,10239
24
24
  scim2_models/resources/service_provider_config.py,sha256=cmfPtLPOuwNrZl9hGpbrMsQhoOwIytlf2Q_LAJegAcQ,5303
25
- scim2_models/resources/user.py,sha256=ZvyjxZiF52d_L_LUCEZpec6CXOe40_udZhOHpjzFpxs,11409
25
+ scim2_models/resources/user.py,sha256=Z-h8x9dAnxBqDeZJbKi-u-HCv6aQdS8e4VzHLVm63ZA,11398
26
26
  scim2_models/scim_object.py,sha256=suYhQ0iFQs1aKTlSerWZsi_sAVhFX_9N24U_DmZxCbw,5321
27
27
  scim2_models/utils.py,sha256=Lb7mlP3I_IfAlqi_8_m4G-_1Rn7oKRqbNdpoDLjXXr0,1978
28
- scim2_models-0.6.1.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
29
- scim2_models-0.6.1.dist-info/METADATA,sha256=4_foQD9Bpu-ghYMS923_giVn1VC-e5UUaIZsgNO1nTY,16486
30
- scim2_models-0.6.1.dist-info/RECORD,,
28
+ scim2_models-0.6.2.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
29
+ scim2_models-0.6.2.dist-info/METADATA,sha256=q6LTJlB0nesIAO3-DP7Exy2cw4IbODc8MxGRTydt7Qw,16486
30
+ scim2_models-0.6.2.dist-info/RECORD,,