{"action":"created","comment":{"url":"https://api.github.com/repos/pulp/pulp/pulls/comments/32056146","id":32056146,"diff_hunk":"@@ -0,0 +1,111 @@\n+import logging\n+\n+from pulp.common import dateutils\n+from pulp.plugins.loader import api as plugin_api\n+from pulp.server.db import connection, model\n+\n+_logger = logging.getLogger(__name__)\n+\n+\n+def find_repo_content_units(\n+        repository, repo_content_unit_q=None,\n+        units_q=None, units_fields=None, limit=None, skip=None):\n+    \"\"\"\n+    Search content units associated with a given repository\n+\n+    Each association returned will have a parameter \"unit\" set to the actual unit\n+\n+    :param repository: The repository to search.\n+    :type repository: pulp.server.db.model.Repository\n+    :param repo_content_unit_q: Any query filters to apply to the RepoContentUnits.\n+    :type repo_content_unit_q: mongoengine.Q\n+    :param units_q: Any query filters to apply to the ContentUnits.\n+    :type units_q: mongoengine.Q\n+    :param units_fields: List of fields to fetch for the unit objects, defaults to all fields\n+    :type units_fields: List of str\n+    :param limit: The maximum number of items to return for the given query.\n+    :type limit: int\n+    :param skip: The starting offset.\n+    :type skip: int\n+    :return: Content unit assoociations matching the query.\n+    :rtype: generator of pulp.server.db.model.ContentUnit\n+    \"\"\"\n+\n+    qs = model.RepositoryContentUnit.objects(q_obj=repo_content_unit_q,\n+                                             repo_id=repository.repo_id)\n+\n+    type_map = {}\n+    content_units = {}\n+\n+    yield_count = 1\n+    skip_count = 0\n+\n+    for repo_content_unit in qs:\n+        id_set = type_map.setdefault(repo_content_unit.unit_type_id, set())","path":"server/pulp/server/controllers/repository.py","position":44,"original_position":44,"commit_id":"096da2879dd4e24926a8f7f76d95e2cf550d7bb7","original_commit_id":"096da2879dd4e24926a8f7f76d95e2cf550d7bb7","user":{"login":"bmbouter","id":180319,"avatar_url":"https://avatars.githubusercontent.com/u/180319?v=3","gravatar_id":"","url":"https://api.github.com/users/bmbouter","html_url":"https://github.com/bmbouter","followers_url":"https://api.github.com/users/bmbouter/followers","following_url":"https://api.github.com/users/bmbouter/following{/other_user}","gists_url":"https://api.github.com/users/bmbouter/gists{/gist_id}","starred_url":"https://api.github.com/users/bmbouter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmbouter/subscriptions","organizations_url":"https://api.github.com/users/bmbouter/orgs","repos_url":"https://api.github.com/users/bmbouter/repos","events_url":"https://api.github.com/users/bmbouter/events{/privacy}","received_events_url":"https://api.github.com/users/bmbouter/received_events","type":"User","site_admin":false},"body":"I did not know about `setdefault`, that is sweet.","created_at":"2015-06-09T19:55:55Z","updated_at":"2015-06-09T19:55:55Z","html_url":"https://github.com/pulp/pulp/pull/1912#discussion_r32056146","pull_request_url":"https://api.github.com/repos/pulp/pulp/pulls/1912","_links":{"self":{"href":"https://api.github.com/repos/pulp/pulp/pulls/comments/32056146"},"html":{"href":"https://github.com/pulp/pulp/pull/1912#discussion_r32056146"},"pull_request":{"href":"https://api.github.com/repos/pulp/pulp/pulls/1912"}}},"pull_request":{"url":"https://api.github.com/repos/pulp/pulp/pulls/1912","id":37148935,"html_url":"https://github.com/pulp/pulp/pull/1912","diff_url":"https://github.com/pulp/pulp/pull/1912.diff","patch_url":"https://github.com/pulp/pulp/pull/1912.patch","issue_url":"https://api.github.com/repos/pulp/pulp/issues/1912","number":1912,"state":"open","locked":false,"title":"Add unit querying & association support required for plugin conversio…","user":{"login":"barnabycourt","id":5054204,"avatar_url":"https://avatars.githubusercontent.com/u/5054204?v=3","gravatar_id":"","url":"https://api.github.com/users/barnabycourt","html_url":"https://github.com/barnabycourt","followers_url":"https://api.github.com/users/barnabycourt/followers","following_url":"https://api.github.com/users/barnabycourt/following{/other_user}","gists_url":"https://api.github.com/users/barnabycourt/gists{/gist_id}","starred_url":"https://api.github.com/users/barnabycourt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barnabycourt/subscriptions","organizations_url":"https://api.github.com/users/barnabycourt/orgs","repos_url":"https://api.github.com/users/barnabycourt/repos","events_url":"https://api.github.com/users/barnabycourt/events{/privacy}","received_events_url":"https://api.github.com/users/barnabycourt/received_events","type":"User","site_admin":false},"body":"…n to mongoengine\r\n\r\nhttps://pulp.plan.io/issues/862\r\n\r\nMoving from https://github.com/pulp/pulp/pull/1886, as we want to target 2.8.x instead of 2.7.x","created_at":"2015-06-08T12:40:06Z","updated_at":"2015-06-09T19:55:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7fc3e5914340c175436eddca1e7fef95dee65b44","assignee":{"login":"bmbouter","id":180319,"avatar_url":"https://avatars.githubusercontent.com/u/180319?v=3","gravatar_id":"","url":"https://api.github.com/users/bmbouter","html_url":"https://github.com/bmbouter","followers_url":"https://api.github.com/users/bmbouter/followers","following_url":"https://api.github.com/users/bmbouter/following{/other_user}","gists_url":"https://api.github.com/users/bmbouter/gists{/gist_id}","starred_url":"https://api.github.com/users/bmbouter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmbouter/subscriptions","organizations_url":"https://api.github.com/users/bmbouter/orgs","repos_url":"https://api.github.com/users/bmbouter/repos","events_url":"https://api.github.com/users/bmbouter/events{/privacy}","received_events_url":"https://api.github.com/users/bmbouter/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/pulp/pulp/pulls/1912/commits","review_comments_url":"https://api.github.com/repos/pulp/pulp/pulls/1912/comments","review_comment_url":"https://api.github.com/repos/pulp/pulp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pulp/pulp/issues/1912/comments","statuses_url":"https://api.github.com/repos/pulp/pulp/statuses/096da2879dd4e24926a8f7f76d95e2cf550d7bb7","head":{"label":"barnabycourt:unit_query_and_docker_support","ref":"unit_query_and_docker_support","sha":"096da2879dd4e24926a8f7f76d95e2cf550d7bb7","user":{"login":"barnabycourt","id":5054204,"avatar_url":"https://avatars.githubusercontent.com/u/5054204?v=3","gravatar_id":"","url":"https://api.github.com/users/barnabycourt","html_url":"https://github.com/barnabycourt","followers_url":"https://api.github.com/users/barnabycourt/followers","following_url":"https://api.github.com/users/barnabycourt/following{/other_user}","gists_url":"https://api.github.com/users/barnabycourt/gists{/gist_id}","starred_url":"https://api.github.com/users/barnabycourt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barnabycourt/subscriptions","organizations_url":"https://api.github.com/users/barnabycourt/orgs","repos_url":"https://api.github.com/users/barnabycourt/repos","events_url":"https://api.github.com/users/barnabycourt/events{/privacy}","received_events_url":"https://api.github.com/users/barnabycourt/received_events","type":"User","site_admin":false},"repo":{"id":25038093,"name":"pulp","full_name":"barnabycourt/pulp","owner":{"login":"barnabycourt","id":5054204,"avatar_url":"https://avatars.githubusercontent.com/u/5054204?v=3","gravatar_id":"","url":"https://api.github.com/users/barnabycourt","html_url":"https://github.com/barnabycourt","followers_url":"https://api.github.com/users/barnabycourt/followers","following_url":"https://api.github.com/users/barnabycourt/following{/other_user}","gists_url":"https://api.github.com/users/barnabycourt/gists{/gist_id}","starred_url":"https://api.github.com/users/barnabycourt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barnabycourt/subscriptions","organizations_url":"https://api.github.com/users/barnabycourt/orgs","repos_url":"https://api.github.com/users/barnabycourt/repos","events_url":"https://api.github.com/users/barnabycourt/events{/privacy}","received_events_url":"https://api.github.com/users/barnabycourt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/barnabycourt/pulp","description":"Repository for Pulp platform code, including the server and base admin and consumer clients","fork":true,"url":"https://api.github.com/repos/barnabycourt/pulp","forks_url":"https://api.github.com/repos/barnabycourt/pulp/forks","keys_url":"https://api.github.com/repos/barnabycourt/pulp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/barnabycourt/pulp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/barnabycourt/pulp/teams","hooks_url":"https://api.github.com/repos/barnabycourt/pulp/hooks","issue_events_url":"https://api.github.com/repos/barnabycourt/pulp/issues/events{/number}","events_url":"https://api.github.com/repos/barnabycourt/pulp/events","assignees_url":"https://api.github.com/repos/barnabycourt/pulp/assignees{/user}","branches_url":"https://api.github.com/repos/barnabycourt/pulp/branches{/branch}","tags_url":"https://api.github.com/repos/barnabycourt/pulp/tags","blobs_url":"https://api.github.com/repos/barnabycourt/pulp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/barnabycourt/pulp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/barnabycourt/pulp/git/refs{/sha}","trees_url":"https://api.github.com/repos/barnabycourt/pulp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/barnabycourt/pulp/statuses/{sha}","languages_url":"https://api.github.com/repos/barnabycourt/pulp/languages","stargazers_url":"https://api.github.com/repos/barnabycourt/pulp/stargazers","contributors_url":"https://api.github.com/repos/barnabycourt/pulp/contributors","subscribers_url":"https://api.github.com/repos/barnabycourt/pulp/subscribers","subscription_url":"https://api.github.com/repos/barnabycourt/pulp/subscription","commits_url":"https://api.github.com/repos/barnabycourt/pulp/commits{/sha}","git_commits_url":"https://api.github.com/repos/barnabycourt/pulp/git/commits{/sha}","comments_url":"https://api.github.com/repos/barnabycourt/pulp/comments{/number}","issue_comment_url":"https://api.github.com/repos/barnabycourt/pulp/issues/comments{/number}","contents_url":"https://api.github.com/repos/barnabycourt/pulp/contents/{+path}","compare_url":"https://api.github.com/repos/barnabycourt/pulp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/barnabycourt/pulp/merges","archive_url":"https://api.github.com/repos/barnabycourt/pulp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/barnabycourt/pulp/downloads","issues_url":"https://api.github.com/repos/barnabycourt/pulp/issues{/number}","pulls_url":"https://api.github.com/repos/barnabycourt/pulp/pulls{/number}","milestones_url":"https://api.github.com/repos/barnabycourt/pulp/milestones{/number}","notifications_url":"https://api.github.com/repos/barnabycourt/pulp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/barnabycourt/pulp/labels{/name}","releases_url":"https://api.github.com/repos/barnabycourt/pulp/releases{/id}","created_at":"2014-10-10T14:04:33Z","updated_at":"2015-02-16T16:32:27Z","pushed_at":"2015-06-05T18:21:39Z","git_url":"git://github.com/barnabycourt/pulp.git","ssh_url":"git@github.com:barnabycourt/pulp.git","clone_url":"https://github.com/barnabycourt/pulp.git","svn_url":"https://github.com/barnabycourt/pulp","homepage":"","size":83416,"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":"6094391e6bfe31e0aa64ce7f42b5da1bb6d47ee8","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-06-06T14:37:27Z","pushed_at":"2015-06-09T18:26:09Z","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":205057,"stargazers_count":204,"watchers_count":204,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":81,"mirror_url":null,"open_issues_count":21,"forks":81,"open_issues":21,"watchers":204,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pulp/pulp/pulls/1912"},"html":{"href":"https://github.com/pulp/pulp/pull/1912"},"issue":{"href":"https://api.github.com/repos/pulp/pulp/issues/1912"},"comments":{"href":"https://api.github.com/repos/pulp/pulp/issues/1912/comments"},"review_comments":{"href":"https://api.github.com/repos/pulp/pulp/pulls/1912/comments"},"review_comment":{"href":"https://api.github.com/repos/pulp/pulp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pulp/pulp/pulls/1912/commits"},"statuses":{"href":"https://api.github.com/repos/pulp/pulp/statuses/096da2879dd4e24926a8f7f76d95e2cf550d7bb7"}}}}