GitHub PullRequestReviewCommentEvent at 2014-10-09 14:50:54
Repository: django
Actor: mjtamlyn
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/18649598","id":18649598,"diff_hunk":"@@ -14,3 +18,48 @@ class ArrayMinLengthValidator(MinLengthValidator):\n         'List contains %(show_value)d item, it should contain no fewer than %(limit_value)d.',\n         'List contains %(show_value)d items, it should contain no fewer than %(limit_value)d.',\n         'limit_value')\n+\n+\n+@deconstructible\n+class KeysValidator(object):\n+    \"\"\"A validator designed for HStore to require/restrict keys.\"\"\"\n+\n+    messages = {\n+        'missing_keys': _('Some keys were missing: %(keys)s'),\n+        'extra_keys': _('Some unknown keys were provided: %(keys)s'),\n+    }\n+    strict = False\n+\n+    def __init__(self, keys, strict=False, messages=None):\n+        self.keys = set(keys)\n+        self.strict = strict\n+        if messages is not None:\n+            self.messages = copy.copy(self.messages)\n+            self.messages.update(messages)\n+\n+    def __call__(self, value):\n+        keys = set(value.keys())","path":"django/contrib/postgres/validators.py","position":35,"original_position":35,"commit_id":"5cf9a102ebcd4a9579df2d90afe7880e3de24410","original_commit_id":"5cf9a102ebcd4a9579df2d90afe7880e3de24410","user":{"login":"mjtamlyn","id":389581,"avatar_url":"https://avatars.githubusercontent.com/u/389581?v=2","gravatar_id":"","url":"https://api.github.com/users/mjtamlyn","html_url":"https://github.com/mjtamlyn","followers_url":"https://api.github.com/users/mjtamlyn/followers","following_url":"https://api.github.com/users/mjtamlyn/following{/other_user}","gists_url":"https://api.github.com/users/mjtamlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mjtamlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjtamlyn/subscriptions","organizations_url":"https://api.github.com/users/mjtamlyn/orgs","repos_url":"https://api.github.com/users/mjtamlyn/repos","events_url":"https://api.github.com/users/mjtamlyn/events{/privacy}","received_events_url":"https://api.github.com/users/mjtamlyn/received_events","type":"User","site_admin":false},"body":"It does work but I think this is clearer.","created_at":"2014-10-09T14:50:54Z","updated_at":"2014-10-09T14:50:54Z","html_url":"https://github.com/django/django/pull/3219#discussion_r18649598","pull_request_url":"https://api.github.com/repos/django/django/pulls/3219","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/18649598"},"html":{"href":"https://github.com/django/django/pull/3219#discussion_r18649598"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/3219"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/3219","id":21201949,"html_url":"https://github.com/django/django/pull/3219","diff_url":"https://github.com/django/django/pull/3219.diff","patch_url":"https://github.com/django/django/pull/3219.patch","issue_url":"https://api.github.com/repos/django/django/issues/3219","number":3219,"state":"open","locked":false,"title":"[contib.postgres] HStorefield","user":{"login":"mjtamlyn","id":389581,"avatar_url":"https://avatars.githubusercontent.com/u/389581?v=2","gravatar_id":"","url":"https://api.github.com/users/mjtamlyn","html_url":"https://github.com/mjtamlyn","followers_url":"https://api.github.com/users/mjtamlyn/followers","following_url":"https://api.github.com/users/mjtamlyn/following{/other_user}","gists_url":"https://api.github.com/users/mjtamlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mjtamlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjtamlyn/subscriptions","organizations_url":"https://api.github.com/users/mjtamlyn/orgs","repos_url":"https://api.github.com/users/mjtamlyn/repos","events_url":"https://api.github.com/users/mjtamlyn/events{/privacy}","received_events_url":"https://api.github.com/users/mjtamlyn/received_events","type":"User","site_admin":false},"body":"Beginnings of an `hstore` implementation. TODO:\r\n\r\n- [x] support migrations to create the extension and register with psycopg2\r\n- [x] expand the field definition, including restriction of variables\r\n- [x] form field\r\n- [x] add lookups\r\n- [x] docs\r\n- [x] validator\r\n\r\nThere is a design decision to make: do we want a simplistic hstore field which follows the rules of hstore itself - restricts to strings and null, or do we want something a bit more clever like `django-hstore` provides that does some json encoding on non-string types? I currently lean towards the former as we will also have support for a `jsonb` field for more rich data. This would also remove a lot of complexity from the `django-hstore` implementation - descriptors, subclasses of dict etc.","created_at":"2014-09-14T08:40:53Z","updated_at":"2014-10-09T14:50:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33eb1d1024a933f985e9b1f83217d8c90539b4ca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/3219/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/3219/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments/{number}","comments_url":"https://api.github.com/repos/django/django/issues/3219/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/5cf9a102ebcd4a9579df2d90afe7880e3de24410","head":{"label":"mjtamlyn:dcp-hstore","ref":"dcp-hstore","sha":"5cf9a102ebcd4a9579df2d90afe7880e3de24410","user":{"login":"mjtamlyn","id":389581,"avatar_url":"https://avatars.githubusercontent.com/u/389581?v=2","gravatar_id":"","url":"https://api.github.com/users/mjtamlyn","html_url":"https://github.com/mjtamlyn","followers_url":"https://api.github.com/users/mjtamlyn/followers","following_url":"https://api.github.com/users/mjtamlyn/following{/other_user}","gists_url":"https://api.github.com/users/mjtamlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mjtamlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjtamlyn/subscriptions","organizations_url":"https://api.github.com/users/mjtamlyn/orgs","repos_url":"https://api.github.com/users/mjtamlyn/repos","events_url":"https://api.github.com/users/mjtamlyn/events{/privacy}","received_events_url":"https://api.github.com/users/mjtamlyn/received_events","type":"User","site_admin":false},"repo":{"id":4529204,"name":"django","full_name":"mjtamlyn/django","owner":{"login":"mjtamlyn","id":389581,"avatar_url":"https://avatars.githubusercontent.com/u/389581?v=2","gravatar_id":"","url":"https://api.github.com/users/mjtamlyn","html_url":"https://github.com/mjtamlyn","followers_url":"https://api.github.com/users/mjtamlyn/followers","following_url":"https://api.github.com/users/mjtamlyn/following{/other_user}","gists_url":"https://api.github.com/users/mjtamlyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mjtamlyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjtamlyn/subscriptions","organizations_url":"https://api.github.com/users/mjtamlyn/orgs","repos_url":"https://api.github.com/users/mjtamlyn/repos","events_url":"https://api.github.com/users/mjtamlyn/events{/privacy}","received_events_url":"https://api.github.com/users/mjtamlyn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mjtamlyn/django","description":"The Web framework for perfectionists with deadlines. Now on GitHub.","fork":true,"url":"https://api.github.com/repos/mjtamlyn/django","forks_url":"https://api.github.com/repos/mjtamlyn/django/forks","keys_url":"https://api.github.com/repos/mjtamlyn/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mjtamlyn/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mjtamlyn/django/teams","hooks_url":"https://api.github.com/repos/mjtamlyn/django/hooks","issue_events_url":"https://api.github.com/repos/mjtamlyn/django/issues/events{/number}","events_url":"https://api.github.com/repos/mjtamlyn/django/events","assignees_url":"https://api.github.com/repos/mjtamlyn/django/assignees{/user}","branches_url":"https://api.github.com/repos/mjtamlyn/django/branches{/branch}","tags_url":"https://api.github.com/repos/mjtamlyn/django/tags","blobs_url":"https://api.github.com/repos/mjtamlyn/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mjtamlyn/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mjtamlyn/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/mjtamlyn/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mjtamlyn/django/statuses/{sha}","languages_url":"https://api.github.com/repos/mjtamlyn/django/languages","stargazers_url":"https://api.github.com/repos/mjtamlyn/django/stargazers","contributors_url":"https://api.github.com/repos/mjtamlyn/django/contributors","subscribers_url":"https://api.github.com/repos/mjtamlyn/django/subscribers","subscription_url":"https://api.github.com/repos/mjtamlyn/django/subscription","commits_url":"https://api.github.com/repos/mjtamlyn/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/mjtamlyn/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/mjtamlyn/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/mjtamlyn/django/issues/comments/{number}","contents_url":"https://api.github.com/repos/mjtamlyn/django/contents/{+path}","compare_url":"https://api.github.com/repos/mjtamlyn/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mjtamlyn/django/merges","archive_url":"https://api.github.com/repos/mjtamlyn/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mjtamlyn/django/downloads","issues_url":"https://api.github.com/repos/mjtamlyn/django/issues{/number}","pulls_url":"https://api.github.com/repos/mjtamlyn/django/pulls{/number}","milestones_url":"https://api.github.com/repos/mjtamlyn/django/milestones{/number}","notifications_url":"https://api.github.com/repos/mjtamlyn/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mjtamlyn/django/labels{/name}","releases_url":"https://api.github.com/repos/mjtamlyn/django/releases{/id}","created_at":"2012-06-02T12:56:52Z","updated_at":"2014-08-28T19:35:13Z","pushed_at":"2014-10-04T11:19:29Z","git_url":"git://github.com/mjtamlyn/django.git","ssh_url":"git@github.com:mjtamlyn/django.git","clone_url":"https://github.com/mjtamlyn/django.git","svn_url":"https://github.com/mjtamlyn/django","homepage":"http://www.djangoproject.com/","size":96146,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"django:master","ref":"master","sha":"6426928f5665953b93f6887e9bf9eadfb03489b6","user":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=2","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"repo":{"id":4164482,"name":"django","full_name":"django/django","owner":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=2","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django/django","description":"The Web framework for perfectionists with deadlines.","fork":false,"url":"https://api.github.com/repos/django/django","forks_url":"https://api.github.com/repos/django/django/forks","keys_url":"https://api.github.com/repos/django/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django/django/teams","hooks_url":"https://api.github.com/repos/django/django/hooks","issue_events_url":"https://api.github.com/repos/django/django/issues/events{/number}","events_url":"https://api.github.com/repos/django/django/events","assignees_url":"https://api.github.com/repos/django/django/assignees{/user}","branches_url":"https://api.github.com/repos/django/django/branches{/branch}","tags_url":"https://api.github.com/repos/django/django/tags","blobs_url":"https://api.github.com/repos/django/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/django/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django/django/statuses/{sha}","languages_url":"https://api.github.com/repos/django/django/languages","stargazers_url":"https://api.github.com/repos/django/django/stargazers","contributors_url":"https://api.github.com/repos/django/django/contributors","subscribers_url":"https://api.github.com/repos/django/django/subscribers","subscription_url":"https://api.github.com/repos/django/django/subscription","commits_url":"https://api.github.com/repos/django/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/django/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/django/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/django/django/issues/comments/{number}","contents_url":"https://api.github.com/repos/django/django/contents/{+path}","compare_url":"https://api.github.com/repos/django/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django/django/merges","archive_url":"https://api.github.com/repos/django/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django/django/downloads","issues_url":"https://api.github.com/repos/django/django/issues{/number}","pulls_url":"https://api.github.com/repos/django/django/pulls{/number}","milestones_url":"https://api.github.com/repos/django/django/milestones{/number}","notifications_url":"https://api.github.com/repos/django/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django/django/labels{/name}","releases_url":"https://api.github.com/repos/django/django/releases{/id}","created_at":"2012-04-28T02:47:18Z","updated_at":"2014-10-09T14:00:59Z","pushed_at":"2014-10-09T14:37:52Z","git_url":"git://github.com/django/django.git","ssh_url":"git@github.com:django/django.git","clone_url":"https://github.com/django/django.git","svn_url":"https://github.com/django/django","homepage":"https://www.djangoproject.com/","size":250782,"stargazers_count":11435,"watchers_count":11435,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4444,"mirror_url":null,"open_issues_count":95,"forks":4444,"open_issues":95,"watchers":11435,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/3219"},"html":{"href":"https://github.com/django/django/pull/3219"},"issue":{"href":"https://api.github.com/repos/django/django/issues/3219"},"comments":{"href":"https://api.github.com/repos/django/django/issues/3219/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/3219/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/3219/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/5cf9a102ebcd4a9579df2d90afe7880e3de24410"}}}}