{"action":"created","comment":{"url":"https://api.github.com/repos/zkzofn/art_archive/pulls/comments/63135993","id":63135993,"diff_hunk":"@@ -1,30 +1,47 @@\n from art_archive import app, request\n+import pymysql.cursors\n+from art_archive import db_host, db_user, db_password, db_name, db_charset\n+\n+def setParam(flag, var_name):\n+    if request.args.get(var_name) is not None:\n+        flag[0] = False\n+        return request.args.get(var_name)\n+    else:\n+        return \"NULL\"\n \n @app.route('/artist', methods=['POST'])\n def createArtist():\n-    if request.args.get(\"\") is not None:\n-        pass\n-    else:\n-        pass\n+    try:\n+        connection = pymysql.connect(host=db_host,\n+                                     user=db_user,\n+                                     password=db_password,\n+                                     db=db_name,\n+                                     charset=db_charset,\n+                                     cursorclass=pymysql.cursors.DictCursor)\n \n-    if request.args.get(\"\") is not None:\n-        pass\n-    else:\n-        pass\n+        value_flag = [True]\n \n-    if request.args.get(\"\") is not None:\n-        pass\n-    else:\n-        pass\n+        name = setParam(value_flag, \"name\")\n+        birth_year = setParam(value_flag, \"birth_year\")\n+        death_year = setParam(value_flag, \"death_year\")\n+        country = setParam(value_flag, \"country\")\n+        genre = setParam(value_flag, \"genre\")\n \n-    if request.args.get(\"\") is not None:\n-        pass\n-    else:\n-        pass\n+        if value_flag[0]:\n+            print(\"Flag error\")\n+            return \"Flag error\"","path":"art_archive/createArtist.py","position":48,"original_position":48,"commit_id":"7e77a847428d27ab1ee28938b77c2fab31359532","original_commit_id":"7e77a847428d27ab1ee28938b77c2fab31359532","user":{"login":"zkzofn","id":7379600,"avatar_url":"https://avatars.githubusercontent.com/u/7379600?v=3","gravatar_id":"","url":"https://api.github.com/users/zkzofn","html_url":"https://github.com/zkzofn","followers_url":"https://api.github.com/users/zkzofn/followers","following_url":"https://api.github.com/users/zkzofn/following{/other_user}","gists_url":"https://api.github.com/users/zkzofn/gists{/gist_id}","starred_url":"https://api.github.com/users/zkzofn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zkzofn/subscriptions","organizations_url":"https://api.github.com/users/zkzofn/orgs","repos_url":"https://api.github.com/users/zkzofn/repos","events_url":"https://api.github.com/users/zkzofn/events{/privacy}","received_events_url":"https://api.github.com/users/zkzofn/received_events","type":"User","site_admin":false},"body":"@phs1919 \r\n![image](https://cloud.githubusercontent.com/assets/7379600/15238990/762fed5c-1919-11e6-87d6-a10c4d886e63.png)\r\n#24 의 창완님 코멘트에도 동일한 내용이 있었습니다\r\n제가 테스트 해보기로는\r\n일반 변수(variable = value)를 param으로 넘겨서 사용하는 경우에는 값이 변동이 안되는게 맞는 것 같습니다만\r\nmethod 내부에서 param으로 넘겨받은 list를 사용하여 list[index]를 이용해 값을 조작하거나\r\nappend / pop 등을 사용해서 list 내부의 값을 조작하면\r\ncall-by-reference 처럼 동작하는 것 확인했습니다.\r\n\r\n저도 python을 이번에 처음 사용해봐서 \r\n이 방식이 편법(?)인지 원래 이런식으로 사용하는지는 잘 모르겠습니다만\r\n저는 call-by-reference가 필요하다고 생각해서 이런 방식을 찾아서 사용했습니다.","created_at":"2016-05-13T05:52:21Z","updated_at":"2016-05-13T05:52:21Z","html_url":"https://github.com/zkzofn/art_archive/pull/9#discussion_r63135993","pull_request_url":"https://api.github.com/repos/zkzofn/art_archive/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/zkzofn/art_archive/pulls/comments/63135993"},"html":{"href":"https://github.com/zkzofn/art_archive/pull/9#discussion_r63135993"},"pull_request":{"href":"https://api.github.com/repos/zkzofn/art_archive/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/zkzofn/art_archive/pulls/9","id":69691726,"html_url":"https://github.com/zkzofn/art_archive/pull/9","diff_url":"https://github.com/zkzofn/art_archive/pull/9.diff","patch_url":"https://github.com/zkzofn/art_archive/pull/9.patch","issue_url":"https://api.github.com/repos/zkzofn/art_archive/issues/9","number":9,"state":"open","locked":false,"title":"Add simple POST method","user":{"login":"zkzofn","id":7379600,"avatar_url":"https://avatars.githubusercontent.com/u/7379600?v=3","gravatar_id":"","url":"https://api.github.com/users/zkzofn","html_url":"https://github.com/zkzofn","followers_url":"https://api.github.com/users/zkzofn/followers","following_url":"https://api.github.com/users/zkzofn/following{/other_user}","gists_url":"https://api.github.com/users/zkzofn/gists{/gist_id}","starred_url":"https://api.github.com/users/zkzofn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zkzofn/subscriptions","organizations_url":"https://api.github.com/users/zkzofn/orgs","repos_url":"https://api.github.com/users/zkzofn/repos","events_url":"https://api.github.com/users/zkzofn/events{/privacy}","received_events_url":"https://api.github.com/users/zkzofn/received_events","type":"User","site_admin":false},"body":"### Summary\r\n\r\nCloses #8  \r\n\r\nPOST method를 호출하여 DB에 데이터 insert하는 작업\r\n - createImage\r\n - createArtist\r\n\r\n### Other information\r\n - JSON 파싱 미포함\r\n - Connection pool 미포함\r\n - 예외 처리 시 에러 코드, 에러 메세지 미포함\r\n\r\n### Todo\r\nPUT, DELETE 기능 간단히 구현","created_at":"2016-05-11T15:24:59Z","updated_at":"2016-05-13T05:52:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc3eebeca1022ec41f09c48c2aed5a6c2c9a535b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zkzofn/art_archive/pulls/9/commits","review_comments_url":"https://api.github.com/repos/zkzofn/art_archive/pulls/9/comments","review_comment_url":"https://api.github.com/repos/zkzofn/art_archive/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zkzofn/art_archive/issues/9/comments","statuses_url":"https://api.github.com/repos/zkzofn/art_archive/statuses/7e77a847428d27ab1ee28938b77c2fab31359532","head":{"label":"zkzofn:add_POST","ref":"add_POST","sha":"7e77a847428d27ab1ee28938b77c2fab31359532","user":{"login":"zkzofn","id":7379600,"avatar_url":"https://avatars.githubusercontent.com/u/7379600?v=3","gravatar_id":"","url":"https://api.github.com/users/zkzofn","html_url":"https://github.com/zkzofn","followers_url":"https://api.github.com/users/zkzofn/followers","following_url":"https://api.github.com/users/zkzofn/following{/other_user}","gists_url":"https://api.github.com/users/zkzofn/gists{/gist_id}","starred_url":"https://api.github.com/users/zkzofn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zkzofn/subscriptions","organizations_url":"https://api.github.com/users/zkzofn/orgs","repos_url":"https://api.github.com/users/zkzofn/repos","events_url":"https://api.github.com/users/zkzofn/events{/privacy}","received_events_url":"https://api.github.com/users/zkzofn/received_events","type":"User","site_admin":false},"repo":{"id":58174981,"name":"art_archive","full_name":"zkzofn/art_archive","owner":{"login":"zkzofn","id":7379600,"avatar_url":"https://avatars.githubusercontent.com/u/7379600?v=3","gravatar_id":"","url":"https://api.github.com/users/zkzofn","html_url":"https://github.com/zkzofn","followers_url":"https://api.github.com/users/zkzofn/followers","following_url":"https://api.github.com/users/zkzofn/following{/other_user}","gists_url":"https://api.github.com/users/zkzofn/gists{/gist_id}","starred_url":"https://api.github.com/users/zkzofn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zkzofn/subscriptions","organizations_url":"https://api.github.com/users/zkzofn/orgs","repos_url":"https://api.github.com/users/zkzofn/repos","events_url":"https://api.github.com/users/zkzofn/events{/privacy}","received_events_url":"https://api.github.com/users/zkzofn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zkzofn/art_archive","description":"","fork":false,"url":"https://api.github.com/repos/zkzofn/art_archive","forks_url":"https://api.github.com/repos/zkzofn/art_archive/forks","keys_url":"https://api.github.com/repos/zkzofn/art_archive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zkzofn/art_archive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zkzofn/art_archive/teams","hooks_url":"https://api.github.com/repos/zkzofn/art_archive/hooks","issue_events_url":"https://api.github.com/repos/zkzofn/art_archive/issues/events{/number}","events_url":"https://api.github.com/repos/zkzofn/art_archive/events","assignees_url":"https://api.github.com/repos/zkzofn/art_archive/assignees{/user}","branches_url":"https://api.github.com/repos/zkzofn/art_archive/branches{/branch}","tags_url":"https://api.github.com/repos/zkzofn/art_archive/tags","blobs_url":"https://api.github.com/repos/zkzofn/art_archive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zkzofn/art_archive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zkzofn/art_archive/git/refs{/sha}","trees_url":"https://api.github.com/repos/zkzofn/art_archive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zkzofn/art_archive/statuses/{sha}","languages_url":"https://api.github.com/repos/zkzofn/art_archive/languages","stargazers_url":"https://api.github.com/repos/zkzofn/art_archive/stargazers","contributors_url":"https://api.github.com/repos/zkzofn/art_archive/contributors","subscribers_url":"https://api.github.com/repos/zkzofn/art_archive/subscribers","subscription_url":"https://api.github.com/repos/zkzofn/art_archive/subscription","commits_url":"https://api.github.com/repos/zkzofn/art_archive/commits{/sha}","git_commits_url":"https://api.github.com/repos/zkzofn/art_archive/git/commits{/sha}","comments_url":"https://api.github.com/repos/zkzofn/art_archive/comments{/number}","issue_comment_url":"https://api.github.com/repos/zkzofn/art_archive/issues/comments{/number}","contents_url":"https://api.github.com/repos/zkzofn/art_archive/contents/{+path}","compare_url":"https://api.github.com/repos/zkzofn/art_archive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zkzofn/art_archive/merges","archive_url":"https://api.github.com/repos/zkzofn/art_archive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zkzofn/art_archive/downloads","issues_url":"https://api.github.com/repos/zkzofn/art_archive/issues{/number}","pulls_url":"https://api.github.com/repos/zkzofn/art_archive/pulls{/number}","milestones_url":"https://api.github.com/repos/zkzofn/art_archive/milestones{/number}","notifications_url":"https://api.github.com/repos/zkzofn/art_archive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zkzofn/art_archive/labels{/name}","releases_url":"https://api.github.com/repos/zkzofn/art_archive/releases{/id}","deployments_url":"https://api.github.com/repos/zkzofn/art_archive/deployments","created_at":"2016-05-06T02:31:57Z","updated_at":"2016-05-06T02:31:57Z","pushed_at":"2016-05-12T19:05:48Z","git_url":"git://github.com/zkzofn/art_archive.git","ssh_url":"git@github.com:zkzofn/art_archive.git","clone_url":"https://github.com/zkzofn/art_archive.git","svn_url":"https://github.com/zkzofn/art_archive","homepage":null,"size":41,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":22,"forks":0,"open_issues":22,"watchers":0,"default_branch":"master"}},"base":{"label":"zkzofn:add_GET","ref":"add_GET","sha":"e3df6a8ea94c09bfdee4e6d009a7c7e86beab010","user":{"login":"zkzofn","id":7379600,"avatar_url":"https://avatars.githubusercontent.com/u/7379600?v=3","gravatar_id":"","url":"https://api.github.com/users/zkzofn","html_url":"https://github.com/zkzofn","followers_url":"https://api.github.com/users/zkzofn/followers","following_url":"https://api.github.com/users/zkzofn/following{/other_user}","gists_url":"https://api.github.com/users/zkzofn/gists{/gist_id}","starred_url":"https://api.github.com/users/zkzofn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zkzofn/subscriptions","organizations_url":"https://api.github.com/users/zkzofn/orgs","repos_url":"https://api.github.com/users/zkzofn/repos","events_url":"https://api.github.com/users/zkzofn/events{/privacy}","received_events_url":"https://api.github.com/users/zkzofn/received_events","type":"User","site_admin":false},"repo":{"id":58174981,"name":"art_archive","full_name":"zkzofn/art_archive","owner":{"login":"zkzofn","id":7379600,"avatar_url":"https://avatars.githubusercontent.com/u/7379600?v=3","gravatar_id":"","url":"https://api.github.com/users/zkzofn","html_url":"https://github.com/zkzofn","followers_url":"https://api.github.com/users/zkzofn/followers","following_url":"https://api.github.com/users/zkzofn/following{/other_user}","gists_url":"https://api.github.com/users/zkzofn/gists{/gist_id}","starred_url":"https://api.github.com/users/zkzofn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zkzofn/subscriptions","organizations_url":"https://api.github.com/users/zkzofn/orgs","repos_url":"https://api.github.com/users/zkzofn/repos","events_url":"https://api.github.com/users/zkzofn/events{/privacy}","received_events_url":"https://api.github.com/users/zkzofn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zkzofn/art_archive","description":"","fork":false,"url":"https://api.github.com/repos/zkzofn/art_archive","forks_url":"https://api.github.com/repos/zkzofn/art_archive/forks","keys_url":"https://api.github.com/repos/zkzofn/art_archive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zkzofn/art_archive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zkzofn/art_archive/teams","hooks_url":"https://api.github.com/repos/zkzofn/art_archive/hooks","issue_events_url":"https://api.github.com/repos/zkzofn/art_archive/issues/events{/number}","events_url":"https://api.github.com/repos/zkzofn/art_archive/events","assignees_url":"https://api.github.com/repos/zkzofn/art_archive/assignees{/user}","branches_url":"https://api.github.com/repos/zkzofn/art_archive/branches{/branch}","tags_url":"https://api.github.com/repos/zkzofn/art_archive/tags","blobs_url":"https://api.github.com/repos/zkzofn/art_archive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zkzofn/art_archive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zkzofn/art_archive/git/refs{/sha}","trees_url":"https://api.github.com/repos/zkzofn/art_archive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zkzofn/art_archive/statuses/{sha}","languages_url":"https://api.github.com/repos/zkzofn/art_archive/languages","stargazers_url":"https://api.github.com/repos/zkzofn/art_archive/stargazers","contributors_url":"https://api.github.com/repos/zkzofn/art_archive/contributors","subscribers_url":"https://api.github.com/repos/zkzofn/art_archive/subscribers","subscription_url":"https://api.github.com/repos/zkzofn/art_archive/subscription","commits_url":"https://api.github.com/repos/zkzofn/art_archive/commits{/sha}","git_commits_url":"https://api.github.com/repos/zkzofn/art_archive/git/commits{/sha}","comments_url":"https://api.github.com/repos/zkzofn/art_archive/comments{/number}","issue_comment_url":"https://api.github.com/repos/zkzofn/art_archive/issues/comments{/number}","contents_url":"https://api.github.com/repos/zkzofn/art_archive/contents/{+path}","compare_url":"https://api.github.com/repos/zkzofn/art_archive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zkzofn/art_archive/merges","archive_url":"https://api.github.com/repos/zkzofn/art_archive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zkzofn/art_archive/downloads","issues_url":"https://api.github.com/repos/zkzofn/art_archive/issues{/number}","pulls_url":"https://api.github.com/repos/zkzofn/art_archive/pulls{/number}","milestones_url":"https://api.github.com/repos/zkzofn/art_archive/milestones{/number}","notifications_url":"https://api.github.com/repos/zkzofn/art_archive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zkzofn/art_archive/labels{/name}","releases_url":"https://api.github.com/repos/zkzofn/art_archive/releases{/id}","deployments_url":"https://api.github.com/repos/zkzofn/art_archive/deployments","created_at":"2016-05-06T02:31:57Z","updated_at":"2016-05-06T02:31:57Z","pushed_at":"2016-05-12T19:05:48Z","git_url":"git://github.com/zkzofn/art_archive.git","ssh_url":"git@github.com:zkzofn/art_archive.git","clone_url":"https://github.com/zkzofn/art_archive.git","svn_url":"https://github.com/zkzofn/art_archive","homepage":null,"size":41,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":22,"forks":0,"open_issues":22,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zkzofn/art_archive/pulls/9"},"html":{"href":"https://github.com/zkzofn/art_archive/pull/9"},"issue":{"href":"https://api.github.com/repos/zkzofn/art_archive/issues/9"},"comments":{"href":"https://api.github.com/repos/zkzofn/art_archive/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/zkzofn/art_archive/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/zkzofn/art_archive/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zkzofn/art_archive/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/zkzofn/art_archive/statuses/7e77a847428d27ab1ee28938b77c2fab31359532"}}}}