{"action":"created","comment":{"url":"https://api.github.com/repos/cms-dev/cms/pulls/comments/29723759","id":29723759,"diff_hunk":"@@ -822,17 +1152,20 @@ def post(self, task_id):\n         if try_commit(self.sql_session, self):\n             self.redirect(\"/task/%s\" % task_id)\n         else:\n-            self.redirect(\"/add_attachment/%s\" % task_id)\n+            self.redirect(fallback_page)\n \n \n class DeleteAttachmentHandler(BaseHandler):\n     \"\"\"Delete an attachment.\n \n     \"\"\"\n-    def get(self, attachment_id):\n+    def get(self, task_id, attachment_id):\n         attachment = self.safe_get_item(Attachment, attachment_id)\n-        task = attachment.task\n-        self.contest = task.contest\n+        task = self.safe_get_item(Task, task_id)\n+\n+        # Additional check.\n+        if attachment.task is not task:\n+            raise tornado.web.HTTPError(404)","path":"cms/server/AdminWebServer.py","position":537,"original_position":537,"commit_id":"4a770f21a96b8278747268e2e88901415a0ba3e0","original_commit_id":"4a770f21a96b8278747268e2e88901415a0ba3e0","user":{"login":"stefano-maggiolo","id":485490,"avatar_url":"https://avatars.githubusercontent.com/u/485490?v=3","gravatar_id":"","url":"https://api.github.com/users/stefano-maggiolo","html_url":"https://github.com/stefano-maggiolo","followers_url":"https://api.github.com/users/stefano-maggiolo/followers","following_url":"https://api.github.com/users/stefano-maggiolo/following{/other_user}","gists_url":"https://api.github.com/users/stefano-maggiolo/gists{/gist_id}","starred_url":"https://api.github.com/users/stefano-maggiolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefano-maggiolo/subscriptions","organizations_url":"https://api.github.com/users/stefano-maggiolo/orgs","repos_url":"https://api.github.com/users/stefano-maggiolo/repos","events_url":"https://api.github.com/users/stefano-maggiolo/events{/privacy}","received_events_url":"https://api.github.com/users/stefano-maggiolo/received_events","type":"User","site_admin":false},"body":"Same here.","created_at":"2015-05-05T23:24:02Z","updated_at":"2015-05-05T23:24:02Z","html_url":"https://github.com/cms-dev/cms/pull/346#discussion_r29723759","pull_request_url":"https://api.github.com/repos/cms-dev/cms/pulls/346","_links":{"self":{"href":"https://api.github.com/repos/cms-dev/cms/pulls/comments/29723759"},"html":{"href":"https://github.com/cms-dev/cms/pull/346#discussion_r29723759"},"pull_request":{"href":"https://api.github.com/repos/cms-dev/cms/pulls/346"}}},"pull_request":{"url":"https://api.github.com/repos/cms-dev/cms/pulls/346","id":19802985,"html_url":"https://github.com/cms-dev/cms/pull/346","diff_url":"https://github.com/cms-dev/cms/pull/346.diff","patch_url":"https://github.com/cms-dev/cms/pull/346.patch","issue_url":"https://api.github.com/repos/cms-dev/cms/issues/346","number":346,"state":"open","locked":false,"title":"Decoupling users and contests, allow tasks to be unassigned to any contest","user":{"login":"wil93","id":1285361,"avatar_url":"https://avatars.githubusercontent.com/u/1285361?v=3","gravatar_id":"","url":"https://api.github.com/users/wil93","html_url":"https://github.com/wil93","followers_url":"https://api.github.com/users/wil93/followers","following_url":"https://api.github.com/users/wil93/following{/other_user}","gists_url":"https://api.github.com/users/wil93/gists{/gist_id}","starred_url":"https://api.github.com/users/wil93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wil93/subscriptions","organizations_url":"https://api.github.com/users/wil93/orgs","repos_url":"https://api.github.com/users/wil93/repos","events_url":"https://api.github.com/users/wil93/events{/privacy}","received_events_url":"https://api.github.com/users/wil93/received_events","type":"User","site_admin":false},"body":"I'm creating this PR to keep track of what it's needed to separate users from contests and to allow task to be unassigned to any contest. Once all this is merged onto master, task cloning support should be drafted.\r\n\r\nTo do list:\r\n- [x] Change loader interfaces in order to import users/tasks/contests separately.\r\n- [x] Do changes needed to separate users from contests (add UserContest).\r\n- [x] Revert changes done to separate tasks from contests (remove TaskContest).\r\n- [x] Do changes needed to allow tasks to be unassigned to any contest.\r\n- [x] Change the cmsAddUser script, making it use a UserLoader.\r\n- [x] Create a cmsAddTask script, which uses a TaskLoader.\r\n- [x] Create a cmsAddContest script, which uses a ContestLoader.\r\n- [x] Change the cmsAddUser script, allowing to import multiple users.\r\n- [x] Change AWS as needed to handle users/tasks *before* selecting a contest, that is:\r\n  - Make user creation and task creation contest-independent.\r\n  - Change the homepage (currently it forces to choose a contest or to create one), by allowing to access a list of all existing users (same for tasks).\r\n  - Allow to tie an existing user (or existing, but unassigned yet, task) to an existing contest.\r\n- [ ] Decide how to handle dump exporting/importing.\r\n  - Currently, a dump is a \"contest dump\". A possible solution is to redefine a dump as an entire \"database dump\".\r\n- [x] Fix the test suite.\r\n- [x] Update documentation.","created_at":"2014-08-14T17:45:50Z","updated_at":"2015-05-05T23:24:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"80ee07416ca98d59798374c83dd24b799189a435","assignee":{"login":"giomasce","id":101675,"avatar_url":"https://avatars.githubusercontent.com/u/101675?v=3","gravatar_id":"","url":"https://api.github.com/users/giomasce","html_url":"https://github.com/giomasce","followers_url":"https://api.github.com/users/giomasce/followers","following_url":"https://api.github.com/users/giomasce/following{/other_user}","gists_url":"https://api.github.com/users/giomasce/gists{/gist_id}","starred_url":"https://api.github.com/users/giomasce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giomasce/subscriptions","organizations_url":"https://api.github.com/users/giomasce/orgs","repos_url":"https://api.github.com/users/giomasce/repos","events_url":"https://api.github.com/users/giomasce/events{/privacy}","received_events_url":"https://api.github.com/users/giomasce/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/cms-dev/cms/pulls/346/commits","review_comments_url":"https://api.github.com/repos/cms-dev/cms/pulls/346/comments","review_comment_url":"https://api.github.com/repos/cms-dev/cms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cms-dev/cms/issues/346/comments","statuses_url":"https://api.github.com/repos/cms-dev/cms/statuses/4a770f21a96b8278747268e2e88901415a0ba3e0","head":{"label":"wil93:decouple_user_contest","ref":"decouple_user_contest","sha":"4a770f21a96b8278747268e2e88901415a0ba3e0","user":{"login":"wil93","id":1285361,"avatar_url":"https://avatars.githubusercontent.com/u/1285361?v=3","gravatar_id":"","url":"https://api.github.com/users/wil93","html_url":"https://github.com/wil93","followers_url":"https://api.github.com/users/wil93/followers","following_url":"https://api.github.com/users/wil93/following{/other_user}","gists_url":"https://api.github.com/users/wil93/gists{/gist_id}","starred_url":"https://api.github.com/users/wil93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wil93/subscriptions","organizations_url":"https://api.github.com/users/wil93/orgs","repos_url":"https://api.github.com/users/wil93/repos","events_url":"https://api.github.com/users/wil93/events{/privacy}","received_events_url":"https://api.github.com/users/wil93/received_events","type":"User","site_admin":false},"repo":{"id":9392345,"name":"cms","full_name":"wil93/cms","owner":{"login":"wil93","id":1285361,"avatar_url":"https://avatars.githubusercontent.com/u/1285361?v=3","gravatar_id":"","url":"https://api.github.com/users/wil93","html_url":"https://github.com/wil93","followers_url":"https://api.github.com/users/wil93/followers","following_url":"https://api.github.com/users/wil93/following{/other_user}","gists_url":"https://api.github.com/users/wil93/gists{/gist_id}","starred_url":"https://api.github.com/users/wil93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wil93/subscriptions","organizations_url":"https://api.github.com/users/wil93/orgs","repos_url":"https://api.github.com/users/wil93/repos","events_url":"https://api.github.com/users/wil93/events{/privacy}","received_events_url":"https://api.github.com/users/wil93/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wil93/cms","description":"Contest Management System","fork":true,"url":"https://api.github.com/repos/wil93/cms","forks_url":"https://api.github.com/repos/wil93/cms/forks","keys_url":"https://api.github.com/repos/wil93/cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wil93/cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wil93/cms/teams","hooks_url":"https://api.github.com/repos/wil93/cms/hooks","issue_events_url":"https://api.github.com/repos/wil93/cms/issues/events{/number}","events_url":"https://api.github.com/repos/wil93/cms/events","assignees_url":"https://api.github.com/repos/wil93/cms/assignees{/user}","branches_url":"https://api.github.com/repos/wil93/cms/branches{/branch}","tags_url":"https://api.github.com/repos/wil93/cms/tags","blobs_url":"https://api.github.com/repos/wil93/cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wil93/cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wil93/cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/wil93/cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wil93/cms/statuses/{sha}","languages_url":"https://api.github.com/repos/wil93/cms/languages","stargazers_url":"https://api.github.com/repos/wil93/cms/stargazers","contributors_url":"https://api.github.com/repos/wil93/cms/contributors","subscribers_url":"https://api.github.com/repos/wil93/cms/subscribers","subscription_url":"https://api.github.com/repos/wil93/cms/subscription","commits_url":"https://api.github.com/repos/wil93/cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/wil93/cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/wil93/cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/wil93/cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/wil93/cms/contents/{+path}","compare_url":"https://api.github.com/repos/wil93/cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wil93/cms/merges","archive_url":"https://api.github.com/repos/wil93/cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wil93/cms/downloads","issues_url":"https://api.github.com/repos/wil93/cms/issues{/number}","pulls_url":"https://api.github.com/repos/wil93/cms/pulls{/number}","milestones_url":"https://api.github.com/repos/wil93/cms/milestones{/number}","notifications_url":"https://api.github.com/repos/wil93/cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wil93/cms/labels{/name}","releases_url":"https://api.github.com/repos/wil93/cms/releases{/id}","created_at":"2013-04-12T10:56:24Z","updated_at":"2015-04-28T11:40:58Z","pushed_at":"2015-05-02T01:41:53Z","git_url":"git://github.com/wil93/cms.git","ssh_url":"git@github.com:wil93/cms.git","clone_url":"https://github.com/wil93/cms.git","svn_url":"https://github.com/wil93/cms","homepage":"","size":12469,"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":"cms-dev:master","ref":"master","sha":"5e8734a5c6db59800726aa6947aa68613283fd2d","user":{"login":"cms-dev","id":1671612,"avatar_url":"https://avatars.githubusercontent.com/u/1671612?v=3","gravatar_id":"","url":"https://api.github.com/users/cms-dev","html_url":"https://github.com/cms-dev","followers_url":"https://api.github.com/users/cms-dev/followers","following_url":"https://api.github.com/users/cms-dev/following{/other_user}","gists_url":"https://api.github.com/users/cms-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/cms-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cms-dev/subscriptions","organizations_url":"https://api.github.com/users/cms-dev/orgs","repos_url":"https://api.github.com/users/cms-dev/repos","events_url":"https://api.github.com/users/cms-dev/events{/privacy}","received_events_url":"https://api.github.com/users/cms-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":2504741,"name":"cms","full_name":"cms-dev/cms","owner":{"login":"cms-dev","id":1671612,"avatar_url":"https://avatars.githubusercontent.com/u/1671612?v=3","gravatar_id":"","url":"https://api.github.com/users/cms-dev","html_url":"https://github.com/cms-dev","followers_url":"https://api.github.com/users/cms-dev/followers","following_url":"https://api.github.com/users/cms-dev/following{/other_user}","gists_url":"https://api.github.com/users/cms-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/cms-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cms-dev/subscriptions","organizations_url":"https://api.github.com/users/cms-dev/orgs","repos_url":"https://api.github.com/users/cms-dev/repos","events_url":"https://api.github.com/users/cms-dev/events{/privacy}","received_events_url":"https://api.github.com/users/cms-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cms-dev/cms","description":"Contest Management System","fork":false,"url":"https://api.github.com/repos/cms-dev/cms","forks_url":"https://api.github.com/repos/cms-dev/cms/forks","keys_url":"https://api.github.com/repos/cms-dev/cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cms-dev/cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cms-dev/cms/teams","hooks_url":"https://api.github.com/repos/cms-dev/cms/hooks","issue_events_url":"https://api.github.com/repos/cms-dev/cms/issues/events{/number}","events_url":"https://api.github.com/repos/cms-dev/cms/events","assignees_url":"https://api.github.com/repos/cms-dev/cms/assignees{/user}","branches_url":"https://api.github.com/repos/cms-dev/cms/branches{/branch}","tags_url":"https://api.github.com/repos/cms-dev/cms/tags","blobs_url":"https://api.github.com/repos/cms-dev/cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cms-dev/cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cms-dev/cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/cms-dev/cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cms-dev/cms/statuses/{sha}","languages_url":"https://api.github.com/repos/cms-dev/cms/languages","stargazers_url":"https://api.github.com/repos/cms-dev/cms/stargazers","contributors_url":"https://api.github.com/repos/cms-dev/cms/contributors","subscribers_url":"https://api.github.com/repos/cms-dev/cms/subscribers","subscription_url":"https://api.github.com/repos/cms-dev/cms/subscription","commits_url":"https://api.github.com/repos/cms-dev/cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/cms-dev/cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/cms-dev/cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/cms-dev/cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/cms-dev/cms/contents/{+path}","compare_url":"https://api.github.com/repos/cms-dev/cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cms-dev/cms/merges","archive_url":"https://api.github.com/repos/cms-dev/cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cms-dev/cms/downloads","issues_url":"https://api.github.com/repos/cms-dev/cms/issues{/number}","pulls_url":"https://api.github.com/repos/cms-dev/cms/pulls{/number}","milestones_url":"https://api.github.com/repos/cms-dev/cms/milestones{/number}","notifications_url":"https://api.github.com/repos/cms-dev/cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cms-dev/cms/labels{/name}","releases_url":"https://api.github.com/repos/cms-dev/cms/releases{/id}","created_at":"2011-10-03T13:37:02Z","updated_at":"2015-04-29T23:52:20Z","pushed_at":"2015-04-30T20:58:19Z","git_url":"git://github.com/cms-dev/cms.git","ssh_url":"git@github.com:cms-dev/cms.git","clone_url":"https://github.com/cms-dev/cms.git","svn_url":"https://github.com/cms-dev/cms","homepage":"http://cms-dev.github.io/","size":17464,"stargazers_count":201,"watchers_count":201,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":107,"mirror_url":null,"open_issues_count":91,"forks":107,"open_issues":91,"watchers":201,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cms-dev/cms/pulls/346"},"html":{"href":"https://github.com/cms-dev/cms/pull/346"},"issue":{"href":"https://api.github.com/repos/cms-dev/cms/issues/346"},"comments":{"href":"https://api.github.com/repos/cms-dev/cms/issues/346/comments"},"review_comments":{"href":"https://api.github.com/repos/cms-dev/cms/pulls/346/comments"},"review_comment":{"href":"https://api.github.com/repos/cms-dev/cms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cms-dev/cms/pulls/346/commits"},"statuses":{"href":"https://api.github.com/repos/cms-dev/cms/statuses/4a770f21a96b8278747268e2e88901415a0ba3e0"}}}}