{"action":"created","comment":{"url":"https://api.github.com/repos/akretion/ak/pulls/comments/59415086","id":59415086,"diff_hunk":"@@ -19,6 +19,45 @@\n MODULE_FOLDER = WORKSPACE + 'parts/'\n \n \n+class DbTools(object):\n+    \"\"\"Read db credentials from ERP_CFG.\n+\n+    Add -d flag to the current command to override PGDATABASE\n+    Add self.db\n+\n+    Usage:\n+      Heritate from this class and call determine_db()\n+\n+        class AkSomething(cli.Application, DbTools):\n+            def main(self):\n+                self.determine_db()\n+                # your stuff here\n+    \"\"\"\n+\n+    dbParams = {\n+        \"db_host\": \"PGHOST\",\n+        \"db_port\": \"PGPORT\",\n+        \"db_name\": \"PGDATABASE\",\n+        \"db_user\": \"PGUSER\",\n+        \"db_password\": \"PGPASSWORD\"\n+    }\n+    db = cli.SwitchAttr([\"d\"], str, help=\"Database\")\n+\n+    def determine_db(self):","path":"ak.py","position":28,"original_position":28,"commit_id":"4f0c479c6bdeda286b5ba5fb666271db3e580cc9","original_commit_id":"4f0c479c6bdeda286b5ba5fb666271db3e580cc9","user":{"login":"rvalyi","id":16926,"avatar_url":"https://avatars.githubusercontent.com/u/16926?v=3","gravatar_id":"","url":"https://api.github.com/users/rvalyi","html_url":"https://github.com/rvalyi","followers_url":"https://api.github.com/users/rvalyi/followers","following_url":"https://api.github.com/users/rvalyi/following{/other_user}","gists_url":"https://api.github.com/users/rvalyi/gists{/gist_id}","starred_url":"https://api.github.com/users/rvalyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvalyi/subscriptions","organizations_url":"https://api.github.com/users/rvalyi/orgs","repos_url":"https://api.github.com/users/rvalyi/repos","events_url":"https://api.github.com/users/rvalyi/events{/privacy}","received_events_url":"https://api.github.com/users/rvalyi/received_events","type":"User","site_admin":false},"body":"determine looks rather \"frenchouillard\", o at least it's not the right meaning in English I think. May be get_db or find_db...","created_at":"2016-04-12T17:16:28Z","updated_at":"2016-04-12T17:16:28Z","html_url":"https://github.com/akretion/ak/pull/5#discussion_r59415086","pull_request_url":"https://api.github.com/repos/akretion/ak/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/akretion/ak/pulls/comments/59415086"},"html":{"href":"https://github.com/akretion/ak/pull/5#discussion_r59415086"},"pull_request":{"href":"https://api.github.com/repos/akretion/ak/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/akretion/ak/pulls/5","id":66138512,"html_url":"https://github.com/akretion/ak/pull/5","diff_url":"https://github.com/akretion/ak/pull/5.diff","patch_url":"https://github.com/akretion/ak/pull/5.patch","issue_url":"https://api.github.com/repos/akretion/ak/issues/5","number":5,"state":"open","locked":false,"title":"add upgrade","user":{"login":"hparfr","id":8331206,"avatar_url":"https://avatars.githubusercontent.com/u/8331206?v=3","gravatar_id":"","url":"https://api.github.com/users/hparfr","html_url":"https://github.com/hparfr","followers_url":"https://api.github.com/users/hparfr/followers","following_url":"https://api.github.com/users/hparfr/following{/other_user}","gists_url":"https://api.github.com/users/hparfr/gists{/gist_id}","starred_url":"https://api.github.com/users/hparfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hparfr/subscriptions","organizations_url":"https://api.github.com/users/hparfr/orgs","repos_url":"https://api.github.com/users/hparfr/repos","events_url":"https://api.github.com/users/hparfr/events{/privacy}","received_events_url":"https://api.github.com/users/hparfr/received_events","type":"User","site_admin":false},"body":"And refactore determine_db","created_at":"2016-04-12T11:04:38Z","updated_at":"2016-04-12T17:16:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b082920291cf07657b574ee957408fa752808d95","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akretion/ak/pulls/5/commits","review_comments_url":"https://api.github.com/repos/akretion/ak/pulls/5/comments","review_comment_url":"https://api.github.com/repos/akretion/ak/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akretion/ak/issues/5/comments","statuses_url":"https://api.github.com/repos/akretion/ak/statuses/4f0c479c6bdeda286b5ba5fb666271db3e580cc9","head":{"label":"hparfr:master","ref":"master","sha":"4f0c479c6bdeda286b5ba5fb666271db3e580cc9","user":{"login":"hparfr","id":8331206,"avatar_url":"https://avatars.githubusercontent.com/u/8331206?v=3","gravatar_id":"","url":"https://api.github.com/users/hparfr","html_url":"https://github.com/hparfr","followers_url":"https://api.github.com/users/hparfr/followers","following_url":"https://api.github.com/users/hparfr/following{/other_user}","gists_url":"https://api.github.com/users/hparfr/gists{/gist_id}","starred_url":"https://api.github.com/users/hparfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hparfr/subscriptions","organizations_url":"https://api.github.com/users/hparfr/orgs","repos_url":"https://api.github.com/users/hparfr/repos","events_url":"https://api.github.com/users/hparfr/events{/privacy}","received_events_url":"https://api.github.com/users/hparfr/received_events","type":"User","site_admin":false},"repo":{"id":50193573,"name":"ak","full_name":"hparfr/ak","owner":{"login":"hparfr","id":8331206,"avatar_url":"https://avatars.githubusercontent.com/u/8331206?v=3","gravatar_id":"","url":"https://api.github.com/users/hparfr","html_url":"https://github.com/hparfr","followers_url":"https://api.github.com/users/hparfr/followers","following_url":"https://api.github.com/users/hparfr/following{/other_user}","gists_url":"https://api.github.com/users/hparfr/gists{/gist_id}","starred_url":"https://api.github.com/users/hparfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hparfr/subscriptions","organizations_url":"https://api.github.com/users/hparfr/orgs","repos_url":"https://api.github.com/users/hparfr/repos","events_url":"https://api.github.com/users/hparfr/events{/privacy}","received_events_url":"https://api.github.com/users/hparfr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hparfr/ak","description":"The toolbetl for odoo","fork":false,"url":"https://api.github.com/repos/hparfr/ak","forks_url":"https://api.github.com/repos/hparfr/ak/forks","keys_url":"https://api.github.com/repos/hparfr/ak/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hparfr/ak/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hparfr/ak/teams","hooks_url":"https://api.github.com/repos/hparfr/ak/hooks","issue_events_url":"https://api.github.com/repos/hparfr/ak/issues/events{/number}","events_url":"https://api.github.com/repos/hparfr/ak/events","assignees_url":"https://api.github.com/repos/hparfr/ak/assignees{/user}","branches_url":"https://api.github.com/repos/hparfr/ak/branches{/branch}","tags_url":"https://api.github.com/repos/hparfr/ak/tags","blobs_url":"https://api.github.com/repos/hparfr/ak/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hparfr/ak/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hparfr/ak/git/refs{/sha}","trees_url":"https://api.github.com/repos/hparfr/ak/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hparfr/ak/statuses/{sha}","languages_url":"https://api.github.com/repos/hparfr/ak/languages","stargazers_url":"https://api.github.com/repos/hparfr/ak/stargazers","contributors_url":"https://api.github.com/repos/hparfr/ak/contributors","subscribers_url":"https://api.github.com/repos/hparfr/ak/subscribers","subscription_url":"https://api.github.com/repos/hparfr/ak/subscription","commits_url":"https://api.github.com/repos/hparfr/ak/commits{/sha}","git_commits_url":"https://api.github.com/repos/hparfr/ak/git/commits{/sha}","comments_url":"https://api.github.com/repos/hparfr/ak/comments{/number}","issue_comment_url":"https://api.github.com/repos/hparfr/ak/issues/comments{/number}","contents_url":"https://api.github.com/repos/hparfr/ak/contents/{+path}","compare_url":"https://api.github.com/repos/hparfr/ak/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hparfr/ak/merges","archive_url":"https://api.github.com/repos/hparfr/ak/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hparfr/ak/downloads","issues_url":"https://api.github.com/repos/hparfr/ak/issues{/number}","pulls_url":"https://api.github.com/repos/hparfr/ak/pulls{/number}","milestones_url":"https://api.github.com/repos/hparfr/ak/milestones{/number}","notifications_url":"https://api.github.com/repos/hparfr/ak/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hparfr/ak/labels{/name}","releases_url":"https://api.github.com/repos/hparfr/ak/releases{/id}","deployments_url":"https://api.github.com/repos/hparfr/ak/deployments","created_at":"2016-01-22T16:36:33Z","updated_at":"2016-01-22T16:39:23Z","pushed_at":"2016-04-12T16:04:43Z","git_url":"git://github.com/hparfr/ak.git","ssh_url":"git@github.com:hparfr/ak.git","clone_url":"https://github.com/hparfr/ak.git","svn_url":"https://github.com/hparfr/ak","homepage":null,"size":21,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":9,"forks":2,"open_issues":9,"watchers":0,"default_branch":"master"}},"base":{"label":"akretion:master","ref":"master","sha":"6cc6f6b03150435a30bb1ac7dce7ae5198f832f4","user":{"login":"akretion","id":1853423,"avatar_url":"https://avatars.githubusercontent.com/u/1853423?v=3","gravatar_id":"","url":"https://api.github.com/users/akretion","html_url":"https://github.com/akretion","followers_url":"https://api.github.com/users/akretion/followers","following_url":"https://api.github.com/users/akretion/following{/other_user}","gists_url":"https://api.github.com/users/akretion/gists{/gist_id}","starred_url":"https://api.github.com/users/akretion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akretion/subscriptions","organizations_url":"https://api.github.com/users/akretion/orgs","repos_url":"https://api.github.com/users/akretion/repos","events_url":"https://api.github.com/users/akretion/events{/privacy}","received_events_url":"https://api.github.com/users/akretion/received_events","type":"Organization","site_admin":false},"repo":{"id":52520622,"name":"ak","full_name":"akretion/ak","owner":{"login":"akretion","id":1853423,"avatar_url":"https://avatars.githubusercontent.com/u/1853423?v=3","gravatar_id":"","url":"https://api.github.com/users/akretion","html_url":"https://github.com/akretion","followers_url":"https://api.github.com/users/akretion/followers","following_url":"https://api.github.com/users/akretion/following{/other_user}","gists_url":"https://api.github.com/users/akretion/gists{/gist_id}","starred_url":"https://api.github.com/users/akretion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akretion/subscriptions","organizations_url":"https://api.github.com/users/akretion/orgs","repos_url":"https://api.github.com/users/akretion/repos","events_url":"https://api.github.com/users/akretion/events{/privacy}","received_events_url":"https://api.github.com/users/akretion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akretion/ak","description":"The toolbetl for odoo","fork":true,"url":"https://api.github.com/repos/akretion/ak","forks_url":"https://api.github.com/repos/akretion/ak/forks","keys_url":"https://api.github.com/repos/akretion/ak/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akretion/ak/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akretion/ak/teams","hooks_url":"https://api.github.com/repos/akretion/ak/hooks","issue_events_url":"https://api.github.com/repos/akretion/ak/issues/events{/number}","events_url":"https://api.github.com/repos/akretion/ak/events","assignees_url":"https://api.github.com/repos/akretion/ak/assignees{/user}","branches_url":"https://api.github.com/repos/akretion/ak/branches{/branch}","tags_url":"https://api.github.com/repos/akretion/ak/tags","blobs_url":"https://api.github.com/repos/akretion/ak/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akretion/ak/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akretion/ak/git/refs{/sha}","trees_url":"https://api.github.com/repos/akretion/ak/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akretion/ak/statuses/{sha}","languages_url":"https://api.github.com/repos/akretion/ak/languages","stargazers_url":"https://api.github.com/repos/akretion/ak/stargazers","contributors_url":"https://api.github.com/repos/akretion/ak/contributors","subscribers_url":"https://api.github.com/repos/akretion/ak/subscribers","subscription_url":"https://api.github.com/repos/akretion/ak/subscription","commits_url":"https://api.github.com/repos/akretion/ak/commits{/sha}","git_commits_url":"https://api.github.com/repos/akretion/ak/git/commits{/sha}","comments_url":"https://api.github.com/repos/akretion/ak/comments{/number}","issue_comment_url":"https://api.github.com/repos/akretion/ak/issues/comments{/number}","contents_url":"https://api.github.com/repos/akretion/ak/contents/{+path}","compare_url":"https://api.github.com/repos/akretion/ak/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akretion/ak/merges","archive_url":"https://api.github.com/repos/akretion/ak/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akretion/ak/downloads","issues_url":"https://api.github.com/repos/akretion/ak/issues{/number}","pulls_url":"https://api.github.com/repos/akretion/ak/pulls{/number}","milestones_url":"https://api.github.com/repos/akretion/ak/milestones{/number}","notifications_url":"https://api.github.com/repos/akretion/ak/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akretion/ak/labels{/name}","releases_url":"https://api.github.com/repos/akretion/ak/releases{/id}","deployments_url":"https://api.github.com/repos/akretion/ak/deployments","created_at":"2016-02-25T11:47:56Z","updated_at":"2016-02-25T11:47:57Z","pushed_at":"2016-04-12T16:04:42Z","git_url":"git://github.com/akretion/ak.git","ssh_url":"git@github.com:akretion/ak.git","clone_url":"https://github.com/akretion/ak.git","svn_url":"https://github.com/akretion/ak","homepage":null,"size":18,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akretion/ak/pulls/5"},"html":{"href":"https://github.com/akretion/ak/pull/5"},"issue":{"href":"https://api.github.com/repos/akretion/ak/issues/5"},"comments":{"href":"https://api.github.com/repos/akretion/ak/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/akretion/ak/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/akretion/ak/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akretion/ak/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/akretion/ak/statuses/4f0c479c6bdeda286b5ba5fb666271db3e580cc9"}}}}