{"action":"closed","number":315,"pull_request":{"url":"https://api.github.com/repos/nyaadevs/nyaa/pulls/315","id":133069534,"html_url":"https://github.com/nyaadevs/nyaa/pull/315","diff_url":"https://github.com/nyaadevs/nyaa/pull/315.diff","patch_url":"https://github.com/nyaadevs/nyaa/pull/315.patch","issue_url":"https://api.github.com/repos/nyaadevs/nyaa/issues/315","number":315,"state":"closed","locked":false,"title":"Prepare for app factory (1/2)","user":{"login":"sharkykh","id":10238474,"avatar_url":"https://avatars1.githubusercontent.com/u/10238474?v=4","gravatar_id":"","url":"https://api.github.com/users/sharkykh","html_url":"https://github.com/sharkykh","followers_url":"https://api.github.com/users/sharkykh/followers","following_url":"https://api.github.com/users/sharkykh/following{/other_user}","gists_url":"https://api.github.com/users/sharkykh/gists{/gist_id}","starred_url":"https://api.github.com/users/sharkykh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharkykh/subscriptions","organizations_url":"https://api.github.com/users/sharkykh/orgs","repos_url":"https://api.github.com/users/sharkykh/repos","events_url":"https://api.github.com/users/sharkykh/events{/privacy}","received_events_url":"https://api.github.com/users/sharkykh/received_events","type":"User","site_admin":false},"body":"#### ~This still needs to be tested~\r\n\r\n### Changes:\r\n* Moved `db` into `nyaa.extensions`:\r\n  - Switched to `db.init_app(app)`\r\n  - Changed all `from nyaa import db` imports to `from nyaa.extensions import db`\r\n* Moved `fix_paginate` into `nyaa.extensions` (into another function, see code).\r\n  - Switched from an import line to a simple function call.\r\n  - No need for `nyaa.fix_paginate`.\r\n* Move `assets` into `nyaa.extensions`, even though they're not being used ATM.\r\n  - Switched to `assets.init_app(app)`\r\n* Move debug toolbar into nyaa.extensions\r\n  - Switched to `toolbar.init_app(app)`\r\n* Move `nyaa.torrents.create_magnet_from_es_info` context processor into `template-utils` blueprint\r\n   **Don't think I can actually test this function** (my system won't be able to handle ES right now)\r\n   Update: I was able to confirm the function is still called from the templates, so all is well.\r\n* ### Updated tools\r\nChanges in the main section of `db_create.py` are mostly whitespace. See [this diff](https://github.com/nyaadevs/nyaa/commit/716abf6dbd79d952559e7912b1070c20b954288a?w=1#diff-df750be641e18c2aa5b0d6c15ed256ab).\r\n`db_migrate.py` and `db_create.py` seem to work.\r\nI also tested the change I've made in `import_to_es.py` by issuing a simple db execute:\r\n```python\r\n# import_to_es.py\r\n[...]\r\n# Get binlog status from mysql\r\nwith app.app_context():\r\n    test = db.engine.execute('SELECT * FROM `nyaa_torrents`;').fetchone()\r\n    print(test)\r\n    # this just returned `None` for me:\r\n    master_status = db.engine.execute('SHOW MASTER STATUS;').fetchone()\r\n[...]\r\n# ./import_to_es.py\r\n(1, b'\\xc5{\\xc4\\xb3\\x9d \\xed\\xb8\"\\x00\\x86\\xd9^\\xf1\\xcf\\xeegD\\xda\\x19', 'BSG Battlestar Galactica 720p Complete 2003-2012 Extras Subs', 'Battlestar Galactica (2003).torrent', '', 'test', 67956463231, 'utf-8', 22, b'\\x7f\\x00\\x00\\x01', 1, 1, datetime.datetime(2017, 7, 27, 13, 58, 25), datetime.datetime(2017, 7, 28, 15, 20, 43), 2, 1, 1, None)\r\n```","created_at":"2017-07-28T23:42:17Z","updated_at":"2017-07-30T17:35:17Z","closed_at":"2017-07-30T17:35:17Z","merged_at":"2017-07-30T17:35:17Z","merge_commit_sha":"0181d6cb3361838226985fc92aa7391f23642ebb","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/nyaadevs/nyaa/pulls/315/commits","review_comments_url":"https://api.github.com/repos/nyaadevs/nyaa/pulls/315/comments","review_comment_url":"https://api.github.com/repos/nyaadevs/nyaa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nyaadevs/nyaa/issues/315/comments","statuses_url":"https://api.github.com/repos/nyaadevs/nyaa/statuses/f071044fbb7d7bc1f3beaa4d76e3fc3fa3b2afa5","head":{"label":"nyaadevs:app-factory/1-prepare","ref":"app-factory/1-prepare","sha":"f071044fbb7d7bc1f3beaa4d76e3fc3fa3b2afa5","user":{"login":"nyaadevs","id":28658394,"avatar_url":"https://avatars2.githubusercontent.com/u/28658394?v=4","gravatar_id":"","url":"https://api.github.com/users/nyaadevs","html_url":"https://github.com/nyaadevs","followers_url":"https://api.github.com/users/nyaadevs/followers","following_url":"https://api.github.com/users/nyaadevs/following{/other_user}","gists_url":"https://api.github.com/users/nyaadevs/gists{/gist_id}","starred_url":"https://api.github.com/users/nyaadevs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyaadevs/subscriptions","organizations_url":"https://api.github.com/users/nyaadevs/orgs","repos_url":"https://api.github.com/users/nyaadevs/repos","events_url":"https://api.github.com/users/nyaadevs/events{/privacy}","received_events_url":"https://api.github.com/users/nyaadevs/received_events","type":"Organization","site_admin":false},"repo":{"id":91119673,"name":"nyaa","full_name":"nyaadevs/nyaa","owner":{"login":"nyaadevs","id":28658394,"avatar_url":"https://avatars2.githubusercontent.com/u/28658394?v=4","gravatar_id":"","url":"https://api.github.com/users/nyaadevs","html_url":"https://github.com/nyaadevs","followers_url":"https://api.github.com/users/nyaadevs/followers","following_url":"https://api.github.com/users/nyaadevs/following{/other_user}","gists_url":"https://api.github.com/users/nyaadevs/gists{/gist_id}","starred_url":"https://api.github.com/users/nyaadevs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyaadevs/subscriptions","organizations_url":"https://api.github.com/users/nyaadevs/orgs","repos_url":"https://api.github.com/users/nyaadevs/repos","events_url":"https://api.github.com/users/nyaadevs/events{/privacy}","received_events_url":"https://api.github.com/users/nyaadevs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nyaadevs/nyaa","description":"The software behind Nyaa.si!","fork":false,"url":"https://api.github.com/repos/nyaadevs/nyaa","forks_url":"https://api.github.com/repos/nyaadevs/nyaa/forks","keys_url":"https://api.github.com/repos/nyaadevs/nyaa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nyaadevs/nyaa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nyaadevs/nyaa/teams","hooks_url":"https://api.github.com/repos/nyaadevs/nyaa/hooks","issue_events_url":"https://api.github.com/repos/nyaadevs/nyaa/issues/events{/number}","events_url":"https://api.github.com/repos/nyaadevs/nyaa/events","assignees_url":"https://api.github.com/repos/nyaadevs/nyaa/assignees{/user}","branches_url":"https://api.github.com/repos/nyaadevs/nyaa/branches{/branch}","tags_url":"https://api.github.com/repos/nyaadevs/nyaa/tags","blobs_url":"https://api.github.com/repos/nyaadevs/nyaa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nyaadevs/nyaa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nyaadevs/nyaa/git/refs{/sha}","trees_url":"https://api.github.com/repos/nyaadevs/nyaa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nyaadevs/nyaa/statuses/{sha}","languages_url":"https://api.github.com/repos/nyaadevs/nyaa/languages","stargazers_url":"https://api.github.com/repos/nyaadevs/nyaa/stargazers","contributors_url":"https://api.github.com/repos/nyaadevs/nyaa/contributors","subscribers_url":"https://api.github.com/repos/nyaadevs/nyaa/subscribers","subscription_url":"https://api.github.com/repos/nyaadevs/nyaa/subscription","commits_url":"https://api.github.com/repos/nyaadevs/nyaa/commits{/sha}","git_commits_url":"https://api.github.com/repos/nyaadevs/nyaa/git/commits{/sha}","comments_url":"https://api.github.com/repos/nyaadevs/nyaa/comments{/number}","issue_comment_url":"https://api.github.com/repos/nyaadevs/nyaa/issues/comments{/number}","contents_url":"https://api.github.com/repos/nyaadevs/nyaa/contents/{+path}","compare_url":"https://api.github.com/repos/nyaadevs/nyaa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nyaadevs/nyaa/merges","archive_url":"https://api.github.com/repos/nyaadevs/nyaa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nyaadevs/nyaa/downloads","issues_url":"https://api.github.com/repos/nyaadevs/nyaa/issues{/number}","pulls_url":"https://api.github.com/repos/nyaadevs/nyaa/pulls{/number}","milestones_url":"https://api.github.com/repos/nyaadevs/nyaa/milestones{/number}","notifications_url":"https://api.github.com/repos/nyaadevs/nyaa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nyaadevs/nyaa/labels{/name}","releases_url":"https://api.github.com/repos/nyaadevs/nyaa/releases{/id}","deployments_url":"https://api.github.com/repos/nyaadevs/nyaa/deployments","created_at":"2017-05-12T18:35:30Z","updated_at":"2017-07-30T17:16:28Z","pushed_at":"2017-07-30T17:35:17Z","git_url":"git://github.com/nyaadevs/nyaa.git","ssh_url":"git@github.com:nyaadevs/nyaa.git","clone_url":"https://github.com/nyaadevs/nyaa.git","svn_url":"https://github.com/nyaadevs/nyaa","homepage":"","size":1540,"stargazers_count":965,"watchers_count":965,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":137,"mirror_url":null,"open_issues_count":42,"forks":137,"open_issues":42,"watchers":965,"default_branch":"master"}},"base":{"label":"nyaadevs:master","ref":"master","sha":"1bc36c5a17241bdcb26d2906bc4072340c64cc11","user":{"login":"nyaadevs","id":28658394,"avatar_url":"https://avatars2.githubusercontent.com/u/28658394?v=4","gravatar_id":"","url":"https://api.github.com/users/nyaadevs","html_url":"https://github.com/nyaadevs","followers_url":"https://api.github.com/users/nyaadevs/followers","following_url":"https://api.github.com/users/nyaadevs/following{/other_user}","gists_url":"https://api.github.com/users/nyaadevs/gists{/gist_id}","starred_url":"https://api.github.com/users/nyaadevs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyaadevs/subscriptions","organizations_url":"https://api.github.com/users/nyaadevs/orgs","repos_url":"https://api.github.com/users/nyaadevs/repos","events_url":"https://api.github.com/users/nyaadevs/events{/privacy}","received_events_url":"https://api.github.com/users/nyaadevs/received_events","type":"Organization","site_admin":false},"repo":{"id":91119673,"name":"nyaa","full_name":"nyaadevs/nyaa","owner":{"login":"nyaadevs","id":28658394,"avatar_url":"https://avatars2.githubusercontent.com/u/28658394?v=4","gravatar_id":"","url":"https://api.github.com/users/nyaadevs","html_url":"https://github.com/nyaadevs","followers_url":"https://api.github.com/users/nyaadevs/followers","following_url":"https://api.github.com/users/nyaadevs/following{/other_user}","gists_url":"https://api.github.com/users/nyaadevs/gists{/gist_id}","starred_url":"https://api.github.com/users/nyaadevs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyaadevs/subscriptions","organizations_url":"https://api.github.com/users/nyaadevs/orgs","repos_url":"https://api.github.com/users/nyaadevs/repos","events_url":"https://api.github.com/users/nyaadevs/events{/privacy}","received_events_url":"https://api.github.com/users/nyaadevs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nyaadevs/nyaa","description":"The software behind Nyaa.si!","fork":false,"url":"https://api.github.com/repos/nyaadevs/nyaa","forks_url":"https://api.github.com/repos/nyaadevs/nyaa/forks","keys_url":"https://api.github.com/repos/nyaadevs/nyaa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nyaadevs/nyaa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nyaadevs/nyaa/teams","hooks_url":"https://api.github.com/repos/nyaadevs/nyaa/hooks","issue_events_url":"https://api.github.com/repos/nyaadevs/nyaa/issues/events{/number}","events_url":"https://api.github.com/repos/nyaadevs/nyaa/events","assignees_url":"https://api.github.com/repos/nyaadevs/nyaa/assignees{/user}","branches_url":"https://api.github.com/repos/nyaadevs/nyaa/branches{/branch}","tags_url":"https://api.github.com/repos/nyaadevs/nyaa/tags","blobs_url":"https://api.github.com/repos/nyaadevs/nyaa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nyaadevs/nyaa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nyaadevs/nyaa/git/refs{/sha}","trees_url":"https://api.github.com/repos/nyaadevs/nyaa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nyaadevs/nyaa/statuses/{sha}","languages_url":"https://api.github.com/repos/nyaadevs/nyaa/languages","stargazers_url":"https://api.github.com/repos/nyaadevs/nyaa/stargazers","contributors_url":"https://api.github.com/repos/nyaadevs/nyaa/contributors","subscribers_url":"https://api.github.com/repos/nyaadevs/nyaa/subscribers","subscription_url":"https://api.github.com/repos/nyaadevs/nyaa/subscription","commits_url":"https://api.github.com/repos/nyaadevs/nyaa/commits{/sha}","git_commits_url":"https://api.github.com/repos/nyaadevs/nyaa/git/commits{/sha}","comments_url":"https://api.github.com/repos/nyaadevs/nyaa/comments{/number}","issue_comment_url":"https://api.github.com/repos/nyaadevs/nyaa/issues/comments{/number}","contents_url":"https://api.github.com/repos/nyaadevs/nyaa/contents/{+path}","compare_url":"https://api.github.com/repos/nyaadevs/nyaa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nyaadevs/nyaa/merges","archive_url":"https://api.github.com/repos/nyaadevs/nyaa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nyaadevs/nyaa/downloads","issues_url":"https://api.github.com/repos/nyaadevs/nyaa/issues{/number}","pulls_url":"https://api.github.com/repos/nyaadevs/nyaa/pulls{/number}","milestones_url":"https://api.github.com/repos/nyaadevs/nyaa/milestones{/number}","notifications_url":"https://api.github.com/repos/nyaadevs/nyaa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nyaadevs/nyaa/labels{/name}","releases_url":"https://api.github.com/repos/nyaadevs/nyaa/releases{/id}","deployments_url":"https://api.github.com/repos/nyaadevs/nyaa/deployments","created_at":"2017-05-12T18:35:30Z","updated_at":"2017-07-30T17:16:28Z","pushed_at":"2017-07-30T17:35:17Z","git_url":"git://github.com/nyaadevs/nyaa.git","ssh_url":"git@github.com:nyaadevs/nyaa.git","clone_url":"https://github.com/nyaadevs/nyaa.git","svn_url":"https://github.com/nyaadevs/nyaa","homepage":"","size":1540,"stargazers_count":965,"watchers_count":965,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":137,"mirror_url":null,"open_issues_count":42,"forks":137,"open_issues":42,"watchers":965,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nyaadevs/nyaa/pulls/315"},"html":{"href":"https://github.com/nyaadevs/nyaa/pull/315"},"issue":{"href":"https://api.github.com/repos/nyaadevs/nyaa/issues/315"},"comments":{"href":"https://api.github.com/repos/nyaadevs/nyaa/issues/315/comments"},"review_comments":{"href":"https://api.github.com/repos/nyaadevs/nyaa/pulls/315/comments"},"review_comment":{"href":"https://api.github.com/repos/nyaadevs/nyaa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nyaadevs/nyaa/pulls/315/commits"},"statuses":{"href":"https://api.github.com/repos/nyaadevs/nyaa/statuses/f071044fbb7d7bc1f3beaa4d76e3fc3fa3b2afa5"}},"merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"sharkykh","id":10238474,"avatar_url":"https://avatars1.githubusercontent.com/u/10238474?v=4","gravatar_id":"","url":"https://api.github.com/users/sharkykh","html_url":"https://github.com/sharkykh","followers_url":"https://api.github.com/users/sharkykh/followers","following_url":"https://api.github.com/users/sharkykh/following{/other_user}","gists_url":"https://api.github.com/users/sharkykh/gists{/gist_id}","starred_url":"https://api.github.com/users/sharkykh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharkykh/subscriptions","organizations_url":"https://api.github.com/users/sharkykh/orgs","repos_url":"https://api.github.com/users/sharkykh/repos","events_url":"https://api.github.com/users/sharkykh/events{/privacy}","received_events_url":"https://api.github.com/users/sharkykh/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":7,"additions":126,"deletions":103,"changed_files":16}}
{"actor":{"display_login":"sharkykh"}}