def get_resource(cls): admin_client = cls.get_admin_client() try: return admin_client.get_resource(cls) except Exception, error: for key, resource in admin_client.registry.iteritems(): if isinstance(key, type) and issubclass(cls, key): return resource
def get_resource(cls): admin_client = cls.get_admin_client() try: return admin_client.get_resource(cls) except Exception, error: for key, resource in admin_client.registry.iteritems(): if isinstance(key, type) and issubclass(cls, key): return resource #TODO why do we need this? if issubclass(key, schema.Document) and key._meta.collection == cls._meta.collection: return resource