{"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/58559902","id":58559902,"diff_hunk":"@@ -30,11 +30,17 @@\n \n \n class Formatter(object):\n+\n+    def format_piece(self, piece):\n+        if type(self.data) is datetime.date and hasattr(TimeFormat, piece):\n+            raise TypeError('The format for date objects may not contain time-related format specifiers')\n+        return piece\n+\n     def format(self, formatstr):\n         pieces = []\n         for i, piece in enumerate(re_formatchars.split(force_text(formatstr))):\n             if i % 2:\n-                pieces.append(force_text(getattr(self, piece)()))\n+                pieces.append(force_text(getattr(self, self.format_piece(piece))()))\n             elif piece:\n                 pieces.append(re_escaped.sub(r'\\1', piece))","path":"django/utils/dateformat.py","position":17,"original_position":17,"commit_id":"9a8184ed9966307bb6682ffa77ec9344ad19be2c","original_commit_id":"9a8184ed9966307bb6682ffa77ec9344ad19be2c","user":{"login":"timgraham","id":411869,"avatar_url":"https://avatars.githubusercontent.com/u/411869?v=3","gravatar_id":"","url":"https://api.github.com/users/timgraham","html_url":"https://github.com/timgraham","followers_url":"https://api.github.com/users/timgraham/followers","following_url":"https://api.github.com/users/timgraham/following{/other_user}","gists_url":"https://api.github.com/users/timgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/timgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timgraham/subscriptions","organizations_url":"https://api.github.com/users/timgraham/orgs","repos_url":"https://api.github.com/users/timgraham/repos","events_url":"https://api.github.com/users/timgraham/events{/privacy}","received_events_url":"https://api.github.com/users/timgraham/received_events","type":"User","site_admin":false},"body":"Do we need to check the `piece` in this branch too? If so, check it before the `if ` statement.","created_at":"2016-04-05T15:30:44Z","updated_at":"2016-04-05T15:30:44Z","html_url":"https://github.com/django/django/pull/6407#discussion_r58559902","pull_request_url":"https://api.github.com/repos/django/django/pulls/6407","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/58559902"},"html":{"href":"https://github.com/django/django/pull/6407#discussion_r58559902"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/6407"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/6407","id":65075044,"html_url":"https://github.com/django/django/pull/6407","diff_url":"https://github.com/django/django/pull/6407.diff","patch_url":"https://github.com/django/django/pull/6407.patch","issue_url":"https://api.github.com/repos/django/django/issues/6407","number":6407,"state":"open","locked":false,"title":"Fixed #26281 - Improved error handling and message on datetime format","user":{"login":"benxy","id":4881566,"avatar_url":"https://avatars.githubusercontent.com/u/4881566?v=3","gravatar_id":"","url":"https://api.github.com/users/benxy","html_url":"https://github.com/benxy","followers_url":"https://api.github.com/users/benxy/followers","following_url":"https://api.github.com/users/benxy/following{/other_user}","gists_url":"https://api.github.com/users/benxy/gists{/gist_id}","starred_url":"https://api.github.com/users/benxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benxy/subscriptions","organizations_url":"https://api.github.com/users/benxy/orgs","repos_url":"https://api.github.com/users/benxy/repos","events_url":"https://api.github.com/users/benxy/events{/privacy}","received_events_url":"https://api.github.com/users/benxy/received_events","type":"User","site_admin":false},"body":"Added function for checking if time format specifiers are used with date object. If so function returns TypeError with a better error message. ","created_at":"2016-04-03T17:49:01Z","updated_at":"2016-04-05T15:30:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c7eec8501aecc0cb4afc5a27c40b0c75552a96e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/6407/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/6407/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments{/number}","comments_url":"https://api.github.com/repos/django/django/issues/6407/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/9a8184ed9966307bb6682ffa77ec9344ad19be2c","head":{"label":"benxy:ticket_26281","ref":"ticket_26281","sha":"9a8184ed9966307bb6682ffa77ec9344ad19be2c","user":{"login":"benxy","id":4881566,"avatar_url":"https://avatars.githubusercontent.com/u/4881566?v=3","gravatar_id":"","url":"https://api.github.com/users/benxy","html_url":"https://github.com/benxy","followers_url":"https://api.github.com/users/benxy/followers","following_url":"https://api.github.com/users/benxy/following{/other_user}","gists_url":"https://api.github.com/users/benxy/gists{/gist_id}","starred_url":"https://api.github.com/users/benxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benxy/subscriptions","organizations_url":"https://api.github.com/users/benxy/orgs","repos_url":"https://api.github.com/users/benxy/repos","events_url":"https://api.github.com/users/benxy/events{/privacy}","received_events_url":"https://api.github.com/users/benxy/received_events","type":"User","site_admin":false},"repo":{"id":55310452,"name":"django","full_name":"benxy/django","owner":{"login":"benxy","id":4881566,"avatar_url":"https://avatars.githubusercontent.com/u/4881566?v=3","gravatar_id":"","url":"https://api.github.com/users/benxy","html_url":"https://github.com/benxy","followers_url":"https://api.github.com/users/benxy/followers","following_url":"https://api.github.com/users/benxy/following{/other_user}","gists_url":"https://api.github.com/users/benxy/gists{/gist_id}","starred_url":"https://api.github.com/users/benxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benxy/subscriptions","organizations_url":"https://api.github.com/users/benxy/orgs","repos_url":"https://api.github.com/users/benxy/repos","events_url":"https://api.github.com/users/benxy/events{/privacy}","received_events_url":"https://api.github.com/users/benxy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benxy/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/benxy/django","forks_url":"https://api.github.com/repos/benxy/django/forks","keys_url":"https://api.github.com/repos/benxy/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benxy/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benxy/django/teams","hooks_url":"https://api.github.com/repos/benxy/django/hooks","issue_events_url":"https://api.github.com/repos/benxy/django/issues/events{/number}","events_url":"https://api.github.com/repos/benxy/django/events","assignees_url":"https://api.github.com/repos/benxy/django/assignees{/user}","branches_url":"https://api.github.com/repos/benxy/django/branches{/branch}","tags_url":"https://api.github.com/repos/benxy/django/tags","blobs_url":"https://api.github.com/repos/benxy/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benxy/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benxy/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/benxy/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benxy/django/statuses/{sha}","languages_url":"https://api.github.com/repos/benxy/django/languages","stargazers_url":"https://api.github.com/repos/benxy/django/stargazers","contributors_url":"https://api.github.com/repos/benxy/django/contributors","subscribers_url":"https://api.github.com/repos/benxy/django/subscribers","subscription_url":"https://api.github.com/repos/benxy/django/subscription","commits_url":"https://api.github.com/repos/benxy/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/benxy/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/benxy/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/benxy/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/benxy/django/contents/{+path}","compare_url":"https://api.github.com/repos/benxy/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benxy/django/merges","archive_url":"https://api.github.com/repos/benxy/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benxy/django/downloads","issues_url":"https://api.github.com/repos/benxy/django/issues{/number}","pulls_url":"https://api.github.com/repos/benxy/django/pulls{/number}","milestones_url":"https://api.github.com/repos/benxy/django/milestones{/number}","notifications_url":"https://api.github.com/repos/benxy/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benxy/django/labels{/name}","releases_url":"https://api.github.com/repos/benxy/django/releases{/id}","deployments_url":"https://api.github.com/repos/benxy/django/deployments","created_at":"2016-04-02T18:40:08Z","updated_at":"2016-04-02T18:40:25Z","pushed_at":"2016-04-03T18:02:28Z","git_url":"git://github.com/benxy/django.git","ssh_url":"git@github.com:benxy/django.git","clone_url":"https://github.com/benxy/django.git","svn_url":"https://github.com/benxy/django","homepage":"https://www.djangoproject.com/","size":148199,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"django:master","ref":"master","sha":"fdf5cd3429369954e8deb764d9f30f6374581613","user":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"repo":{"id":4164482,"name":"django","full_name":"django/django","owner":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django/django","description":"The Web framework for perfectionists with deadlines.","fork":false,"url":"https://api.github.com/repos/django/django","forks_url":"https://api.github.com/repos/django/django/forks","keys_url":"https://api.github.com/repos/django/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django/django/teams","hooks_url":"https://api.github.com/repos/django/django/hooks","issue_events_url":"https://api.github.com/repos/django/django/issues/events{/number}","events_url":"https://api.github.com/repos/django/django/events","assignees_url":"https://api.github.com/repos/django/django/assignees{/user}","branches_url":"https://api.github.com/repos/django/django/branches{/branch}","tags_url":"https://api.github.com/repos/django/django/tags","blobs_url":"https://api.github.com/repos/django/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/django/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django/django/statuses/{sha}","languages_url":"https://api.github.com/repos/django/django/languages","stargazers_url":"https://api.github.com/repos/django/django/stargazers","contributors_url":"https://api.github.com/repos/django/django/contributors","subscribers_url":"https://api.github.com/repos/django/django/subscribers","subscription_url":"https://api.github.com/repos/django/django/subscription","commits_url":"https://api.github.com/repos/django/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/django/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/django/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/django/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/django/django/contents/{+path}","compare_url":"https://api.github.com/repos/django/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django/django/merges","archive_url":"https://api.github.com/repos/django/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django/django/downloads","issues_url":"https://api.github.com/repos/django/django/issues{/number}","pulls_url":"https://api.github.com/repos/django/django/pulls{/number}","milestones_url":"https://api.github.com/repos/django/django/milestones{/number}","notifications_url":"https://api.github.com/repos/django/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django/django/labels{/name}","releases_url":"https://api.github.com/repos/django/django/releases{/id}","deployments_url":"https://api.github.com/repos/django/django/deployments","created_at":"2012-04-28T02:47:18Z","updated_at":"2016-04-05T14:54:15Z","pushed_at":"2016-04-05T15:16:32Z","git_url":"git://github.com/django/django.git","ssh_url":"git@github.com:django/django.git","clone_url":"https://github.com/django/django.git","svn_url":"https://github.com/django/django","homepage":"https://www.djangoproject.com/","size":185719,"stargazers_count":18805,"watchers_count":18805,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7621,"mirror_url":null,"open_issues_count":88,"forks":7621,"open_issues":88,"watchers":18805,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/6407"},"html":{"href":"https://github.com/django/django/pull/6407"},"issue":{"href":"https://api.github.com/repos/django/django/issues/6407"},"comments":{"href":"https://api.github.com/repos/django/django/issues/6407/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/6407/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/6407/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/9a8184ed9966307bb6682ffa77ec9344ad19be2c"}}}}