Custom __instancecheck__ no longer needed
Would be needed if calling a classmethod in __new__ but as we dont support reverse_delete_rules on embedded documents there is no longer the need for it. Refs #227
This commit is contained in:
		| @@ -665,18 +665,6 @@ class TopLevelDocumentMetaclass(DocumentMetaclass): | ||||
|  | ||||
|         return new_class | ||||
|  | ||||
|     def __instancecheck__(cls, inst): | ||||
|         """Custom instance check for isinstance() as registering delete rules or | ||||
|         calling a cls method in __new__ seems to change the cls so vanilla | ||||
|         isinstance() fails""" | ||||
|         is_instance = super(DocumentMetaclass, cls).__instancecheck__(inst) | ||||
|         if hasattr(cls, '_meta') and 'delete_rules' in cls._meta and not is_instance: | ||||
|             try: | ||||
|                 is_instance = get_document(cls.__name__) == get_document(inst.__class__.__name__) | ||||
|             except NotRegistered: | ||||
|                 pass | ||||
|         return is_instance | ||||
|  | ||||
|     @classmethod | ||||
|     def _unique_with_indexes(cls, new_class, namespace=""): | ||||
|         unique_indexes = [] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user