Create exception subclass. Used by ModelBase below. The exception is created in a way that allows it to be pickled, assuming that the returned exception class will be added as an attribute to the 'attached_to' class.
(name, bases, module, attached_to)
| 70 | |
| 71 | |
| 72 | def subclass_exception(name, bases, module, attached_to): |
| 73 | """ |
| 74 | Create exception subclass. Used by ModelBase below. |
| 75 | |
| 76 | The exception is created in a way that allows it to be pickled, assuming |
| 77 | that the returned exception class will be added as an attribute to the |
| 78 | 'attached_to' class. |
| 79 | """ |
| 80 | return type( |
| 81 | name, |
| 82 | bases, |
| 83 | { |
| 84 | "__module__": module, |
| 85 | "__qualname__": "%s.%s" % (attached_to.__qualname__, name), |
| 86 | }, |
| 87 | ) |
| 88 | |
| 89 | |
| 90 | def _has_contribute_to_class(value): |