{"action":"created","comment":{"url":"https://api.github.com/repos/nicolaiarocci/eve/pulls/comments/45753750","id":45753750,"diff_hunk":"@@ -135,8 +135,7 @@ def patch_internal(resource, payload=None, concurrency_check=False,\n \n     resource_def = app.config['DOMAIN'][resource]\n     schema = resource_def['schema']\n-    if not skip_validation:\n-        validator = app.validator(schema, resource)\n+    validator = app.validator(schema, resource)","path":"eve/methods/patch.py","position":6,"original_position":6,"commit_id":"56f36971f2e3b10a0c47c0583099b9c9c7228034","original_commit_id":"56f36971f2e3b10a0c47c0583099b9c9c7228034","user":{"login":"stratosgear","id":193463,"avatar_url":"https://avatars.githubusercontent.com/u/193463?v=3","gravatar_id":"","url":"https://api.github.com/users/stratosgear","html_url":"https://github.com/stratosgear","followers_url":"https://api.github.com/users/stratosgear/followers","following_url":"https://api.github.com/users/stratosgear/following{/other_user}","gists_url":"https://api.github.com/users/stratosgear/gists{/gist_id}","starred_url":"https://api.github.com/users/stratosgear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stratosgear/subscriptions","organizations_url":"https://api.github.com/users/stratosgear/orgs","repos_url":"https://api.github.com/users/stratosgear/repos","events_url":"https://api.github.com/users/stratosgear/events{/privacy}","received_events_url":"https://api.github.com/users/stratosgear/received_events","type":"User","site_admin":false},"body":"It's either/or! \r\n\r\nMy intend was to keep the ```validator``` instantiated anyways (regardless of skip_validation or not) so if it needs to be used *anywhere* in the method (even in multiple places) it would be available.\r\n\r\nUnless instantiating it incurs a huge cost (don't think so) I feel it is cleaner to have it available throughout the method.\r\n\r\nYou have the final say, off course!\r\n","created_at":"2015-11-24T15:57:53Z","updated_at":"2015-11-24T15:57:53Z","html_url":"https://github.com/nicolaiarocci/eve/pull/768#discussion_r45753750","pull_request_url":"https://api.github.com/repos/nicolaiarocci/eve/pulls/768","_links":{"self":{"href":"https://api.github.com/repos/nicolaiarocci/eve/pulls/comments/45753750"},"html":{"href":"https://github.com/nicolaiarocci/eve/pull/768#discussion_r45753750"},"pull_request":{"href":"https://api.github.com/repos/nicolaiarocci/eve/pulls/768"}}},"pull_request":{"url":"https://api.github.com/repos/nicolaiarocci/eve/pulls/768","id":51644652,"html_url":"https://github.com/nicolaiarocci/eve/pull/768","diff_url":"https://github.com/nicolaiarocci/eve/pull/768.diff","patch_url":"https://github.com/nicolaiarocci/eve/pull/768.patch","issue_url":"https://api.github.com/repos/nicolaiarocci/eve/issues/768","number":768,"state":"open","locked":false,"title":"Validator is not set when skip_validation is true","user":{"login":"stratosgear","id":193463,"avatar_url":"https://avatars.githubusercontent.com/u/193463?v=3","gravatar_id":"","url":"https://api.github.com/users/stratosgear","html_url":"https://github.com/stratosgear","followers_url":"https://api.github.com/users/stratosgear/followers","following_url":"https://api.github.com/users/stratosgear/following{/other_user}","gists_url":"https://api.github.com/users/stratosgear/gists{/gist_id}","starred_url":"https://api.github.com/users/stratosgear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stratosgear/subscriptions","organizations_url":"https://api.github.com/users/stratosgear/orgs","repos_url":"https://api.github.com/users/stratosgear/repos","events_url":"https://api.github.com/users/stratosgear/events{/privacy}","received_events_url":"https://api.github.com/users/stratosgear/received_events","type":"User","site_admin":false},"body":"Fixes issue introduced with 0b2ae5a928c18f53c598ae2ba4536df6f9e175f4 in which case when the ```patch_internal``` method was called with ```skip_validation=True``` the ```validator``` on line 139 will *not* be instantiated, but it will try to be accessed on line 163 causing a:\r\n\r\n    Traceback (most recent call last):\r\n      File \"/usr/local/lib/python2.7/dist-packages/eve/methods/patch.py\", line 163, in patch_internal\r\n        updates = validator.document\r\n    UnboundLocalError: local variable 'validator' referenced before assignment\r\n    ERROR:eve:local variable 'validator' referenced before assignment","created_at":"2015-11-24T11:01:38Z","updated_at":"2015-11-24T15:57:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc57e41f28c0cdd7e3a57f744745f984113504b8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nicolaiarocci/eve/pulls/768/commits","review_comments_url":"https://api.github.com/repos/nicolaiarocci/eve/pulls/768/comments","review_comment_url":"https://api.github.com/repos/nicolaiarocci/eve/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nicolaiarocci/eve/issues/768/comments","statuses_url":"https://api.github.com/repos/nicolaiarocci/eve/statuses/56f36971f2e3b10a0c47c0583099b9c9c7228034","head":{"label":"stratosgear:master","ref":"master","sha":"56f36971f2e3b10a0c47c0583099b9c9c7228034","user":{"login":"stratosgear","id":193463,"avatar_url":"https://avatars.githubusercontent.com/u/193463?v=3","gravatar_id":"","url":"https://api.github.com/users/stratosgear","html_url":"https://github.com/stratosgear","followers_url":"https://api.github.com/users/stratosgear/followers","following_url":"https://api.github.com/users/stratosgear/following{/other_user}","gists_url":"https://api.github.com/users/stratosgear/gists{/gist_id}","starred_url":"https://api.github.com/users/stratosgear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stratosgear/subscriptions","organizations_url":"https://api.github.com/users/stratosgear/orgs","repos_url":"https://api.github.com/users/stratosgear/repos","events_url":"https://api.github.com/users/stratosgear/events{/privacy}","received_events_url":"https://api.github.com/users/stratosgear/received_events","type":"User","site_admin":false},"repo":{"id":40649223,"name":"eve","full_name":"stratosgear/eve","owner":{"login":"stratosgear","id":193463,"avatar_url":"https://avatars.githubusercontent.com/u/193463?v=3","gravatar_id":"","url":"https://api.github.com/users/stratosgear","html_url":"https://github.com/stratosgear","followers_url":"https://api.github.com/users/stratosgear/followers","following_url":"https://api.github.com/users/stratosgear/following{/other_user}","gists_url":"https://api.github.com/users/stratosgear/gists{/gist_id}","starred_url":"https://api.github.com/users/stratosgear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stratosgear/subscriptions","organizations_url":"https://api.github.com/users/stratosgear/orgs","repos_url":"https://api.github.com/users/stratosgear/repos","events_url":"https://api.github.com/users/stratosgear/events{/privacy}","received_events_url":"https://api.github.com/users/stratosgear/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stratosgear/eve","description":"Python REST API for Humans™","fork":true,"url":"https://api.github.com/repos/stratosgear/eve","forks_url":"https://api.github.com/repos/stratosgear/eve/forks","keys_url":"https://api.github.com/repos/stratosgear/eve/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stratosgear/eve/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stratosgear/eve/teams","hooks_url":"https://api.github.com/repos/stratosgear/eve/hooks","issue_events_url":"https://api.github.com/repos/stratosgear/eve/issues/events{/number}","events_url":"https://api.github.com/repos/stratosgear/eve/events","assignees_url":"https://api.github.com/repos/stratosgear/eve/assignees{/user}","branches_url":"https://api.github.com/repos/stratosgear/eve/branches{/branch}","tags_url":"https://api.github.com/repos/stratosgear/eve/tags","blobs_url":"https://api.github.com/repos/stratosgear/eve/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stratosgear/eve/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stratosgear/eve/git/refs{/sha}","trees_url":"https://api.github.com/repos/stratosgear/eve/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stratosgear/eve/statuses/{sha}","languages_url":"https://api.github.com/repos/stratosgear/eve/languages","stargazers_url":"https://api.github.com/repos/stratosgear/eve/stargazers","contributors_url":"https://api.github.com/repos/stratosgear/eve/contributors","subscribers_url":"https://api.github.com/repos/stratosgear/eve/subscribers","subscription_url":"https://api.github.com/repos/stratosgear/eve/subscription","commits_url":"https://api.github.com/repos/stratosgear/eve/commits{/sha}","git_commits_url":"https://api.github.com/repos/stratosgear/eve/git/commits{/sha}","comments_url":"https://api.github.com/repos/stratosgear/eve/comments{/number}","issue_comment_url":"https://api.github.com/repos/stratosgear/eve/issues/comments{/number}","contents_url":"https://api.github.com/repos/stratosgear/eve/contents/{+path}","compare_url":"https://api.github.com/repos/stratosgear/eve/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stratosgear/eve/merges","archive_url":"https://api.github.com/repos/stratosgear/eve/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stratosgear/eve/downloads","issues_url":"https://api.github.com/repos/stratosgear/eve/issues{/number}","pulls_url":"https://api.github.com/repos/stratosgear/eve/pulls{/number}","milestones_url":"https://api.github.com/repos/stratosgear/eve/milestones{/number}","notifications_url":"https://api.github.com/repos/stratosgear/eve/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stratosgear/eve/labels{/name}","releases_url":"https://api.github.com/repos/stratosgear/eve/releases{/id}","created_at":"2015-08-13T09:03:22Z","updated_at":"2015-08-13T09:03:22Z","pushed_at":"2015-11-24T10:57:07Z","git_url":"git://github.com/stratosgear/eve.git","ssh_url":"git@github.com:stratosgear/eve.git","clone_url":"https://github.com/stratosgear/eve.git","svn_url":"https://github.com/stratosgear/eve","homepage":"http://python-eve.org","size":12895,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"nicolaiarocci:develop","ref":"develop","sha":"8f35107905387f1aab5036b980ab38116b3947ec","user":{"login":"nicolaiarocci","id":512968,"avatar_url":"https://avatars.githubusercontent.com/u/512968?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolaiarocci","html_url":"https://github.com/nicolaiarocci","followers_url":"https://api.github.com/users/nicolaiarocci/followers","following_url":"https://api.github.com/users/nicolaiarocci/following{/other_user}","gists_url":"https://api.github.com/users/nicolaiarocci/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolaiarocci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolaiarocci/subscriptions","organizations_url":"https://api.github.com/users/nicolaiarocci/orgs","repos_url":"https://api.github.com/users/nicolaiarocci/repos","events_url":"https://api.github.com/users/nicolaiarocci/events{/privacy}","received_events_url":"https://api.github.com/users/nicolaiarocci/received_events","type":"User","site_admin":false},"repo":{"id":6331139,"name":"eve","full_name":"nicolaiarocci/eve","owner":{"login":"nicolaiarocci","id":512968,"avatar_url":"https://avatars.githubusercontent.com/u/512968?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolaiarocci","html_url":"https://github.com/nicolaiarocci","followers_url":"https://api.github.com/users/nicolaiarocci/followers","following_url":"https://api.github.com/users/nicolaiarocci/following{/other_user}","gists_url":"https://api.github.com/users/nicolaiarocci/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolaiarocci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolaiarocci/subscriptions","organizations_url":"https://api.github.com/users/nicolaiarocci/orgs","repos_url":"https://api.github.com/users/nicolaiarocci/repos","events_url":"https://api.github.com/users/nicolaiarocci/events{/privacy}","received_events_url":"https://api.github.com/users/nicolaiarocci/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nicolaiarocci/eve","description":"Python REST API for Humans™","fork":false,"url":"https://api.github.com/repos/nicolaiarocci/eve","forks_url":"https://api.github.com/repos/nicolaiarocci/eve/forks","keys_url":"https://api.github.com/repos/nicolaiarocci/eve/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nicolaiarocci/eve/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nicolaiarocci/eve/teams","hooks_url":"https://api.github.com/repos/nicolaiarocci/eve/hooks","issue_events_url":"https://api.github.com/repos/nicolaiarocci/eve/issues/events{/number}","events_url":"https://api.github.com/repos/nicolaiarocci/eve/events","assignees_url":"https://api.github.com/repos/nicolaiarocci/eve/assignees{/user}","branches_url":"https://api.github.com/repos/nicolaiarocci/eve/branches{/branch}","tags_url":"https://api.github.com/repos/nicolaiarocci/eve/tags","blobs_url":"https://api.github.com/repos/nicolaiarocci/eve/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nicolaiarocci/eve/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nicolaiarocci/eve/git/refs{/sha}","trees_url":"https://api.github.com/repos/nicolaiarocci/eve/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nicolaiarocci/eve/statuses/{sha}","languages_url":"https://api.github.com/repos/nicolaiarocci/eve/languages","stargazers_url":"https://api.github.com/repos/nicolaiarocci/eve/stargazers","contributors_url":"https://api.github.com/repos/nicolaiarocci/eve/contributors","subscribers_url":"https://api.github.com/repos/nicolaiarocci/eve/subscribers","subscription_url":"https://api.github.com/repos/nicolaiarocci/eve/subscription","commits_url":"https://api.github.com/repos/nicolaiarocci/eve/commits{/sha}","git_commits_url":"https://api.github.com/repos/nicolaiarocci/eve/git/commits{/sha}","comments_url":"https://api.github.com/repos/nicolaiarocci/eve/comments{/number}","issue_comment_url":"https://api.github.com/repos/nicolaiarocci/eve/issues/comments{/number}","contents_url":"https://api.github.com/repos/nicolaiarocci/eve/contents/{+path}","compare_url":"https://api.github.com/repos/nicolaiarocci/eve/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nicolaiarocci/eve/merges","archive_url":"https://api.github.com/repos/nicolaiarocci/eve/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nicolaiarocci/eve/downloads","issues_url":"https://api.github.com/repos/nicolaiarocci/eve/issues{/number}","pulls_url":"https://api.github.com/repos/nicolaiarocci/eve/pulls{/number}","milestones_url":"https://api.github.com/repos/nicolaiarocci/eve/milestones{/number}","notifications_url":"https://api.github.com/repos/nicolaiarocci/eve/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nicolaiarocci/eve/labels{/name}","releases_url":"https://api.github.com/repos/nicolaiarocci/eve/releases{/id}","created_at":"2012-10-22T07:39:33Z","updated_at":"2015-11-24T13:55:55Z","pushed_at":"2015-11-24T11:01:38Z","git_url":"git://github.com/nicolaiarocci/eve.git","ssh_url":"git@github.com:nicolaiarocci/eve.git","clone_url":"https://github.com/nicolaiarocci/eve.git","svn_url":"https://github.com/nicolaiarocci/eve","homepage":"http://python-eve.org","size":14228,"stargazers_count":2729,"watchers_count":2729,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":374,"mirror_url":null,"open_issues_count":35,"forks":374,"open_issues":35,"watchers":2729,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/nicolaiarocci/eve/pulls/768"},"html":{"href":"https://github.com/nicolaiarocci/eve/pull/768"},"issue":{"href":"https://api.github.com/repos/nicolaiarocci/eve/issues/768"},"comments":{"href":"https://api.github.com/repos/nicolaiarocci/eve/issues/768/comments"},"review_comments":{"href":"https://api.github.com/repos/nicolaiarocci/eve/pulls/768/comments"},"review_comment":{"href":"https://api.github.com/repos/nicolaiarocci/eve/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nicolaiarocci/eve/pulls/768/commits"},"statuses":{"href":"https://api.github.com/repos/nicolaiarocci/eve/statuses/56f36971f2e3b10a0c47c0583099b9c9c7228034"}}}}