toastdriven/django-tastypie — pull request #670 by mitar (2012-09-12 08:30:51+00:00)
Title: Fixing support for subresources and non-Django backends

Because `ResourceOptions` defines `queryset` as `None`, `hasattr` is always true. A consequence is that even if queryset is not define/applicable (for example, for subresources or non-Django backends trying to override this class), Tastypie tries to extract `self._meta.queryset.query.query_terms` and it blows up.

This is why this check should be done differently.

Furthermore, it would be also much better if `self._meta.queryset.query.query_terms` would be accessed part by part, because in my case (https://github.com/mitar/django-tastypie-mongoengine) for example I have a am providing a queryset-like object there, which does not have all internals, just external API the same. And so there is no `query`. Of course I could add it (and I am doing that now as a workaround), but it is ugly. It should try a bit more gently (or simply wrap it into the exception handler).