From ba59e498def28e7535ba35b21c39ad576fd89649 Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Fri, 2 Dec 2011 02:52:06 -0800 Subject: [PATCH] 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 --- mongoengine/base.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/mongoengine/base.py b/mongoengine/base.py index 00dd2eeb..88324bbe 100644 --- a/mongoengine/base.py +++ b/mongoengine/base.py @@ -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 = []