{"action":"created","comment":{"url":"https://api.github.com/repos/pulp/pulp/pulls/comments/47001922","id":47001922,"diff_hunk":"@@ -1,10 +1,44 @@\n-from mongoengine.queryset import DoesNotExist, QuerySet\n+from mongoengine.queryset import DoesNotExist, QuerySetNoCache\n from pymongo import ASCENDING\n \n from pulp.server import exceptions as pulp_exceptions\n \n \n-class CriteriaQuerySet(QuerySet):\n+class CustomQuerySet(QuerySetNoCache):\n+    \"\"\"\n+    All custom QuerySet classes should inherit from this class rather than QuerySet\n+    or QuerySetNoCache. There are two reasons for this. Firstly, all QuerySets should\n+    not cache their query results by default, so QuerySetNoCache must be inherited.\n+    Secondly, QuerySetNoCache's implementation of the `cache` instance method\n+    explicitly returns an instance of QuerySet which effectively removes any\n+    customized behavior for that QuerySet.\n+    \"\"\"\n+\n+    def cache(self):\n+        \"\"\"\n+        Currently, there is no reason to have a caching version of any of our\n+        custom QuerySet classes. If that ever changes, this method should be\n+        implemented to return a caching version of the custom QuerySet. This\n+        implementation exists in order to avoid bugs resulting from the\n+        unexpected default behavior of `cache`.\n+\n+        As of mongoengine 0.10, the default implementation of ``cache`` cannot\n+        be used as it explicitly creates a QuerySet object, thus removing any\n+        custom behavior of the custom QuerySet.\n+        \"\"\"\n+        raise NotImplementedError()\n+\n+    def __len__(self):","path":"server/pulp/server/db/querysets.py","position":33,"original_position":33,"commit_id":"9e40ea7a7ee22ebf9fbc8598b5a35b260bb6a46f","original_commit_id":"1501f29fb709733f76fa85f7b66bf31b1b01be81","user":{"login":"jeremycline","id":1977525,"avatar_url":"https://avatars.githubusercontent.com/u/1977525?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremycline","html_url":"https://github.com/jeremycline","followers_url":"https://api.github.com/users/jeremycline/followers","following_url":"https://api.github.com/users/jeremycline/following{/other_user}","gists_url":"https://api.github.com/users/jeremycline/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremycline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremycline/subscriptions","organizations_url":"https://api.github.com/users/jeremycline/orgs","repos_url":"https://api.github.com/users/jeremycline/repos","events_url":"https://api.github.com/users/jeremycline/events{/privacy}","received_events_url":"https://api.github.com/users/jeremycline/received_events","type":"User","site_admin":false},"body":"I find that argument compelling. ","created_at":"2015-12-08T19:36:14Z","updated_at":"2015-12-08T19:36:14Z","html_url":"https://github.com/pulp/pulp/pull/2221#discussion_r47001922","pull_request_url":"https://api.github.com/repos/pulp/pulp/pulls/2221","_links":{"self":{"href":"https://api.github.com/repos/pulp/pulp/pulls/comments/47001922"},"html":{"href":"https://github.com/pulp/pulp/pull/2221#discussion_r47001922"},"pull_request":{"href":"https://api.github.com/repos/pulp/pulp/pulls/2221"}}},"pull_request":{"url":"https://api.github.com/repos/pulp/pulp/pulls/2221","id":52713808,"html_url":"https://github.com/pulp/pulp/pull/2221","diff_url":"https://github.com/pulp/pulp/pull/2221.diff","patch_url":"https://github.com/pulp/pulp/pull/2221.patch","issue_url":"https://api.github.com/repos/pulp/pulp/issues/2221","number":2221,"state":"open","locked":false,"title":"Change all QuerySet objects to be QuerySetNoCache objects.","user":{"login":"jeremycline","id":1977525,"avatar_url":"https://avatars.githubusercontent.com/u/1977525?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremycline","html_url":"https://github.com/jeremycline","followers_url":"https://api.github.com/users/jeremycline/followers","following_url":"https://api.github.com/users/jeremycline/following{/other_user}","gists_url":"https://api.github.com/users/jeremycline/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremycline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremycline/subscriptions","organizations_url":"https://api.github.com/users/jeremycline/orgs","repos_url":"https://api.github.com/users/jeremycline/repos","events_url":"https://api.github.com/users/jeremycline/events{/privacy}","received_events_url":"https://api.github.com/users/jeremycline/received_events","type":"User","site_admin":false},"body":"In order to not cache query results by default, all models must\r\nuse QuerySet objects that are subclasses of QuerySetNoCache. This\r\nmodifies all our models that don't have custom QuerySet objects to\r\nuse the QuerySetNoCache by default (by inheriting from\r\nAutoRetryDocument) and introduces a superclass for all custom QuerySet\r\nclasses to use which derives from QuerySetNoCache.\r\n\r\ncloses #1395","created_at":"2015-12-04T19:56:42Z","updated_at":"2015-12-08T19:36:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07feff391596dae236b76ef6597240caa6a2ad03","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pulp/pulp/pulls/2221/commits","review_comments_url":"https://api.github.com/repos/pulp/pulp/pulls/2221/comments","review_comment_url":"https://api.github.com/repos/pulp/pulp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pulp/pulp/issues/2221/comments","statuses_url":"https://api.github.com/repos/pulp/pulp/statuses/9e40ea7a7ee22ebf9fbc8598b5a35b260bb6a46f","head":{"label":"jeremycline:no-no-cache","ref":"no-no-cache","sha":"9e40ea7a7ee22ebf9fbc8598b5a35b260bb6a46f","user":{"login":"jeremycline","id":1977525,"avatar_url":"https://avatars.githubusercontent.com/u/1977525?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremycline","html_url":"https://github.com/jeremycline","followers_url":"https://api.github.com/users/jeremycline/followers","following_url":"https://api.github.com/users/jeremycline/following{/other_user}","gists_url":"https://api.github.com/users/jeremycline/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremycline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremycline/subscriptions","organizations_url":"https://api.github.com/users/jeremycline/orgs","repos_url":"https://api.github.com/users/jeremycline/repos","events_url":"https://api.github.com/users/jeremycline/events{/privacy}","received_events_url":"https://api.github.com/users/jeremycline/received_events","type":"User","site_admin":false},"repo":{"id":24958984,"name":"pulp","full_name":"jeremycline/pulp","owner":{"login":"jeremycline","id":1977525,"avatar_url":"https://avatars.githubusercontent.com/u/1977525?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremycline","html_url":"https://github.com/jeremycline","followers_url":"https://api.github.com/users/jeremycline/followers","following_url":"https://api.github.com/users/jeremycline/following{/other_user}","gists_url":"https://api.github.com/users/jeremycline/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremycline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremycline/subscriptions","organizations_url":"https://api.github.com/users/jeremycline/orgs","repos_url":"https://api.github.com/users/jeremycline/repos","events_url":"https://api.github.com/users/jeremycline/events{/privacy}","received_events_url":"https://api.github.com/users/jeremycline/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeremycline/pulp","description":"Repository for Pulp platform code, including the server and base admin and consumer clients","fork":true,"url":"https://api.github.com/repos/jeremycline/pulp","forks_url":"https://api.github.com/repos/jeremycline/pulp/forks","keys_url":"https://api.github.com/repos/jeremycline/pulp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeremycline/pulp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeremycline/pulp/teams","hooks_url":"https://api.github.com/repos/jeremycline/pulp/hooks","issue_events_url":"https://api.github.com/repos/jeremycline/pulp/issues/events{/number}","events_url":"https://api.github.com/repos/jeremycline/pulp/events","assignees_url":"https://api.github.com/repos/jeremycline/pulp/assignees{/user}","branches_url":"https://api.github.com/repos/jeremycline/pulp/branches{/branch}","tags_url":"https://api.github.com/repos/jeremycline/pulp/tags","blobs_url":"https://api.github.com/repos/jeremycline/pulp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeremycline/pulp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeremycline/pulp/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeremycline/pulp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeremycline/pulp/statuses/{sha}","languages_url":"https://api.github.com/repos/jeremycline/pulp/languages","stargazers_url":"https://api.github.com/repos/jeremycline/pulp/stargazers","contributors_url":"https://api.github.com/repos/jeremycline/pulp/contributors","subscribers_url":"https://api.github.com/repos/jeremycline/pulp/subscribers","subscription_url":"https://api.github.com/repos/jeremycline/pulp/subscription","commits_url":"https://api.github.com/repos/jeremycline/pulp/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeremycline/pulp/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeremycline/pulp/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeremycline/pulp/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeremycline/pulp/contents/{+path}","compare_url":"https://api.github.com/repos/jeremycline/pulp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeremycline/pulp/merges","archive_url":"https://api.github.com/repos/jeremycline/pulp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeremycline/pulp/downloads","issues_url":"https://api.github.com/repos/jeremycline/pulp/issues{/number}","pulls_url":"https://api.github.com/repos/jeremycline/pulp/pulls{/number}","milestones_url":"https://api.github.com/repos/jeremycline/pulp/milestones{/number}","notifications_url":"https://api.github.com/repos/jeremycline/pulp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeremycline/pulp/labels{/name}","releases_url":"https://api.github.com/repos/jeremycline/pulp/releases{/id}","created_at":"2014-10-08T20:18:50Z","updated_at":"2015-01-15T14:25:50Z","pushed_at":"2015-12-08T19:35:36Z","git_url":"git://github.com/jeremycline/pulp.git","ssh_url":"git@github.com:jeremycline/pulp.git","clone_url":"https://github.com/jeremycline/pulp.git","svn_url":"https://github.com/jeremycline/pulp","homepage":"","size":87465,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pulp:master","ref":"master","sha":"94f7a98c6628667045c67cd3da2be38f47e175e6","user":{"login":"pulp","id":2103606,"avatar_url":"https://avatars.githubusercontent.com/u/2103606?v=3","gravatar_id":"","url":"https://api.github.com/users/pulp","html_url":"https://github.com/pulp","followers_url":"https://api.github.com/users/pulp/followers","following_url":"https://api.github.com/users/pulp/following{/other_user}","gists_url":"https://api.github.com/users/pulp/gists{/gist_id}","starred_url":"https://api.github.com/users/pulp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulp/subscriptions","organizations_url":"https://api.github.com/users/pulp/orgs","repos_url":"https://api.github.com/users/pulp/repos","events_url":"https://api.github.com/users/pulp/events{/privacy}","received_events_url":"https://api.github.com/users/pulp/received_events","type":"Organization","site_admin":false},"repo":{"id":5314652,"name":"pulp","full_name":"pulp/pulp","owner":{"login":"pulp","id":2103606,"avatar_url":"https://avatars.githubusercontent.com/u/2103606?v=3","gravatar_id":"","url":"https://api.github.com/users/pulp","html_url":"https://github.com/pulp","followers_url":"https://api.github.com/users/pulp/followers","following_url":"https://api.github.com/users/pulp/following{/other_user}","gists_url":"https://api.github.com/users/pulp/gists{/gist_id}","starred_url":"https://api.github.com/users/pulp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulp/subscriptions","organizations_url":"https://api.github.com/users/pulp/orgs","repos_url":"https://api.github.com/users/pulp/repos","events_url":"https://api.github.com/users/pulp/events{/privacy}","received_events_url":"https://api.github.com/users/pulp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pulp/pulp","description":"Repository for Pulp platform code, including the server and base admin and consumer clients","fork":false,"url":"https://api.github.com/repos/pulp/pulp","forks_url":"https://api.github.com/repos/pulp/pulp/forks","keys_url":"https://api.github.com/repos/pulp/pulp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pulp/pulp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pulp/pulp/teams","hooks_url":"https://api.github.com/repos/pulp/pulp/hooks","issue_events_url":"https://api.github.com/repos/pulp/pulp/issues/events{/number}","events_url":"https://api.github.com/repos/pulp/pulp/events","assignees_url":"https://api.github.com/repos/pulp/pulp/assignees{/user}","branches_url":"https://api.github.com/repos/pulp/pulp/branches{/branch}","tags_url":"https://api.github.com/repos/pulp/pulp/tags","blobs_url":"https://api.github.com/repos/pulp/pulp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pulp/pulp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pulp/pulp/git/refs{/sha}","trees_url":"https://api.github.com/repos/pulp/pulp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pulp/pulp/statuses/{sha}","languages_url":"https://api.github.com/repos/pulp/pulp/languages","stargazers_url":"https://api.github.com/repos/pulp/pulp/stargazers","contributors_url":"https://api.github.com/repos/pulp/pulp/contributors","subscribers_url":"https://api.github.com/repos/pulp/pulp/subscribers","subscription_url":"https://api.github.com/repos/pulp/pulp/subscription","commits_url":"https://api.github.com/repos/pulp/pulp/commits{/sha}","git_commits_url":"https://api.github.com/repos/pulp/pulp/git/commits{/sha}","comments_url":"https://api.github.com/repos/pulp/pulp/comments{/number}","issue_comment_url":"https://api.github.com/repos/pulp/pulp/issues/comments{/number}","contents_url":"https://api.github.com/repos/pulp/pulp/contents/{+path}","compare_url":"https://api.github.com/repos/pulp/pulp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pulp/pulp/merges","archive_url":"https://api.github.com/repos/pulp/pulp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pulp/pulp/downloads","issues_url":"https://api.github.com/repos/pulp/pulp/issues{/number}","pulls_url":"https://api.github.com/repos/pulp/pulp/pulls{/number}","milestones_url":"https://api.github.com/repos/pulp/pulp/milestones{/number}","notifications_url":"https://api.github.com/repos/pulp/pulp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pulp/pulp/labels{/name}","releases_url":"https://api.github.com/repos/pulp/pulp/releases{/id}","created_at":"2012-08-06T13:49:20Z","updated_at":"2015-11-27T16:33:23Z","pushed_at":"2015-12-08T19:35:36Z","git_url":"git://github.com/pulp/pulp.git","ssh_url":"git@github.com:pulp/pulp.git","clone_url":"https://github.com/pulp/pulp.git","svn_url":"https://github.com/pulp/pulp","homepage":"","size":88457,"stargazers_count":232,"watchers_count":232,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":92,"mirror_url":null,"open_issues_count":15,"forks":92,"open_issues":15,"watchers":232,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pulp/pulp/pulls/2221"},"html":{"href":"https://github.com/pulp/pulp/pull/2221"},"issue":{"href":"https://api.github.com/repos/pulp/pulp/issues/2221"},"comments":{"href":"https://api.github.com/repos/pulp/pulp/issues/2221/comments"},"review_comments":{"href":"https://api.github.com/repos/pulp/pulp/pulls/2221/comments"},"review_comment":{"href":"https://api.github.com/repos/pulp/pulp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pulp/pulp/pulls/2221/commits"},"statuses":{"href":"https://api.github.com/repos/pulp/pulp/statuses/9e40ea7a7ee22ebf9fbc8598b5a35b260bb6a46f"}}}}