{"action":"created","comment":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/67627320","id":67627320,"diff_hunk":"@@ -27,6 +27,22 @@ def __init__(self, spider):\n     def __init__(self, download_func=None):\n         self.download_func = download_func\n \n+\n+    def _key_for_pipe(self, key, base_class_name):\n+        \"\"\"\n+        Allow setting settings for user defined MediaPipelines that inherit from base.\n+\n+        User can define setting key:\n+\n+        MYPIPELINENAME_IMAGE_SETTING_NAME = <some value>\n+\n+        and it will override default settings and class attributes.\n+        \"\"\"\n+        class_name = self.__class__.__name__\n+        if class_name == base_class_name:\n+            return key\n+        return \"{}_{}\".format(class_name.upper(), key)\n+\n     @classmethod","path":"scrapy/pipelines/media.py","position":20,"original_position":20,"commit_id":"10b79c9b3ec438653b25d531c30888849e080aa5","original_commit_id":"10b79c9b3ec438653b25d531c30888849e080aa5","user":{"login":"djunzu","id":8784122,"avatar_url":"https://avatars.githubusercontent.com/u/8784122?v=3","gravatar_id":"","url":"https://api.github.com/users/djunzu","html_url":"https://github.com/djunzu","followers_url":"https://api.github.com/users/djunzu/followers","following_url":"https://api.github.com/users/djunzu/following{/other_user}","gists_url":"https://api.github.com/users/djunzu/gists{/gist_id}","starred_url":"https://api.github.com/users/djunzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djunzu/subscriptions","organizations_url":"https://api.github.com/users/djunzu/orgs","repos_url":"https://api.github.com/users/djunzu/repos","events_url":"https://api.github.com/users/djunzu/events{/privacy}","received_events_url":"https://api.github.com/users/djunzu/received_events","type":"User","site_admin":false},"body":"I am not sure if `_key_for_pipe()` belongs to `MediaPipeline`. It is used only in `Files` and `ImagesPipelines`. Since `ImagesPipeline` inherits from `FilesPipeline`, maybe `FilesPipeline` would be a better place to put this function.\r\nBut placing it here allows it to be used in other classes inheriting from `MediaPipeline`...\r\nNot sure about the best option.","created_at":"2016-06-20T01:00:31Z","updated_at":"2016-06-20T01:00:31Z","html_url":"https://github.com/scrapy/scrapy/pull/1989#discussion_r67627320","pull_request_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1989","_links":{"self":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/67627320"},"html":{"href":"https://github.com/scrapy/scrapy/pull/1989#discussion_r67627320"},"pull_request":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1989"}}},"pull_request":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/1989","id":69976384,"html_url":"https://github.com/scrapy/scrapy/pull/1989","diff_url":"https://github.com/scrapy/scrapy/pull/1989.diff","patch_url":"https://github.com/scrapy/scrapy/pull/1989.patch","issue_url":"https://api.github.com/repos/scrapy/scrapy/issues/1989","number":1989,"state":"open","locked":false,"title":"[image_pipeline] bring back uppercase class attributes","user":{"login":"pawelmhm","id":2700942,"avatar_url":"https://avatars.githubusercontent.com/u/2700942?v=3","gravatar_id":"","url":"https://api.github.com/users/pawelmhm","html_url":"https://github.com/pawelmhm","followers_url":"https://api.github.com/users/pawelmhm/followers","following_url":"https://api.github.com/users/pawelmhm/following{/other_user}","gists_url":"https://api.github.com/users/pawelmhm/gists{/gist_id}","starred_url":"https://api.github.com/users/pawelmhm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawelmhm/subscriptions","organizations_url":"https://api.github.com/users/pawelmhm/orgs","repos_url":"https://api.github.com/users/pawelmhm/repos","events_url":"https://api.github.com/users/pawelmhm/events{/privacy}","received_events_url":"https://api.github.com/users/pawelmhm/received_events","type":"User","site_admin":false},"body":"This assumes that users may want to have multiple pipeline classes inheriting from Image pipeline. They want to have option to set settings per pipeline instances as in #1891 & https://github.com/scrapy/scrapy/issues/1850 but also per multiple pipeline classes (so having project wide settings key doesn't work for them).\r\n\r\nIt does not deprecate class attributes in favor of settings but uses class attributes as default values for settings. If there is nothing in user settings, pipeline will use uppercase attribute.\r\n\r\nAside from more flexibility this also gives full backward compatibility with whatever users were doing with uppercase attributes in their pipelines subclassing ImagePipeline. \r\n\r\nFixes: #1985, for alternative approach and more motivation see https://github.com/scrapy/scrapy/pull/1986","created_at":"2016-05-13T10:43:11Z","updated_at":"2016-06-20T01:00:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"101c68633825132d10daad73c38fdd1c378aabd6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1989/commits","review_comments_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1989/comments","review_comment_url":"https://api.github.com/repos/scrapy/scrapy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scrapy/scrapy/issues/1989/comments","statuses_url":"https://api.github.com/repos/scrapy/scrapy/statuses/10b79c9b3ec438653b25d531c30888849e080aa5","head":{"label":"pawelmhm:fix-images-pipeline-uppercase-other","ref":"fix-images-pipeline-uppercase-other","sha":"10b79c9b3ec438653b25d531c30888849e080aa5","user":{"login":"pawelmhm","id":2700942,"avatar_url":"https://avatars.githubusercontent.com/u/2700942?v=3","gravatar_id":"","url":"https://api.github.com/users/pawelmhm","html_url":"https://github.com/pawelmhm","followers_url":"https://api.github.com/users/pawelmhm/followers","following_url":"https://api.github.com/users/pawelmhm/following{/other_user}","gists_url":"https://api.github.com/users/pawelmhm/gists{/gist_id}","starred_url":"https://api.github.com/users/pawelmhm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawelmhm/subscriptions","organizations_url":"https://api.github.com/users/pawelmhm/orgs","repos_url":"https://api.github.com/users/pawelmhm/repos","events_url":"https://api.github.com/users/pawelmhm/events{/privacy}","received_events_url":"https://api.github.com/users/pawelmhm/received_events","type":"User","site_admin":false},"repo":{"id":28973792,"name":"scrapy","full_name":"pawelmhm/scrapy","owner":{"login":"pawelmhm","id":2700942,"avatar_url":"https://avatars.githubusercontent.com/u/2700942?v=3","gravatar_id":"","url":"https://api.github.com/users/pawelmhm","html_url":"https://github.com/pawelmhm","followers_url":"https://api.github.com/users/pawelmhm/followers","following_url":"https://api.github.com/users/pawelmhm/following{/other_user}","gists_url":"https://api.github.com/users/pawelmhm/gists{/gist_id}","starred_url":"https://api.github.com/users/pawelmhm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawelmhm/subscriptions","organizations_url":"https://api.github.com/users/pawelmhm/orgs","repos_url":"https://api.github.com/users/pawelmhm/repos","events_url":"https://api.github.com/users/pawelmhm/events{/privacy}","received_events_url":"https://api.github.com/users/pawelmhm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pawelmhm/scrapy","description":"Scrapy, a fast high-level screen scraping and web crawling framework for Python.","fork":true,"url":"https://api.github.com/repos/pawelmhm/scrapy","forks_url":"https://api.github.com/repos/pawelmhm/scrapy/forks","keys_url":"https://api.github.com/repos/pawelmhm/scrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pawelmhm/scrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pawelmhm/scrapy/teams","hooks_url":"https://api.github.com/repos/pawelmhm/scrapy/hooks","issue_events_url":"https://api.github.com/repos/pawelmhm/scrapy/issues/events{/number}","events_url":"https://api.github.com/repos/pawelmhm/scrapy/events","assignees_url":"https://api.github.com/repos/pawelmhm/scrapy/assignees{/user}","branches_url":"https://api.github.com/repos/pawelmhm/scrapy/branches{/branch}","tags_url":"https://api.github.com/repos/pawelmhm/scrapy/tags","blobs_url":"https://api.github.com/repos/pawelmhm/scrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pawelmhm/scrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pawelmhm/scrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/pawelmhm/scrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pawelmhm/scrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/pawelmhm/scrapy/languages","stargazers_url":"https://api.github.com/repos/pawelmhm/scrapy/stargazers","contributors_url":"https://api.github.com/repos/pawelmhm/scrapy/contributors","subscribers_url":"https://api.github.com/repos/pawelmhm/scrapy/subscribers","subscription_url":"https://api.github.com/repos/pawelmhm/scrapy/subscription","commits_url":"https://api.github.com/repos/pawelmhm/scrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/pawelmhm/scrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/pawelmhm/scrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/pawelmhm/scrapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/pawelmhm/scrapy/contents/{+path}","compare_url":"https://api.github.com/repos/pawelmhm/scrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pawelmhm/scrapy/merges","archive_url":"https://api.github.com/repos/pawelmhm/scrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pawelmhm/scrapy/downloads","issues_url":"https://api.github.com/repos/pawelmhm/scrapy/issues{/number}","pulls_url":"https://api.github.com/repos/pawelmhm/scrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/pawelmhm/scrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/pawelmhm/scrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pawelmhm/scrapy/labels{/name}","releases_url":"https://api.github.com/repos/pawelmhm/scrapy/releases{/id}","deployments_url":"https://api.github.com/repos/pawelmhm/scrapy/deployments","created_at":"2015-01-08T16:07:40Z","updated_at":"2016-05-08T18:26:40Z","pushed_at":"2016-06-17T11:29:17Z","git_url":"git://github.com/pawelmhm/scrapy.git","ssh_url":"git@github.com:pawelmhm/scrapy.git","clone_url":"https://github.com/pawelmhm/scrapy.git","svn_url":"https://github.com/pawelmhm/scrapy","homepage":"http://scrapy.org","size":14463,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"scrapy:master","ref":"master","sha":"0700e437f227a3b060980d99da1c039895482c1f","user":{"login":"scrapy","id":733635,"avatar_url":"https://avatars.githubusercontent.com/u/733635?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapy","html_url":"https://github.com/scrapy","followers_url":"https://api.github.com/users/scrapy/followers","following_url":"https://api.github.com/users/scrapy/following{/other_user}","gists_url":"https://api.github.com/users/scrapy/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapy/subscriptions","organizations_url":"https://api.github.com/users/scrapy/orgs","repos_url":"https://api.github.com/users/scrapy/repos","events_url":"https://api.github.com/users/scrapy/events{/privacy}","received_events_url":"https://api.github.com/users/scrapy/received_events","type":"Organization","site_admin":false},"repo":{"id":529502,"name":"scrapy","full_name":"scrapy/scrapy","owner":{"login":"scrapy","id":733635,"avatar_url":"https://avatars.githubusercontent.com/u/733635?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapy","html_url":"https://github.com/scrapy","followers_url":"https://api.github.com/users/scrapy/followers","following_url":"https://api.github.com/users/scrapy/following{/other_user}","gists_url":"https://api.github.com/users/scrapy/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapy/subscriptions","organizations_url":"https://api.github.com/users/scrapy/orgs","repos_url":"https://api.github.com/users/scrapy/repos","events_url":"https://api.github.com/users/scrapy/events{/privacy}","received_events_url":"https://api.github.com/users/scrapy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scrapy/scrapy","description":"Scrapy, a fast high-level web crawling & scraping framework for Python.","fork":false,"url":"https://api.github.com/repos/scrapy/scrapy","forks_url":"https://api.github.com/repos/scrapy/scrapy/forks","keys_url":"https://api.github.com/repos/scrapy/scrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrapy/scrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrapy/scrapy/teams","hooks_url":"https://api.github.com/repos/scrapy/scrapy/hooks","issue_events_url":"https://api.github.com/repos/scrapy/scrapy/issues/events{/number}","events_url":"https://api.github.com/repos/scrapy/scrapy/events","assignees_url":"https://api.github.com/repos/scrapy/scrapy/assignees{/user}","branches_url":"https://api.github.com/repos/scrapy/scrapy/branches{/branch}","tags_url":"https://api.github.com/repos/scrapy/scrapy/tags","blobs_url":"https://api.github.com/repos/scrapy/scrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrapy/scrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrapy/scrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrapy/scrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrapy/scrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/scrapy/scrapy/languages","stargazers_url":"https://api.github.com/repos/scrapy/scrapy/stargazers","contributors_url":"https://api.github.com/repos/scrapy/scrapy/contributors","subscribers_url":"https://api.github.com/repos/scrapy/scrapy/subscribers","subscription_url":"https://api.github.com/repos/scrapy/scrapy/subscription","commits_url":"https://api.github.com/repos/scrapy/scrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrapy/scrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrapy/scrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrapy/scrapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/scrapy/scrapy/contents/{+path}","compare_url":"https://api.github.com/repos/scrapy/scrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrapy/scrapy/merges","archive_url":"https://api.github.com/repos/scrapy/scrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrapy/scrapy/downloads","issues_url":"https://api.github.com/repos/scrapy/scrapy/issues{/number}","pulls_url":"https://api.github.com/repos/scrapy/scrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/scrapy/scrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/scrapy/scrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrapy/scrapy/labels{/name}","releases_url":"https://api.github.com/repos/scrapy/scrapy/releases{/id}","deployments_url":"https://api.github.com/repos/scrapy/scrapy/deployments","created_at":"2010-02-22T02:01:14Z","updated_at":"2016-06-19T23:54:28Z","pushed_at":"2016-06-19T15:24:14Z","git_url":"git://github.com/scrapy/scrapy.git","ssh_url":"git@github.com:scrapy/scrapy.git","clone_url":"https://github.com/scrapy/scrapy.git","svn_url":"https://github.com/scrapy/scrapy","homepage":"http://scrapy.org","size":32475,"stargazers_count":14601,"watchers_count":14601,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":4104,"mirror_url":null,"open_issues_count":415,"forks":4104,"open_issues":415,"watchers":14601,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1989"},"html":{"href":"https://github.com/scrapy/scrapy/pull/1989"},"issue":{"href":"https://api.github.com/repos/scrapy/scrapy/issues/1989"},"comments":{"href":"https://api.github.com/repos/scrapy/scrapy/issues/1989/comments"},"review_comments":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1989/comments"},"review_comment":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1989/commits"},"statuses":{"href":"https://api.github.com/repos/scrapy/scrapy/statuses/10b79c9b3ec438653b25d531c30888849e080aa5"}}}}
{"actor":{"display_login":"djunzu"}}