| 1 |
""" |
| 2 |
Exceptions used by django-guardian. All internal and guardian-specific errors |
| 3 |
should extend GuardianError class. |
| 4 |
""" |
| 5 |
|
| 6 |
|
| 7 |
class GuardianError(Exception): |
| 8 |
"""Base class for all guardian-specific exceptions.""" |
| 9 |
|
| 10 |
pass |
| 11 |
|
| 12 |
|
| 13 |
class NotUserNorGroup(GuardianError): |
| 14 |
"""Raised when an object is neither User nor Group.""" |
| 15 |
|
| 16 |
pass |
| 17 |
|
| 18 |
|
| 19 |
class ObjectNotPersisted(GuardianError): |
| 20 |
"""Raised when the object has not been saved to the database.""" |
| 21 |
|
| 22 |
pass |
| 23 |
|
| 24 |
|
| 25 |
class WrongAppError(GuardianError): |
| 26 |
"""Raised when the app name for a permission is incorrect.""" |
| 27 |
|
| 28 |
pass |
| 29 |
|
| 30 |
|
| 31 |
class MixedContentTypeError(GuardianError): |
| 32 |
"""Raised when content type for the provided permissions and/or class do not match.""" |
| 33 |
|
| 34 |
pass |
| 35 |
|
| 36 |
|
| 37 |
class MultipleIdentityAndObjectError(GuardianError): |
| 38 |
"""Raised when an operation is attempted on both user/group and object.""" |
| 39 |
|
| 40 |
pass |