{"action":"created","comment":{"url":"https://api.github.com/repos/mitodl/micromasters/pulls/comments/91111274","pull_request_review_id":11621035,"id":91111274,"diff_hunk":"@@ -1,9 +1,16 @@\n \"\"\"\n util functions for profiles\n \"\"\"\n-import hashlib\n+from datetime import datetime\n+from os import path\n from urllib import parse\n \n+import hashlib\n+","path":"profiles/util.py","position":null,"original_position":10,"commit_id":"16c11ec0b2c9a1498fcfb91b2df2e0d87f210286","original_commit_id":"ac741cb7282b37570844d5137ae9fd51d46f4ab8","user":{"login":"rhysyngsun","id":28598,"avatar_url":"https://avatars.githubusercontent.com/u/28598?v=3","gravatar_id":"","url":"https://api.github.com/users/rhysyngsun","html_url":"https://github.com/rhysyngsun","followers_url":"https://api.github.com/users/rhysyngsun/followers","following_url":"https://api.github.com/users/rhysyngsun/following{/other_user}","gists_url":"https://api.github.com/users/rhysyngsun/gists{/gist_id}","starred_url":"https://api.github.com/users/rhysyngsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhysyngsun/subscriptions","organizations_url":"https://api.github.com/users/rhysyngsun/orgs","repos_url":"https://api.github.com/users/rhysyngsun/repos","events_url":"https://api.github.com/users/rhysyngsun/events{/privacy}","received_events_url":"https://api.github.com/users/rhysyngsun/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2016-12-06T16:13:02Z","updated_at":"2016-12-06T16:13:02Z","html_url":"https://github.com/mitodl/micromasters/pull/1991#discussion_r91111274","pull_request_url":"https://api.github.com/repos/mitodl/micromasters/pulls/1991","_links":{"self":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/comments/91111274"},"html":{"href":"https://github.com/mitodl/micromasters/pull/1991#discussion_r91111274"},"pull_request":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/1991"}}},"pull_request":{"url":"https://api.github.com/repos/mitodl/micromasters/pulls/1991","id":96732273,"html_url":"https://github.com/mitodl/micromasters/pull/1991","diff_url":"https://github.com/mitodl/micromasters/pull/1991.diff","patch_url":"https://github.com/mitodl/micromasters/pull/1991.patch","issue_url":"https://api.github.com/repos/mitodl/micromasters/issues/1991","number":1991,"state":"open","locked":false,"title":"Nl/1978 truncate profile image filenames","user":{"login":"rhysyngsun","id":28598,"avatar_url":"https://avatars.githubusercontent.com/u/28598?v=3","gravatar_id":"","url":"https://api.github.com/users/rhysyngsun","html_url":"https://github.com/rhysyngsun","followers_url":"https://api.github.com/users/rhysyngsun/followers","following_url":"https://api.github.com/users/rhysyngsun/following{/other_user}","gists_url":"https://api.github.com/users/rhysyngsun/gists{/gist_id}","starred_url":"https://api.github.com/users/rhysyngsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhysyngsun/subscriptions","organizations_url":"https://api.github.com/users/rhysyngsun/orgs","repos_url":"https://api.github.com/users/rhysyngsun/repos","events_url":"https://api.github.com/users/rhysyngsun/events{/privacy}","received_events_url":"https://api.github.com/users/rhysyngsun/received_events","type":"User","site_admin":false},"body":"#### What are the relevant tickets?\r\n\r\nFixes #1978 \r\n\r\n#### What's this PR do?\r\n\r\nThis PR truncates the original filename that we use so the entire S3 object URI will fit in the 100 chars we have for that field. It does so by changing the `upload_to` property of the `Profile.image` field to a `callable` that generates a shortened URI.\r\n\r\n#### Where should the reviewer start?\r\n\r\nprofiles/util.py and profiles/models.py\r\n\r\n#### How should this be manually tested?\r\n\r\nUpload a profile image that has a filename > 100 characters (I'd probably give it 150 or so).\r\n\r\n#### Any background context you want to provide?\r\n\r\nApparently changes to `ImageField.upload_to` constitute a schema change as far as django is concerned, hence the migration in this PR. If anyone has a better approach or know how to not trigger this behavior I'd appreciate it.\r\n","created_at":"2016-12-06T14:20:37Z","updated_at":"2016-12-06T16:13:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86f557fc83d0be8732faedf87b9e7a8b4e6c8888","assignee":{"login":"gsidebo","id":14932219,"avatar_url":"https://avatars.githubusercontent.com/u/14932219?v=3","gravatar_id":"","url":"https://api.github.com/users/gsidebo","html_url":"https://github.com/gsidebo","followers_url":"https://api.github.com/users/gsidebo/followers","following_url":"https://api.github.com/users/gsidebo/following{/other_user}","gists_url":"https://api.github.com/users/gsidebo/gists{/gist_id}","starred_url":"https://api.github.com/users/gsidebo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsidebo/subscriptions","organizations_url":"https://api.github.com/users/gsidebo/orgs","repos_url":"https://api.github.com/users/gsidebo/repos","events_url":"https://api.github.com/users/gsidebo/events{/privacy}","received_events_url":"https://api.github.com/users/gsidebo/received_events","type":"User","site_admin":false},"assignees":[{"login":"gsidebo","id":14932219,"avatar_url":"https://avatars.githubusercontent.com/u/14932219?v=3","gravatar_id":"","url":"https://api.github.com/users/gsidebo","html_url":"https://github.com/gsidebo","followers_url":"https://api.github.com/users/gsidebo/followers","following_url":"https://api.github.com/users/gsidebo/following{/other_user}","gists_url":"https://api.github.com/users/gsidebo/gists{/gist_id}","starred_url":"https://api.github.com/users/gsidebo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsidebo/subscriptions","organizations_url":"https://api.github.com/users/gsidebo/orgs","repos_url":"https://api.github.com/users/gsidebo/repos","events_url":"https://api.github.com/users/gsidebo/events{/privacy}","received_events_url":"https://api.github.com/users/gsidebo/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mitodl/micromasters/pulls/1991/commits","review_comments_url":"https://api.github.com/repos/mitodl/micromasters/pulls/1991/comments","review_comment_url":"https://api.github.com/repos/mitodl/micromasters/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mitodl/micromasters/issues/1991/comments","statuses_url":"https://api.github.com/repos/mitodl/micromasters/statuses/16c11ec0b2c9a1498fcfb91b2df2e0d87f210286","head":{"label":"mitodl:nl/1978-truncate-profile-image-filenames","ref":"nl/1978-truncate-profile-image-filenames","sha":"16c11ec0b2c9a1498fcfb91b2df2e0d87f210286","user":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars.githubusercontent.com/u/7918516?v=3","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"repo":{"id":52919185,"name":"micromasters","full_name":"mitodl/micromasters","owner":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars.githubusercontent.com/u/7918516?v=3","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitodl/micromasters","description":"Portal for learners and course teams to access MITx micromasters programs: https://goo.gl/tsUTSO","fork":false,"url":"https://api.github.com/repos/mitodl/micromasters","forks_url":"https://api.github.com/repos/mitodl/micromasters/forks","keys_url":"https://api.github.com/repos/mitodl/micromasters/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitodl/micromasters/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitodl/micromasters/teams","hooks_url":"https://api.github.com/repos/mitodl/micromasters/hooks","issue_events_url":"https://api.github.com/repos/mitodl/micromasters/issues/events{/number}","events_url":"https://api.github.com/repos/mitodl/micromasters/events","assignees_url":"https://api.github.com/repos/mitodl/micromasters/assignees{/user}","branches_url":"https://api.github.com/repos/mitodl/micromasters/branches{/branch}","tags_url":"https://api.github.com/repos/mitodl/micromasters/tags","blobs_url":"https://api.github.com/repos/mitodl/micromasters/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitodl/micromasters/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitodl/micromasters/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitodl/micromasters/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitodl/micromasters/statuses/{sha}","languages_url":"https://api.github.com/repos/mitodl/micromasters/languages","stargazers_url":"https://api.github.com/repos/mitodl/micromasters/stargazers","contributors_url":"https://api.github.com/repos/mitodl/micromasters/contributors","subscribers_url":"https://api.github.com/repos/mitodl/micromasters/subscribers","subscription_url":"https://api.github.com/repos/mitodl/micromasters/subscription","commits_url":"https://api.github.com/repos/mitodl/micromasters/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitodl/micromasters/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitodl/micromasters/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitodl/micromasters/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitodl/micromasters/contents/{+path}","compare_url":"https://api.github.com/repos/mitodl/micromasters/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitodl/micromasters/merges","archive_url":"https://api.github.com/repos/mitodl/micromasters/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitodl/micromasters/downloads","issues_url":"https://api.github.com/repos/mitodl/micromasters/issues{/number}","pulls_url":"https://api.github.com/repos/mitodl/micromasters/pulls{/number}","milestones_url":"https://api.github.com/repos/mitodl/micromasters/milestones{/number}","notifications_url":"https://api.github.com/repos/mitodl/micromasters/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitodl/micromasters/labels{/name}","releases_url":"https://api.github.com/repos/mitodl/micromasters/releases{/id}","deployments_url":"https://api.github.com/repos/mitodl/micromasters/deployments","created_at":"2016-03-01T23:53:17Z","updated_at":"2016-12-03T13:16:59Z","pushed_at":"2016-12-06T16:12:50Z","git_url":"git://github.com/mitodl/micromasters.git","ssh_url":"git@github.com:mitodl/micromasters.git","clone_url":"https://github.com/mitodl/micromasters.git","svn_url":"https://github.com/mitodl/micromasters","homepage":"","size":29161,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":219,"forks":3,"open_issues":219,"watchers":4,"default_branch":"master"}},"base":{"label":"mitodl:master","ref":"master","sha":"49a69a06f54bbac2a2a692c6a67715f2475b4eb2","user":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars.githubusercontent.com/u/7918516?v=3","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"repo":{"id":52919185,"name":"micromasters","full_name":"mitodl/micromasters","owner":{"login":"mitodl","id":7918516,"avatar_url":"https://avatars.githubusercontent.com/u/7918516?v=3","gravatar_id":"","url":"https://api.github.com/users/mitodl","html_url":"https://github.com/mitodl","followers_url":"https://api.github.com/users/mitodl/followers","following_url":"https://api.github.com/users/mitodl/following{/other_user}","gists_url":"https://api.github.com/users/mitodl/gists{/gist_id}","starred_url":"https://api.github.com/users/mitodl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitodl/subscriptions","organizations_url":"https://api.github.com/users/mitodl/orgs","repos_url":"https://api.github.com/users/mitodl/repos","events_url":"https://api.github.com/users/mitodl/events{/privacy}","received_events_url":"https://api.github.com/users/mitodl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitodl/micromasters","description":"Portal for learners and course teams to access MITx micromasters programs: https://goo.gl/tsUTSO","fork":false,"url":"https://api.github.com/repos/mitodl/micromasters","forks_url":"https://api.github.com/repos/mitodl/micromasters/forks","keys_url":"https://api.github.com/repos/mitodl/micromasters/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitodl/micromasters/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitodl/micromasters/teams","hooks_url":"https://api.github.com/repos/mitodl/micromasters/hooks","issue_events_url":"https://api.github.com/repos/mitodl/micromasters/issues/events{/number}","events_url":"https://api.github.com/repos/mitodl/micromasters/events","assignees_url":"https://api.github.com/repos/mitodl/micromasters/assignees{/user}","branches_url":"https://api.github.com/repos/mitodl/micromasters/branches{/branch}","tags_url":"https://api.github.com/repos/mitodl/micromasters/tags","blobs_url":"https://api.github.com/repos/mitodl/micromasters/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitodl/micromasters/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitodl/micromasters/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitodl/micromasters/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitodl/micromasters/statuses/{sha}","languages_url":"https://api.github.com/repos/mitodl/micromasters/languages","stargazers_url":"https://api.github.com/repos/mitodl/micromasters/stargazers","contributors_url":"https://api.github.com/repos/mitodl/micromasters/contributors","subscribers_url":"https://api.github.com/repos/mitodl/micromasters/subscribers","subscription_url":"https://api.github.com/repos/mitodl/micromasters/subscription","commits_url":"https://api.github.com/repos/mitodl/micromasters/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitodl/micromasters/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitodl/micromasters/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitodl/micromasters/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitodl/micromasters/contents/{+path}","compare_url":"https://api.github.com/repos/mitodl/micromasters/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitodl/micromasters/merges","archive_url":"https://api.github.com/repos/mitodl/micromasters/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitodl/micromasters/downloads","issues_url":"https://api.github.com/repos/mitodl/micromasters/issues{/number}","pulls_url":"https://api.github.com/repos/mitodl/micromasters/pulls{/number}","milestones_url":"https://api.github.com/repos/mitodl/micromasters/milestones{/number}","notifications_url":"https://api.github.com/repos/mitodl/micromasters/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitodl/micromasters/labels{/name}","releases_url":"https://api.github.com/repos/mitodl/micromasters/releases{/id}","deployments_url":"https://api.github.com/repos/mitodl/micromasters/deployments","created_at":"2016-03-01T23:53:17Z","updated_at":"2016-12-03T13:16:59Z","pushed_at":"2016-12-06T16:12:50Z","git_url":"git://github.com/mitodl/micromasters.git","ssh_url":"git@github.com:mitodl/micromasters.git","clone_url":"https://github.com/mitodl/micromasters.git","svn_url":"https://github.com/mitodl/micromasters","homepage":"","size":29161,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":219,"forks":3,"open_issues":219,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/1991"},"html":{"href":"https://github.com/mitodl/micromasters/pull/1991"},"issue":{"href":"https://api.github.com/repos/mitodl/micromasters/issues/1991"},"comments":{"href":"https://api.github.com/repos/mitodl/micromasters/issues/1991/comments"},"review_comments":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/1991/comments"},"review_comment":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mitodl/micromasters/pulls/1991/commits"},"statuses":{"href":"https://api.github.com/repos/mitodl/micromasters/statuses/16c11ec0b2c9a1498fcfb91b2df2e0d87f210286"}}}}
{"actor":{"display_login":"rhysyngsun"}}