{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter/nbviewer/pulls/comments/36152301","id":36152301,"diff_hunk":"@@ -45,12 +47,25 @@ class CreateHandler(BaseHandler):\n \n     only redirects to the appropriate URL\n     \"\"\"\n+    uri_rewrite_list = None\n+\n     def post(self):\n         value = self.get_argument('gistnorurl', '')\n-        redirect_url = transform_ipynb_uri(value, self.provider_rewrites)\n+        redirect_url = transform_ipynb_uri(value, self.get_provider_rewrites())\n         app_log.info(\"create %s => %s\", value, redirect_url)\n         self.redirect(redirect_url)\n \n+    @classmethod\n+    def get_provider_rewrites(cls):\n+        # storing this on a class attribute is a little icky, but is better\n+        # than the global this was refactored from.\n+        if cls.uri_rewrite_list is None:\n+            # providers is a list of module import paths\n+            providers = self.settings['provider_rewrites']","path":"nbviewer/handlers.py","position":39,"original_position":39,"commit_id":"0824b2ae4111a7c32b54711db346ed776286b8c2","original_commit_id":"0824b2ae4111a7c32b54711db346ed776286b8c2","user":{"login":"bollwyvl","id":45380,"avatar_url":"https://avatars.githubusercontent.com/u/45380?v=3","gravatar_id":"","url":"https://api.github.com/users/bollwyvl","html_url":"https://github.com/bollwyvl","followers_url":"https://api.github.com/users/bollwyvl/followers","following_url":"https://api.github.com/users/bollwyvl/following{/other_user}","gists_url":"https://api.github.com/users/bollwyvl/gists{/gist_id}","starred_url":"https://api.github.com/users/bollwyvl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bollwyvl/subscriptions","organizations_url":"https://api.github.com/users/bollwyvl/orgs","repos_url":"https://api.github.com/users/bollwyvl/repos","events_url":"https://api.github.com/users/bollwyvl/events{/privacy}","received_events_url":"https://api.github.com/users/bollwyvl/received_events","type":"User","site_admin":false},"body":"Ah, a bit more involved than that, since `settings` actually would only be on `self`. hmm...","created_at":"2015-08-04T02:17:37Z","updated_at":"2015-08-04T02:17:37Z","html_url":"https://github.com/jupyter/nbviewer/pull/486#discussion_r36152301","pull_request_url":"https://api.github.com/repos/jupyter/nbviewer/pulls/486","_links":{"self":{"href":"https://api.github.com/repos/jupyter/nbviewer/pulls/comments/36152301"},"html":{"href":"https://github.com/jupyter/nbviewer/pull/486#discussion_r36152301"},"pull_request":{"href":"https://api.github.com/repos/jupyter/nbviewer/pulls/486"}}},"pull_request":{"url":"https://api.github.com/repos/jupyter/nbviewer/pulls/486","id":41420637,"html_url":"https://github.com/jupyter/nbviewer/pull/486","diff_url":"https://github.com/jupyter/nbviewer/pull/486.diff","patch_url":"https://github.com/jupyter/nbviewer/pull/486.patch","issue_url":"https://api.github.com/repos/jupyter/nbviewer/issues/486","number":486,"state":"open","locked":false,"title":"Reorg2","user":{"login":"mrterry","id":528022,"avatar_url":"https://avatars.githubusercontent.com/u/528022?v=3","gravatar_id":"","url":"https://api.github.com/users/mrterry","html_url":"https://github.com/mrterry","followers_url":"https://api.github.com/users/mrterry/followers","following_url":"https://api.github.com/users/mrterry/following{/other_user}","gists_url":"https://api.github.com/users/mrterry/gists{/gist_id}","starred_url":"https://api.github.com/users/mrterry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrterry/subscriptions","organizations_url":"https://api.github.com/users/mrterry/orgs","repos_url":"https://api.github.com/users/mrterry/repos","events_url":"https://api.github.com/users/mrterry/events{/privacy}","received_events_url":"https://api.github.com/users/mrterry/received_events","type":"User","site_admin":false},"body":"This builds on #464 and removes globals state from the provider registration process.","created_at":"2015-08-02T16:48:05Z","updated_at":"2015-08-04T02:17:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"871333ad0ba6dbe50b2a982aaf2403e645e7f9fd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jupyter/nbviewer/pulls/486/commits","review_comments_url":"https://api.github.com/repos/jupyter/nbviewer/pulls/486/comments","review_comment_url":"https://api.github.com/repos/jupyter/nbviewer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter/nbviewer/issues/486/comments","statuses_url":"https://api.github.com/repos/jupyter/nbviewer/statuses/0824b2ae4111a7c32b54711db346ed776286b8c2","head":{"label":"mrterry:reorg2","ref":"reorg2","sha":"0824b2ae4111a7c32b54711db346ed776286b8c2","user":{"login":"mrterry","id":528022,"avatar_url":"https://avatars.githubusercontent.com/u/528022?v=3","gravatar_id":"","url":"https://api.github.com/users/mrterry","html_url":"https://github.com/mrterry","followers_url":"https://api.github.com/users/mrterry/followers","following_url":"https://api.github.com/users/mrterry/following{/other_user}","gists_url":"https://api.github.com/users/mrterry/gists{/gist_id}","starred_url":"https://api.github.com/users/mrterry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrterry/subscriptions","organizations_url":"https://api.github.com/users/mrterry/orgs","repos_url":"https://api.github.com/users/mrterry/repos","events_url":"https://api.github.com/users/mrterry/events{/privacy}","received_events_url":"https://api.github.com/users/mrterry/received_events","type":"User","site_admin":false},"repo":{"id":35564157,"name":"nbviewer","full_name":"mrterry/nbviewer","owner":{"login":"mrterry","id":528022,"avatar_url":"https://avatars.githubusercontent.com/u/528022?v=3","gravatar_id":"","url":"https://api.github.com/users/mrterry","html_url":"https://github.com/mrterry","followers_url":"https://api.github.com/users/mrterry/followers","following_url":"https://api.github.com/users/mrterry/following{/other_user}","gists_url":"https://api.github.com/users/mrterry/gists{/gist_id}","starred_url":"https://api.github.com/users/mrterry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrterry/subscriptions","organizations_url":"https://api.github.com/users/mrterry/orgs","repos_url":"https://api.github.com/users/mrterry/repos","events_url":"https://api.github.com/users/mrterry/events{/privacy}","received_events_url":"https://api.github.com/users/mrterry/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrterry/nbviewer","description":"Nbconvert as a webservice (rendering ipynb to static HTML)","fork":true,"url":"https://api.github.com/repos/mrterry/nbviewer","forks_url":"https://api.github.com/repos/mrterry/nbviewer/forks","keys_url":"https://api.github.com/repos/mrterry/nbviewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrterry/nbviewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrterry/nbviewer/teams","hooks_url":"https://api.github.com/repos/mrterry/nbviewer/hooks","issue_events_url":"https://api.github.com/repos/mrterry/nbviewer/issues/events{/number}","events_url":"https://api.github.com/repos/mrterry/nbviewer/events","assignees_url":"https://api.github.com/repos/mrterry/nbviewer/assignees{/user}","branches_url":"https://api.github.com/repos/mrterry/nbviewer/branches{/branch}","tags_url":"https://api.github.com/repos/mrterry/nbviewer/tags","blobs_url":"https://api.github.com/repos/mrterry/nbviewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrterry/nbviewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrterry/nbviewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrterry/nbviewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrterry/nbviewer/statuses/{sha}","languages_url":"https://api.github.com/repos/mrterry/nbviewer/languages","stargazers_url":"https://api.github.com/repos/mrterry/nbviewer/stargazers","contributors_url":"https://api.github.com/repos/mrterry/nbviewer/contributors","subscribers_url":"https://api.github.com/repos/mrterry/nbviewer/subscribers","subscription_url":"https://api.github.com/repos/mrterry/nbviewer/subscription","commits_url":"https://api.github.com/repos/mrterry/nbviewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrterry/nbviewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrterry/nbviewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrterry/nbviewer/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrterry/nbviewer/contents/{+path}","compare_url":"https://api.github.com/repos/mrterry/nbviewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrterry/nbviewer/merges","archive_url":"https://api.github.com/repos/mrterry/nbviewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrterry/nbviewer/downloads","issues_url":"https://api.github.com/repos/mrterry/nbviewer/issues{/number}","pulls_url":"https://api.github.com/repos/mrterry/nbviewer/pulls{/number}","milestones_url":"https://api.github.com/repos/mrterry/nbviewer/milestones{/number}","notifications_url":"https://api.github.com/repos/mrterry/nbviewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrterry/nbviewer/labels{/name}","releases_url":"https://api.github.com/repos/mrterry/nbviewer/releases{/id}","created_at":"2015-05-13T17:37:44Z","updated_at":"2015-05-13T17:37:45Z","pushed_at":"2015-08-02T18:01:26Z","git_url":"git://github.com/mrterry/nbviewer.git","ssh_url":"git@github.com:mrterry/nbviewer.git","clone_url":"https://github.com/mrterry/nbviewer.git","svn_url":"https://github.com/mrterry/nbviewer","homepage":"http://nbviewer.ipython.org","size":10098,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jupyter:master","ref":"master","sha":"404771bb977d6c3eaf8294a2d7fd284fb39dd59d","user":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"repo":{"id":5303123,"name":"nbviewer","full_name":"jupyter/nbviewer","owner":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jupyter/nbviewer","description":"Nbconvert as a webservice (rendering ipynb to static HTML)","fork":false,"url":"https://api.github.com/repos/jupyter/nbviewer","forks_url":"https://api.github.com/repos/jupyter/nbviewer/forks","keys_url":"https://api.github.com/repos/jupyter/nbviewer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/nbviewer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/nbviewer/teams","hooks_url":"https://api.github.com/repos/jupyter/nbviewer/hooks","issue_events_url":"https://api.github.com/repos/jupyter/nbviewer/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/nbviewer/events","assignees_url":"https://api.github.com/repos/jupyter/nbviewer/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/nbviewer/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/nbviewer/tags","blobs_url":"https://api.github.com/repos/jupyter/nbviewer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/nbviewer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/nbviewer/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/nbviewer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/nbviewer/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/nbviewer/languages","stargazers_url":"https://api.github.com/repos/jupyter/nbviewer/stargazers","contributors_url":"https://api.github.com/repos/jupyter/nbviewer/contributors","subscribers_url":"https://api.github.com/repos/jupyter/nbviewer/subscribers","subscription_url":"https://api.github.com/repos/jupyter/nbviewer/subscription","commits_url":"https://api.github.com/repos/jupyter/nbviewer/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/nbviewer/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/nbviewer/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/nbviewer/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/nbviewer/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/nbviewer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/nbviewer/merges","archive_url":"https://api.github.com/repos/jupyter/nbviewer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/nbviewer/downloads","issues_url":"https://api.github.com/repos/jupyter/nbviewer/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/nbviewer/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/nbviewer/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/nbviewer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/nbviewer/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/nbviewer/releases{/id}","created_at":"2012-08-05T11:42:33Z","updated_at":"2015-07-30T06:23:54Z","pushed_at":"2015-08-04T00:00:05Z","git_url":"git://github.com/jupyter/nbviewer.git","ssh_url":"git@github.com:jupyter/nbviewer.git","clone_url":"https://github.com/jupyter/nbviewer.git","svn_url":"https://github.com/jupyter/nbviewer","homepage":"http://nbviewer.ipython.org","size":12555,"stargazers_count":496,"watchers_count":496,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":148,"mirror_url":null,"open_issues_count":83,"forks":148,"open_issues":83,"watchers":496,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter/nbviewer/pulls/486"},"html":{"href":"https://github.com/jupyter/nbviewer/pull/486"},"issue":{"href":"https://api.github.com/repos/jupyter/nbviewer/issues/486"},"comments":{"href":"https://api.github.com/repos/jupyter/nbviewer/issues/486/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter/nbviewer/pulls/486/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter/nbviewer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter/nbviewer/pulls/486/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter/nbviewer/statuses/0824b2ae4111a7c32b54711db346ed776286b8c2"}}}}