{"action":"created","comment":{"url":"https://api.github.com/repos/shoopio/shoop/pulls/comments/39145395","id":39145395,"diff_hunk":"@@ -186,7 +186,15 @@ def __init__(self, **kwargs):\n             self.fields[\"shops\"].initial = [default_shop]\n \n         self.file_url = self.instance.url\n-        self.thumbnail = None\n+\n+        if self.instance and self.instance.file:\n+            try:\n+                thumbnail = self.instance.get_thumbnail()\n+                self.thumbnail = thumbnail.url\n+            except Exception:\n+                self.thumbnail = None  # no thumbnail available for whatever reason\n+        else:\n+            self.thumbnail = None","path":"shoop/admin/modules/products/views/forms.py","position":31,"original_position":31,"commit_id":"c0174e87db784a088d351b2a7a5fc3affcc4de9a","original_commit_id":"c0174e87db784a088d351b2a7a5fc3affcc4de9a","user":{"login":"Pikkupomo","id":2863405,"avatar_url":"https://avatars.githubusercontent.com/u/2863405?v=3","gravatar_id":"","url":"https://api.github.com/users/Pikkupomo","html_url":"https://github.com/Pikkupomo","followers_url":"https://api.github.com/users/Pikkupomo/followers","following_url":"https://api.github.com/users/Pikkupomo/following{/other_user}","gists_url":"https://api.github.com/users/Pikkupomo/gists{/gist_id}","starred_url":"https://api.github.com/users/Pikkupomo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pikkupomo/subscriptions","organizations_url":"https://api.github.com/users/Pikkupomo/orgs","repos_url":"https://api.github.com/users/Pikkupomo/repos","events_url":"https://api.github.com/users/Pikkupomo/events{/privacy}","received_events_url":"https://api.github.com/users/Pikkupomo/received_events","type":"User","site_admin":false},"body":"1. Originally this was my intention, somehow @akx turned my head to make this kind of solution. It's probably not what @akx was after, but he said `ProductMedia.get_thumbnail` should raise when errors occur, now it does. \r\n2. Agree catch is too broad, and I need to find out what are the exact Exceptions. It has been catched this way in prior implementations inside Shoop.\r\n3. `file_url` is the url to original file, thumbnail url is for the thumbnail, if that was something you were after here, not sure I completely understand :)","created_at":"2015-09-10T10:30:41Z","updated_at":"2015-09-10T10:30:41Z","html_url":"https://github.com/shoopio/shoop/pull/93#discussion_r39145395","pull_request_url":"https://api.github.com/repos/shoopio/shoop/pulls/93","_links":{"self":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/comments/39145395"},"html":{"href":"https://github.com/shoopio/shoop/pull/93#discussion_r39145395"},"pull_request":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/93"}}},"pull_request":{"url":"https://api.github.com/repos/shoopio/shoop/pulls/93","id":44522772,"html_url":"https://github.com/shoopio/shoop/pull/93","diff_url":"https://github.com/shoopio/shoop/pull/93.diff","patch_url":"https://github.com/shoopio/shoop/pull/93.patch","issue_url":"https://api.github.com/repos/shoopio/shoop/issues/93","number":93,"state":"open","locked":false,"title":"Add `Product Media` tab to product editing","user":{"login":"Pikkupomo","id":2863405,"avatar_url":"https://avatars.githubusercontent.com/u/2863405?v=3","gravatar_id":"","url":"https://api.github.com/users/Pikkupomo","html_url":"https://github.com/Pikkupomo","followers_url":"https://api.github.com/users/Pikkupomo/followers","following_url":"https://api.github.com/users/Pikkupomo/following{/other_user}","gists_url":"https://api.github.com/users/Pikkupomo/gists{/gist_id}","starred_url":"https://api.github.com/users/Pikkupomo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pikkupomo/subscriptions","organizations_url":"https://api.github.com/users/Pikkupomo/orgs","repos_url":"https://api.github.com/users/Pikkupomo/repos","events_url":"https://api.github.com/users/Pikkupomo/events{/privacy}","received_events_url":"https://api.github.com/users/Pikkupomo/received_events","type":"User","site_admin":false},"body":"Check commits for more information.\r\n\r\nRefs SHOOP-1045","created_at":"2015-09-09T08:31:43Z","updated_at":"2015-09-10T10:30:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4bcaa2e1f91ded102efd01d96573457ea6329bd7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shoopio/shoop/pulls/93/commits","review_comments_url":"https://api.github.com/repos/shoopio/shoop/pulls/93/comments","review_comment_url":"https://api.github.com/repos/shoopio/shoop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shoopio/shoop/issues/93/comments","statuses_url":"https://api.github.com/repos/shoopio/shoop/statuses/c0174e87db784a088d351b2a7a5fc3affcc4de9a","head":{"label":"Pikkupomo:media-browser-tuning","ref":"media-browser-tuning","sha":"c0174e87db784a088d351b2a7a5fc3affcc4de9a","user":{"login":"Pikkupomo","id":2863405,"avatar_url":"https://avatars.githubusercontent.com/u/2863405?v=3","gravatar_id":"","url":"https://api.github.com/users/Pikkupomo","html_url":"https://github.com/Pikkupomo","followers_url":"https://api.github.com/users/Pikkupomo/followers","following_url":"https://api.github.com/users/Pikkupomo/following{/other_user}","gists_url":"https://api.github.com/users/Pikkupomo/gists{/gist_id}","starred_url":"https://api.github.com/users/Pikkupomo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pikkupomo/subscriptions","organizations_url":"https://api.github.com/users/Pikkupomo/orgs","repos_url":"https://api.github.com/users/Pikkupomo/repos","events_url":"https://api.github.com/users/Pikkupomo/events{/privacy}","received_events_url":"https://api.github.com/users/Pikkupomo/received_events","type":"User","site_admin":false},"repo":{"id":37525161,"name":"shoop","full_name":"Pikkupomo/shoop","owner":{"login":"Pikkupomo","id":2863405,"avatar_url":"https://avatars.githubusercontent.com/u/2863405?v=3","gravatar_id":"","url":"https://api.github.com/users/Pikkupomo","html_url":"https://github.com/Pikkupomo","followers_url":"https://api.github.com/users/Pikkupomo/followers","following_url":"https://api.github.com/users/Pikkupomo/following{/other_user}","gists_url":"https://api.github.com/users/Pikkupomo/gists{/gist_id}","starred_url":"https://api.github.com/users/Pikkupomo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pikkupomo/subscriptions","organizations_url":"https://api.github.com/users/Pikkupomo/orgs","repos_url":"https://api.github.com/users/Pikkupomo/repos","events_url":"https://api.github.com/users/Pikkupomo/events{/privacy}","received_events_url":"https://api.github.com/users/Pikkupomo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Pikkupomo/shoop","description":"","fork":true,"url":"https://api.github.com/repos/Pikkupomo/shoop","forks_url":"https://api.github.com/repos/Pikkupomo/shoop/forks","keys_url":"https://api.github.com/repos/Pikkupomo/shoop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Pikkupomo/shoop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Pikkupomo/shoop/teams","hooks_url":"https://api.github.com/repos/Pikkupomo/shoop/hooks","issue_events_url":"https://api.github.com/repos/Pikkupomo/shoop/issues/events{/number}","events_url":"https://api.github.com/repos/Pikkupomo/shoop/events","assignees_url":"https://api.github.com/repos/Pikkupomo/shoop/assignees{/user}","branches_url":"https://api.github.com/repos/Pikkupomo/shoop/branches{/branch}","tags_url":"https://api.github.com/repos/Pikkupomo/shoop/tags","blobs_url":"https://api.github.com/repos/Pikkupomo/shoop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Pikkupomo/shoop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Pikkupomo/shoop/git/refs{/sha}","trees_url":"https://api.github.com/repos/Pikkupomo/shoop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Pikkupomo/shoop/statuses/{sha}","languages_url":"https://api.github.com/repos/Pikkupomo/shoop/languages","stargazers_url":"https://api.github.com/repos/Pikkupomo/shoop/stargazers","contributors_url":"https://api.github.com/repos/Pikkupomo/shoop/contributors","subscribers_url":"https://api.github.com/repos/Pikkupomo/shoop/subscribers","subscription_url":"https://api.github.com/repos/Pikkupomo/shoop/subscription","commits_url":"https://api.github.com/repos/Pikkupomo/shoop/commits{/sha}","git_commits_url":"https://api.github.com/repos/Pikkupomo/shoop/git/commits{/sha}","comments_url":"https://api.github.com/repos/Pikkupomo/shoop/comments{/number}","issue_comment_url":"https://api.github.com/repos/Pikkupomo/shoop/issues/comments{/number}","contents_url":"https://api.github.com/repos/Pikkupomo/shoop/contents/{+path}","compare_url":"https://api.github.com/repos/Pikkupomo/shoop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Pikkupomo/shoop/merges","archive_url":"https://api.github.com/repos/Pikkupomo/shoop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Pikkupomo/shoop/downloads","issues_url":"https://api.github.com/repos/Pikkupomo/shoop/issues{/number}","pulls_url":"https://api.github.com/repos/Pikkupomo/shoop/pulls{/number}","milestones_url":"https://api.github.com/repos/Pikkupomo/shoop/milestones{/number}","notifications_url":"https://api.github.com/repos/Pikkupomo/shoop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Pikkupomo/shoop/labels{/name}","releases_url":"https://api.github.com/repos/Pikkupomo/shoop/releases{/id}","created_at":"2015-06-16T11:06:34Z","updated_at":"2015-06-16T11:06:35Z","pushed_at":"2015-09-10T09:00:46Z","git_url":"git://github.com/Pikkupomo/shoop.git","ssh_url":"git@github.com:Pikkupomo/shoop.git","clone_url":"https://github.com/Pikkupomo/shoop.git","svn_url":"https://github.com/Pikkupomo/shoop","homepage":null,"size":3380,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"shoopio:master","ref":"master","sha":"f427f6a0f6323ae62e782378f5194ac856df79d9","user":{"login":"shoopio","id":12714852,"avatar_url":"https://avatars.githubusercontent.com/u/12714852?v=3","gravatar_id":"","url":"https://api.github.com/users/shoopio","html_url":"https://github.com/shoopio","followers_url":"https://api.github.com/users/shoopio/followers","following_url":"https://api.github.com/users/shoopio/following{/other_user}","gists_url":"https://api.github.com/users/shoopio/gists{/gist_id}","starred_url":"https://api.github.com/users/shoopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoopio/subscriptions","organizations_url":"https://api.github.com/users/shoopio/orgs","repos_url":"https://api.github.com/users/shoopio/repos","events_url":"https://api.github.com/users/shoopio/events{/privacy}","received_events_url":"https://api.github.com/users/shoopio/received_events","type":"Organization","site_admin":false},"repo":{"id":36803364,"name":"shoop","full_name":"shoopio/shoop","owner":{"login":"shoopio","id":12714852,"avatar_url":"https://avatars.githubusercontent.com/u/12714852?v=3","gravatar_id":"","url":"https://api.github.com/users/shoopio","html_url":"https://github.com/shoopio","followers_url":"https://api.github.com/users/shoopio/followers","following_url":"https://api.github.com/users/shoopio/following{/other_user}","gists_url":"https://api.github.com/users/shoopio/gists{/gist_id}","starred_url":"https://api.github.com/users/shoopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoopio/subscriptions","organizations_url":"https://api.github.com/users/shoopio/orgs","repos_url":"https://api.github.com/users/shoopio/repos","events_url":"https://api.github.com/users/shoopio/events{/privacy}","received_events_url":"https://api.github.com/users/shoopio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shoopio/shoop","description":"E-Commerce Platform","fork":false,"url":"https://api.github.com/repos/shoopio/shoop","forks_url":"https://api.github.com/repos/shoopio/shoop/forks","keys_url":"https://api.github.com/repos/shoopio/shoop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shoopio/shoop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shoopio/shoop/teams","hooks_url":"https://api.github.com/repos/shoopio/shoop/hooks","issue_events_url":"https://api.github.com/repos/shoopio/shoop/issues/events{/number}","events_url":"https://api.github.com/repos/shoopio/shoop/events","assignees_url":"https://api.github.com/repos/shoopio/shoop/assignees{/user}","branches_url":"https://api.github.com/repos/shoopio/shoop/branches{/branch}","tags_url":"https://api.github.com/repos/shoopio/shoop/tags","blobs_url":"https://api.github.com/repos/shoopio/shoop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shoopio/shoop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shoopio/shoop/git/refs{/sha}","trees_url":"https://api.github.com/repos/shoopio/shoop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shoopio/shoop/statuses/{sha}","languages_url":"https://api.github.com/repos/shoopio/shoop/languages","stargazers_url":"https://api.github.com/repos/shoopio/shoop/stargazers","contributors_url":"https://api.github.com/repos/shoopio/shoop/contributors","subscribers_url":"https://api.github.com/repos/shoopio/shoop/subscribers","subscription_url":"https://api.github.com/repos/shoopio/shoop/subscription","commits_url":"https://api.github.com/repos/shoopio/shoop/commits{/sha}","git_commits_url":"https://api.github.com/repos/shoopio/shoop/git/commits{/sha}","comments_url":"https://api.github.com/repos/shoopio/shoop/comments{/number}","issue_comment_url":"https://api.github.com/repos/shoopio/shoop/issues/comments{/number}","contents_url":"https://api.github.com/repos/shoopio/shoop/contents/{+path}","compare_url":"https://api.github.com/repos/shoopio/shoop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shoopio/shoop/merges","archive_url":"https://api.github.com/repos/shoopio/shoop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shoopio/shoop/downloads","issues_url":"https://api.github.com/repos/shoopio/shoop/issues{/number}","pulls_url":"https://api.github.com/repos/shoopio/shoop/pulls{/number}","milestones_url":"https://api.github.com/repos/shoopio/shoop/milestones{/number}","notifications_url":"https://api.github.com/repos/shoopio/shoop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shoopio/shoop/labels{/name}","releases_url":"https://api.github.com/repos/shoopio/shoop/releases{/id}","created_at":"2015-06-03T12:53:21Z","updated_at":"2015-09-09T14:54:19Z","pushed_at":"2015-09-10T10:09:59Z","git_url":"git://github.com/shoopio/shoop.git","ssh_url":"git@github.com:shoopio/shoop.git","clone_url":"https://github.com/shoopio/shoop.git","svn_url":"https://github.com/shoopio/shoop","homepage":"https://shoop.io","size":3954,"stargazers_count":150,"watchers_count":150,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":10,"forks":33,"open_issues":10,"watchers":150,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/93"},"html":{"href":"https://github.com/shoopio/shoop/pull/93"},"issue":{"href":"https://api.github.com/repos/shoopio/shoop/issues/93"},"comments":{"href":"https://api.github.com/repos/shoopio/shoop/issues/93/comments"},"review_comments":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/93/comments"},"review_comment":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/93/commits"},"statuses":{"href":"https://api.github.com/repos/shoopio/shoop/statuses/c0174e87db784a088d351b2a7a5fc3affcc4de9a"}}}}