{"action":"created","comment":{"url":"https://api.github.com/repos/Net-ng/kansha/pulls/comments/43525753","id":43525753,"diff_hunk":"@@ -7,39 +7,29 @@\n # the file LICENSE.txt, which you should have received as part of\n # this distribution.\n #--\n-\n-from .models import DataUser\n-from nagare.namespaces import xhtml\n-from nagare import component, i18n\n-from ..toolbox import autocomplete\n import random\n from datetime import datetime, timedelta\n \n+from nagare.namespaces import xhtml\n+from nagare import component, i18n\n \n-def get_user_class(source):\n-    \"\"\" Return User Class for a given source\n-\n-    Generic method (from peak). Authentication system implements this\n-    method.\n-\n-    In:\n-     - ``source`` -- login source (i.e application, google...)\n-    Return:\n-     - the user class\n-    \"\"\"\n-    raise Exception(\"User class for source %s not found\" % source)\n-\n-\n-def get_app_user(username, data=None):\n-    \"\"\"Return User instance\"\"\"\n-    if not data:\n-        data = UserManager().get_by_username(username)\n-    klass = get_user_class(data.source)\n-    return klass(username, data=data)\n+from ..toolbox import autocomplete\n+from .models import DataUser\n+from .comp import User\n \n \n class UserManager(object):\n \n+    @classmethod\n+    def get_app_user(cls, username, data=None):\n+        \"\"\"Return User instance\"\"\"\n+        if not data:\n+            data = cls.get_by_username(username)\n+        if data.source != 'application':\n+            # we need to set a passwd for nagare auth\n+            return User(username, 'passwd', data=data)","path":"kansha/user/usermanager.py","position":49,"original_position":49,"commit_id":"53d8137465ca1f48316aebc6465b9d9fa441e187","original_commit_id":"53d8137465ca1f48316aebc6465b9d9fa441e187","user":{"login":"nagareproject","id":1702546,"avatar_url":"https://avatars.githubusercontent.com/u/1702546?v=3","gravatar_id":"","url":"https://api.github.com/users/nagareproject","html_url":"https://github.com/nagareproject","followers_url":"https://api.github.com/users/nagareproject/followers","following_url":"https://api.github.com/users/nagareproject/following{/other_user}","gists_url":"https://api.github.com/users/nagareproject/gists{/gist_id}","starred_url":"https://api.github.com/users/nagareproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagareproject/subscriptions","organizations_url":"https://api.github.com/users/nagareproject/orgs","repos_url":"https://api.github.com/users/nagareproject/repos","events_url":"https://api.github.com/users/nagareproject/events{/privacy}","received_events_url":"https://api.github.com/users/nagareproject/received_events","type":"User","site_admin":false},"body":"No multiple 'return' in a function (only authorized on arguments checks):\r\n\r\nif data.source != 'application':\r\n  user = User(username, 'passwd', data=data)\r\nelse:\r\n  user = User(username, data=data)\r\n\r\nreturn user","created_at":"2015-10-30T16:57:07Z","updated_at":"2015-10-30T16:57:07Z","html_url":"https://github.com/Net-ng/kansha/pull/82#discussion_r43525753","pull_request_url":"https://api.github.com/repos/Net-ng/kansha/pulls/82","_links":{"self":{"href":"https://api.github.com/repos/Net-ng/kansha/pulls/comments/43525753"},"html":{"href":"https://github.com/Net-ng/kansha/pull/82#discussion_r43525753"},"pull_request":{"href":"https://api.github.com/repos/Net-ng/kansha/pulls/82"}}},"pull_request":{"url":"https://api.github.com/repos/Net-ng/kansha/pulls/82","id":49028747,"html_url":"https://github.com/Net-ng/kansha/pull/82","diff_url":"https://github.com/Net-ng/kansha/pull/82.diff","patch_url":"https://github.com/Net-ng/kansha/pull/82.patch","issue_url":"https://api.github.com/repos/Net-ng/kansha/issues/82","number":82,"state":"open","locked":false,"title":"Move to services","user":{"login":"rtxm","id":7592443,"avatar_url":"https://avatars.githubusercontent.com/u/7592443?v=3","gravatar_id":"","url":"https://api.github.com/users/rtxm","html_url":"https://github.com/rtxm","followers_url":"https://api.github.com/users/rtxm/followers","following_url":"https://api.github.com/users/rtxm/following{/other_user}","gists_url":"https://api.github.com/users/rtxm/gists{/gist_id}","starred_url":"https://api.github.com/users/rtxm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtxm/subscriptions","organizations_url":"https://api.github.com/users/rtxm/orgs","repos_url":"https://api.github.com/users/rtxm/repos","events_url":"https://api.github.com/users/rtxm/events{/privacy}","received_events_url":"https://api.github.com/users/rtxm/received_events","type":"User","site_admin":false},"body":"* Use nagare-services (to be released soon) instead of ad-hoc solution.\r\n* The ubiquitous mailer and assets manager are now services\r\n* Don't store the application_url, but get it from requests when needed\r\n","created_at":"2015-10-28T16:13:27Z","updated_at":"2015-10-30T16:57:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d520767ba38a6feb13d96e1ea0e0916c0b8f85e3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Net-ng/kansha/pulls/82/commits","review_comments_url":"https://api.github.com/repos/Net-ng/kansha/pulls/82/comments","review_comment_url":"https://api.github.com/repos/Net-ng/kansha/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Net-ng/kansha/issues/82/comments","statuses_url":"https://api.github.com/repos/Net-ng/kansha/statuses/53d8137465ca1f48316aebc6465b9d9fa441e187","head":{"label":"Net-ng:move_to_services","ref":"move_to_services","sha":"53d8137465ca1f48316aebc6465b9d9fa441e187","user":{"login":"Net-ng","id":11835925,"avatar_url":"https://avatars.githubusercontent.com/u/11835925?v=3","gravatar_id":"","url":"https://api.github.com/users/Net-ng","html_url":"https://github.com/Net-ng","followers_url":"https://api.github.com/users/Net-ng/followers","following_url":"https://api.github.com/users/Net-ng/following{/other_user}","gists_url":"https://api.github.com/users/Net-ng/gists{/gist_id}","starred_url":"https://api.github.com/users/Net-ng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Net-ng/subscriptions","organizations_url":"https://api.github.com/users/Net-ng/orgs","repos_url":"https://api.github.com/users/Net-ng/repos","events_url":"https://api.github.com/users/Net-ng/events{/privacy}","received_events_url":"https://api.github.com/users/Net-ng/received_events","type":"User","site_admin":false},"repo":{"id":34677388,"name":"kansha","full_name":"Net-ng/kansha","owner":{"login":"Net-ng","id":11835925,"avatar_url":"https://avatars.githubusercontent.com/u/11835925?v=3","gravatar_id":"","url":"https://api.github.com/users/Net-ng","html_url":"https://github.com/Net-ng","followers_url":"https://api.github.com/users/Net-ng/followers","following_url":"https://api.github.com/users/Net-ng/following{/other_user}","gists_url":"https://api.github.com/users/Net-ng/gists{/gist_id}","starred_url":"https://api.github.com/users/Net-ng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Net-ng/subscriptions","organizations_url":"https://api.github.com/users/Net-ng/orgs","repos_url":"https://api.github.com/users/Net-ng/repos","events_url":"https://api.github.com/users/Net-ng/events{/privacy}","received_events_url":"https://api.github.com/users/Net-ng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Net-ng/kansha","description":"Manage and share collaborative pinboards on the web.","fork":false,"url":"https://api.github.com/repos/Net-ng/kansha","forks_url":"https://api.github.com/repos/Net-ng/kansha/forks","keys_url":"https://api.github.com/repos/Net-ng/kansha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Net-ng/kansha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Net-ng/kansha/teams","hooks_url":"https://api.github.com/repos/Net-ng/kansha/hooks","issue_events_url":"https://api.github.com/repos/Net-ng/kansha/issues/events{/number}","events_url":"https://api.github.com/repos/Net-ng/kansha/events","assignees_url":"https://api.github.com/repos/Net-ng/kansha/assignees{/user}","branches_url":"https://api.github.com/repos/Net-ng/kansha/branches{/branch}","tags_url":"https://api.github.com/repos/Net-ng/kansha/tags","blobs_url":"https://api.github.com/repos/Net-ng/kansha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Net-ng/kansha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Net-ng/kansha/git/refs{/sha}","trees_url":"https://api.github.com/repos/Net-ng/kansha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Net-ng/kansha/statuses/{sha}","languages_url":"https://api.github.com/repos/Net-ng/kansha/languages","stargazers_url":"https://api.github.com/repos/Net-ng/kansha/stargazers","contributors_url":"https://api.github.com/repos/Net-ng/kansha/contributors","subscribers_url":"https://api.github.com/repos/Net-ng/kansha/subscribers","subscription_url":"https://api.github.com/repos/Net-ng/kansha/subscription","commits_url":"https://api.github.com/repos/Net-ng/kansha/commits{/sha}","git_commits_url":"https://api.github.com/repos/Net-ng/kansha/git/commits{/sha}","comments_url":"https://api.github.com/repos/Net-ng/kansha/comments{/number}","issue_comment_url":"https://api.github.com/repos/Net-ng/kansha/issues/comments{/number}","contents_url":"https://api.github.com/repos/Net-ng/kansha/contents/{+path}","compare_url":"https://api.github.com/repos/Net-ng/kansha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Net-ng/kansha/merges","archive_url":"https://api.github.com/repos/Net-ng/kansha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Net-ng/kansha/downloads","issues_url":"https://api.github.com/repos/Net-ng/kansha/issues{/number}","pulls_url":"https://api.github.com/repos/Net-ng/kansha/pulls{/number}","milestones_url":"https://api.github.com/repos/Net-ng/kansha/milestones{/number}","notifications_url":"https://api.github.com/repos/Net-ng/kansha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Net-ng/kansha/labels{/name}","releases_url":"https://api.github.com/repos/Net-ng/kansha/releases{/id}","created_at":"2015-04-27T16:18:06Z","updated_at":"2015-10-12T04:12:58Z","pushed_at":"2015-10-30T10:25:23Z","git_url":"git://github.com/Net-ng/kansha.git","ssh_url":"git@github.com:Net-ng/kansha.git","clone_url":"https://github.com/Net-ng/kansha.git","svn_url":"https://github.com/Net-ng/kansha","homepage":"http://www.kansha.org","size":9283,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":17,"forks":7,"open_issues":17,"watchers":16,"default_branch":"master"}},"base":{"label":"Net-ng:master","ref":"master","sha":"33a1a6ee3963c7a916b1795074a1016bd2be248b","user":{"login":"Net-ng","id":11835925,"avatar_url":"https://avatars.githubusercontent.com/u/11835925?v=3","gravatar_id":"","url":"https://api.github.com/users/Net-ng","html_url":"https://github.com/Net-ng","followers_url":"https://api.github.com/users/Net-ng/followers","following_url":"https://api.github.com/users/Net-ng/following{/other_user}","gists_url":"https://api.github.com/users/Net-ng/gists{/gist_id}","starred_url":"https://api.github.com/users/Net-ng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Net-ng/subscriptions","organizations_url":"https://api.github.com/users/Net-ng/orgs","repos_url":"https://api.github.com/users/Net-ng/repos","events_url":"https://api.github.com/users/Net-ng/events{/privacy}","received_events_url":"https://api.github.com/users/Net-ng/received_events","type":"User","site_admin":false},"repo":{"id":34677388,"name":"kansha","full_name":"Net-ng/kansha","owner":{"login":"Net-ng","id":11835925,"avatar_url":"https://avatars.githubusercontent.com/u/11835925?v=3","gravatar_id":"","url":"https://api.github.com/users/Net-ng","html_url":"https://github.com/Net-ng","followers_url":"https://api.github.com/users/Net-ng/followers","following_url":"https://api.github.com/users/Net-ng/following{/other_user}","gists_url":"https://api.github.com/users/Net-ng/gists{/gist_id}","starred_url":"https://api.github.com/users/Net-ng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Net-ng/subscriptions","organizations_url":"https://api.github.com/users/Net-ng/orgs","repos_url":"https://api.github.com/users/Net-ng/repos","events_url":"https://api.github.com/users/Net-ng/events{/privacy}","received_events_url":"https://api.github.com/users/Net-ng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Net-ng/kansha","description":"Manage and share collaborative pinboards on the web.","fork":false,"url":"https://api.github.com/repos/Net-ng/kansha","forks_url":"https://api.github.com/repos/Net-ng/kansha/forks","keys_url":"https://api.github.com/repos/Net-ng/kansha/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Net-ng/kansha/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Net-ng/kansha/teams","hooks_url":"https://api.github.com/repos/Net-ng/kansha/hooks","issue_events_url":"https://api.github.com/repos/Net-ng/kansha/issues/events{/number}","events_url":"https://api.github.com/repos/Net-ng/kansha/events","assignees_url":"https://api.github.com/repos/Net-ng/kansha/assignees{/user}","branches_url":"https://api.github.com/repos/Net-ng/kansha/branches{/branch}","tags_url":"https://api.github.com/repos/Net-ng/kansha/tags","blobs_url":"https://api.github.com/repos/Net-ng/kansha/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Net-ng/kansha/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Net-ng/kansha/git/refs{/sha}","trees_url":"https://api.github.com/repos/Net-ng/kansha/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Net-ng/kansha/statuses/{sha}","languages_url":"https://api.github.com/repos/Net-ng/kansha/languages","stargazers_url":"https://api.github.com/repos/Net-ng/kansha/stargazers","contributors_url":"https://api.github.com/repos/Net-ng/kansha/contributors","subscribers_url":"https://api.github.com/repos/Net-ng/kansha/subscribers","subscription_url":"https://api.github.com/repos/Net-ng/kansha/subscription","commits_url":"https://api.github.com/repos/Net-ng/kansha/commits{/sha}","git_commits_url":"https://api.github.com/repos/Net-ng/kansha/git/commits{/sha}","comments_url":"https://api.github.com/repos/Net-ng/kansha/comments{/number}","issue_comment_url":"https://api.github.com/repos/Net-ng/kansha/issues/comments{/number}","contents_url":"https://api.github.com/repos/Net-ng/kansha/contents/{+path}","compare_url":"https://api.github.com/repos/Net-ng/kansha/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Net-ng/kansha/merges","archive_url":"https://api.github.com/repos/Net-ng/kansha/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Net-ng/kansha/downloads","issues_url":"https://api.github.com/repos/Net-ng/kansha/issues{/number}","pulls_url":"https://api.github.com/repos/Net-ng/kansha/pulls{/number}","milestones_url":"https://api.github.com/repos/Net-ng/kansha/milestones{/number}","notifications_url":"https://api.github.com/repos/Net-ng/kansha/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Net-ng/kansha/labels{/name}","releases_url":"https://api.github.com/repos/Net-ng/kansha/releases{/id}","created_at":"2015-04-27T16:18:06Z","updated_at":"2015-10-12T04:12:58Z","pushed_at":"2015-10-30T10:25:23Z","git_url":"git://github.com/Net-ng/kansha.git","ssh_url":"git@github.com:Net-ng/kansha.git","clone_url":"https://github.com/Net-ng/kansha.git","svn_url":"https://github.com/Net-ng/kansha","homepage":"http://www.kansha.org","size":9283,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":17,"forks":7,"open_issues":17,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Net-ng/kansha/pulls/82"},"html":{"href":"https://github.com/Net-ng/kansha/pull/82"},"issue":{"href":"https://api.github.com/repos/Net-ng/kansha/issues/82"},"comments":{"href":"https://api.github.com/repos/Net-ng/kansha/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/Net-ng/kansha/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/Net-ng/kansha/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Net-ng/kansha/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/Net-ng/kansha/statuses/53d8137465ca1f48316aebc6465b9d9fa441e187"}}}}