{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-services/readinglist/pulls/comments/24581052","id":24581052,"diff_hunk":"@@ -72,16 +73,33 @@ def update(self, resource, user_id, record_id, record):\n     def delete(self, resource, user_id, record_id):\n         resource_name = classname(resource)\n         existing = self.get(resource, user_id, record_id)\n-        self._bump_timestamp(resource, user_id)\n+        self.set_record_timestamp(resource, user_id, existing)\n+        existing = self.strip_deleted_record(resource, user_id, existing)\n+\n+        # Add to deleted items, remove from store.\n+        self._cemetery[resource_name][user_id][record_id] = existing.copy()\n         self._store[resource_name][user_id].pop(record_id)\n+\n         return existing\n \n     def get_all(self, resource, user_id, filters=None, sorting=None,\n-                pagination_rules=None, limit=None):\n+                pagination_rules=None, limit=None, include_deleted=False):\n         resource_name = classname(resource)\n-        records = self._store[resource_name][user_id].values()\n-        return extract_record_set(records, filters, sorting,\n-                                  pagination_rules, limit)\n+        records = list(self._store[resource_name][user_id].values())\n+\n+        deleted = {}\n+        if include_deleted:\n+            deleted = self._cemetery[resource_name][user_id]\n+\n+        records, count = extract_record_set(resource,\n+                                            records + list(deleted.values()),\n+                                            filters, sorting,\n+                                            pagination_rules, limit)\n+\n+        filtered_deleted = len([r for r in records\n+                                if r[resource.id_field] in deleted])\n+\n+        return records, count - filtered_deleted","path":"readinglist/storage/memory.py","position":43,"original_position":43,"commit_id":"82744d854205dec3250d28293cc89ed53baa6354","original_commit_id":"82744d854205dec3250d28293cc89ed53baa6354","user":{"login":"Natim","id":229453,"avatar_url":"https://avatars.githubusercontent.com/u/229453?v=3","gravatar_id":"","url":"https://api.github.com/users/Natim","html_url":"https://github.com/Natim","followers_url":"https://api.github.com/users/Natim/followers","following_url":"https://api.github.com/users/Natim/following{/other_user}","gists_url":"https://api.github.com/users/Natim/gists{/gist_id}","starred_url":"https://api.github.com/users/Natim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Natim/subscriptions","organizations_url":"https://api.github.com/users/Natim/orgs","repos_url":"https://api.github.com/users/Natim/repos","events_url":"https://api.github.com/users/Natim/events{/privacy}","received_events_url":"https://api.github.com/users/Natim/received_events","type":"User","site_admin":false},"body":"There are not part of the collection since they've been deleted.","created_at":"2015-02-12T13:47:25Z","updated_at":"2015-02-12T13:47:25Z","html_url":"https://github.com/mozilla-services/readinglist/pull/106#discussion_r24581052","pull_request_url":"https://api.github.com/repos/mozilla-services/readinglist/pulls/106","_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/readinglist/pulls/comments/24581052"},"html":{"href":"https://github.com/mozilla-services/readinglist/pull/106#discussion_r24581052"},"pull_request":{"href":"https://api.github.com/repos/mozilla-services/readinglist/pulls/106"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-services/readinglist/pulls/106","id":28924313,"html_url":"https://github.com/mozilla-services/readinglist/pull/106","diff_url":"https://github.com/mozilla-services/readinglist/pull/106.diff","patch_url":"https://github.com/mozilla-services/readinglist/pull/106.patch","issue_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/106","number":106,"state":"open","locked":false,"title":"Handle deleted items","user":{"login":"leplatrem","id":546692,"avatar_url":"https://avatars.githubusercontent.com/u/546692?v=3","gravatar_id":"","url":"https://api.github.com/users/leplatrem","html_url":"https://github.com/leplatrem","followers_url":"https://api.github.com/users/leplatrem/followers","following_url":"https://api.github.com/users/leplatrem/following{/other_user}","gists_url":"https://api.github.com/users/leplatrem/gists{/gist_id}","starred_url":"https://api.github.com/users/leplatrem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leplatrem/subscriptions","organizations_url":"https://api.github.com/users/leplatrem/orgs","repos_url":"https://api.github.com/users/leplatrem/repos","events_url":"https://api.github.com/users/leplatrem/events{/privacy}","received_events_url":"https://api.github.com/users/leplatrem/received_events","type":"User","site_admin":false},"body":"Fixes #41 \r\n\r\n* [x] Basic behaviour, strategy and unit tests\r\n* [x] Redis backend implem\r\n* [x] Test that deleted articles have no attributes anymore (already test in backend)\r\n* [x] Test that filtering works on status=2\r\n* [x] Test that sorting works on deleted in resource tests\r\n* [x] Test that sorting works on status in article tests\r\n* [x] Test that unicity for deleted items does not interfere\r\n* [x] Update docs\r\n* [x] Update load tests\r\n* [ ] ~~Find a strategy to purge deleted items~~ #107","created_at":"2015-02-09T14:30:45Z","updated_at":"2015-02-12T13:47:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b23cebf018013b55e295e0ee440ad47a55650add","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-services/readinglist/pulls/106/commits","review_comments_url":"https://api.github.com/repos/mozilla-services/readinglist/pulls/106/comments","review_comment_url":"https://api.github.com/repos/mozilla-services/readinglist/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/106/comments","statuses_url":"https://api.github.com/repos/mozilla-services/readinglist/statuses/82744d854205dec3250d28293cc89ed53baa6354","head":{"label":"mozilla-services:41-deleted-items","ref":"41-deleted-items","sha":"82744d854205dec3250d28293cc89ed53baa6354","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":27563721,"name":"readinglist","full_name":"mozilla-services/readinglist","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/readinglist","description":"Reading List Server","fork":false,"url":"https://api.github.com/repos/mozilla-services/readinglist","forks_url":"https://api.github.com/repos/mozilla-services/readinglist/forks","keys_url":"https://api.github.com/repos/mozilla-services/readinglist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/readinglist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/readinglist/teams","hooks_url":"https://api.github.com/repos/mozilla-services/readinglist/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/readinglist/events","assignees_url":"https://api.github.com/repos/mozilla-services/readinglist/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/readinglist/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/readinglist/tags","blobs_url":"https://api.github.com/repos/mozilla-services/readinglist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/readinglist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/readinglist/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/readinglist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/readinglist/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/readinglist/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/readinglist/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/readinglist/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/readinglist/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/readinglist/subscription","commits_url":"https://api.github.com/repos/mozilla-services/readinglist/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/readinglist/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/readinglist/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla-services/readinglist/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/readinglist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/readinglist/merges","archive_url":"https://api.github.com/repos/mozilla-services/readinglist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/readinglist/downloads","issues_url":"https://api.github.com/repos/mozilla-services/readinglist/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/readinglist/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/readinglist/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/readinglist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/readinglist/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/readinglist/releases{/id}","created_at":"2014-12-04T22:48:28Z","updated_at":"2015-02-12T11:57:35Z","pushed_at":"2015-02-12T13:30:09Z","git_url":"git://github.com/mozilla-services/readinglist.git","ssh_url":"git@github.com:mozilla-services/readinglist.git","clone_url":"https://github.com/mozilla-services/readinglist.git","svn_url":"https://github.com/mozilla-services/readinglist","homepage":null,"size":3444,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":22,"forks":1,"open_issues":22,"watchers":4,"default_branch":"master"}},"base":{"label":"mozilla-services:master","ref":"master","sha":"5b2637b3428549b542716dc97ec43947f5fe2c93","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":27563721,"name":"readinglist","full_name":"mozilla-services/readinglist","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/readinglist","description":"Reading List Server","fork":false,"url":"https://api.github.com/repos/mozilla-services/readinglist","forks_url":"https://api.github.com/repos/mozilla-services/readinglist/forks","keys_url":"https://api.github.com/repos/mozilla-services/readinglist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/readinglist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/readinglist/teams","hooks_url":"https://api.github.com/repos/mozilla-services/readinglist/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/readinglist/events","assignees_url":"https://api.github.com/repos/mozilla-services/readinglist/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/readinglist/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/readinglist/tags","blobs_url":"https://api.github.com/repos/mozilla-services/readinglist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/readinglist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/readinglist/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/readinglist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/readinglist/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/readinglist/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/readinglist/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/readinglist/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/readinglist/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/readinglist/subscription","commits_url":"https://api.github.com/repos/mozilla-services/readinglist/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/readinglist/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/readinglist/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/readinglist/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla-services/readinglist/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/readinglist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/readinglist/merges","archive_url":"https://api.github.com/repos/mozilla-services/readinglist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/readinglist/downloads","issues_url":"https://api.github.com/repos/mozilla-services/readinglist/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/readinglist/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/readinglist/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/readinglist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/readinglist/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/readinglist/releases{/id}","created_at":"2014-12-04T22:48:28Z","updated_at":"2015-02-12T11:57:35Z","pushed_at":"2015-02-12T13:30:09Z","git_url":"git://github.com/mozilla-services/readinglist.git","ssh_url":"git@github.com:mozilla-services/readinglist.git","clone_url":"https://github.com/mozilla-services/readinglist.git","svn_url":"https://github.com/mozilla-services/readinglist","homepage":null,"size":3444,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":22,"forks":1,"open_issues":22,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/readinglist/pulls/106"},"html":{"href":"https://github.com/mozilla-services/readinglist/pull/106"},"issue":{"href":"https://api.github.com/repos/mozilla-services/readinglist/issues/106"},"comments":{"href":"https://api.github.com/repos/mozilla-services/readinglist/issues/106/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-services/readinglist/pulls/106/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-services/readinglist/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla-services/readinglist/pulls/106/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-services/readinglist/statuses/82744d854205dec3250d28293cc89ed53baa6354"}}}}