{"action":"closed","number":202,"pull_request":{"url":"https://api.github.com/repos/jupyter/nbgrader/pulls/202","id":32652598,"html_url":"https://github.com/jupyter/nbgrader/pull/202","diff_url":"https://github.com/jupyter/nbgrader/pull/202.diff","patch_url":"https://github.com/jupyter/nbgrader/pull/202.patch","issue_url":"https://api.github.com/repos/jupyter/nbgrader/issues/202","number":202,"state":"closed","locked":false,"title":"Save timestamps into database as UTC","user":{"login":"jhamrick","id":83444,"avatar_url":"https://avatars.githubusercontent.com/u/83444?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamrick","html_url":"https://github.com/jhamrick","followers_url":"https://api.github.com/users/jhamrick/followers","following_url":"https://api.github.com/users/jhamrick/following{/other_user}","gists_url":"https://api.github.com/users/jhamrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamrick/subscriptions","organizations_url":"https://api.github.com/users/jhamrick/orgs","repos_url":"https://api.github.com/users/jhamrick/repos","events_url":"https://api.github.com/users/jhamrick/events{/privacy}","received_events_url":"https://api.github.com/users/jhamrick/received_events","type":"User","site_admin":false},"body":"Currently the database will automatically remove any timezone info from datetime objects, without properly converting those objects to UTC first. This adds functionality to make sure all timestamps are properly converted to UTC before being saved into the database. This also fixes a bug where when you try to update the timestamp, you get a `TypeError: can't compare offset-naive and offset-aware datetimes` error.\r\n\r\nThis won't get around the possibility that you could still do something like:\r\n\r\n```\r\nassignment = gb.find_assignment(\"Problem Set 1\")\r\nassignment.duedate = dateutil.parser.parse(\"2015-02-02 14:58:23.948203 PST\")\r\ngb.db.commit()\r\n```\r\n\r\nin which case the PST timezone would just be removed. The correct way to do it would be:\r\n\r\n```\r\ngb.update_or_create_assignment(\"Problem Set 1\", duedate=\"2015-02-02 14:58:23.948203 PST\")\r\n```\r\n\r\nUnfortunately, I don't think there's a good way to catch the first one.","created_at":"2015-04-05T18:49:45Z","updated_at":"2015-04-05T18:57:53Z","closed_at":"2015-04-05T18:57:53Z","merged_at":"2015-04-05T18:57:53Z","merge_commit_sha":"e30b3888b8bd2906b6df95d1bd94b38b5bfe65bd","assignee":null,"milestone":{"url":"https://api.github.com/repos/jupyter/nbgrader/milestones/1","html_url":"https://github.com/jupyter/nbgrader/milestones/1.0","labels_url":"https://api.github.com/repos/jupyter/nbgrader/milestones/1/labels","id":1047534,"number":1,"title":"1.0","description":"","creator":{"login":"jhamrick","id":83444,"avatar_url":"https://avatars.githubusercontent.com/u/83444?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamrick","html_url":"https://github.com/jhamrick","followers_url":"https://api.github.com/users/jhamrick/followers","following_url":"https://api.github.com/users/jhamrick/following{/other_user}","gists_url":"https://api.github.com/users/jhamrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamrick/subscriptions","organizations_url":"https://api.github.com/users/jhamrick/orgs","repos_url":"https://api.github.com/users/jhamrick/repos","events_url":"https://api.github.com/users/jhamrick/events{/privacy}","received_events_url":"https://api.github.com/users/jhamrick/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":141,"state":"open","created_at":"2015-03-31T18:36:20Z","updated_at":"2015-04-05T18:57:53Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/202/commits","review_comments_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/202/comments","review_comment_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter/nbgrader/issues/202/comments","statuses_url":"https://api.github.com/repos/jupyter/nbgrader/statuses/e282029d26dd1af2101e4df305431ff5660d7183","head":{"label":"jhamrick:utc-timestamps","ref":"utc-timestamps","sha":"e282029d26dd1af2101e4df305431ff5660d7183","user":{"login":"jhamrick","id":83444,"avatar_url":"https://avatars.githubusercontent.com/u/83444?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamrick","html_url":"https://github.com/jhamrick","followers_url":"https://api.github.com/users/jhamrick/followers","following_url":"https://api.github.com/users/jhamrick/following{/other_user}","gists_url":"https://api.github.com/users/jhamrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamrick/subscriptions","organizations_url":"https://api.github.com/users/jhamrick/orgs","repos_url":"https://api.github.com/users/jhamrick/repos","events_url":"https://api.github.com/users/jhamrick/events{/privacy}","received_events_url":"https://api.github.com/users/jhamrick/received_events","type":"User","site_admin":false},"repo":{"id":24038015,"name":"nbgrader","full_name":"jhamrick/nbgrader","owner":{"login":"jhamrick","id":83444,"avatar_url":"https://avatars.githubusercontent.com/u/83444?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamrick","html_url":"https://github.com/jhamrick","followers_url":"https://api.github.com/users/jhamrick/followers","following_url":"https://api.github.com/users/jhamrick/following{/other_user}","gists_url":"https://api.github.com/users/jhamrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamrick/subscriptions","organizations_url":"https://api.github.com/users/jhamrick/orgs","repos_url":"https://api.github.com/users/jhamrick/repos","events_url":"https://api.github.com/users/jhamrick/events{/privacy}","received_events_url":"https://api.github.com/users/jhamrick/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhamrick/nbgrader","description":"A system for assigning and grading notebooks","fork":true,"url":"https://api.github.com/repos/jhamrick/nbgrader","forks_url":"https://api.github.com/repos/jhamrick/nbgrader/forks","keys_url":"https://api.github.com/repos/jhamrick/nbgrader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhamrick/nbgrader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhamrick/nbgrader/teams","hooks_url":"https://api.github.com/repos/jhamrick/nbgrader/hooks","issue_events_url":"https://api.github.com/repos/jhamrick/nbgrader/issues/events{/number}","events_url":"https://api.github.com/repos/jhamrick/nbgrader/events","assignees_url":"https://api.github.com/repos/jhamrick/nbgrader/assignees{/user}","branches_url":"https://api.github.com/repos/jhamrick/nbgrader/branches{/branch}","tags_url":"https://api.github.com/repos/jhamrick/nbgrader/tags","blobs_url":"https://api.github.com/repos/jhamrick/nbgrader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhamrick/nbgrader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhamrick/nbgrader/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhamrick/nbgrader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhamrick/nbgrader/statuses/{sha}","languages_url":"https://api.github.com/repos/jhamrick/nbgrader/languages","stargazers_url":"https://api.github.com/repos/jhamrick/nbgrader/stargazers","contributors_url":"https://api.github.com/repos/jhamrick/nbgrader/contributors","subscribers_url":"https://api.github.com/repos/jhamrick/nbgrader/subscribers","subscription_url":"https://api.github.com/repos/jhamrick/nbgrader/subscription","commits_url":"https://api.github.com/repos/jhamrick/nbgrader/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhamrick/nbgrader/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhamrick/nbgrader/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhamrick/nbgrader/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhamrick/nbgrader/contents/{+path}","compare_url":"https://api.github.com/repos/jhamrick/nbgrader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhamrick/nbgrader/merges","archive_url":"https://api.github.com/repos/jhamrick/nbgrader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhamrick/nbgrader/downloads","issues_url":"https://api.github.com/repos/jhamrick/nbgrader/issues{/number}","pulls_url":"https://api.github.com/repos/jhamrick/nbgrader/pulls{/number}","milestones_url":"https://api.github.com/repos/jhamrick/nbgrader/milestones{/number}","notifications_url":"https://api.github.com/repos/jhamrick/nbgrader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhamrick/nbgrader/labels{/name}","releases_url":"https://api.github.com/repos/jhamrick/nbgrader/releases{/id}","created_at":"2014-09-15T01:11:20Z","updated_at":"2015-04-05T05:04:03Z","pushed_at":"2015-04-05T18:45:07Z","git_url":"git://github.com/jhamrick/nbgrader.git","ssh_url":"git@github.com:jhamrick/nbgrader.git","clone_url":"https://github.com/jhamrick/nbgrader.git","svn_url":"https://github.com/jhamrick/nbgrader","homepage":null,"size":2890,"stargazers_count":4,"watchers_count":4,"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":4,"default_branch":"master"}},"base":{"label":"jupyter:master","ref":"master","sha":"cc7ad02a1d94ee79b9713eb8e3c3787c49896452","user":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"repo":{"id":23984796,"name":"nbgrader","full_name":"jupyter/nbgrader","owner":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jupyter/nbgrader","description":"A system for assigning and grading notebooks","fork":false,"url":"https://api.github.com/repos/jupyter/nbgrader","forks_url":"https://api.github.com/repos/jupyter/nbgrader/forks","keys_url":"https://api.github.com/repos/jupyter/nbgrader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/nbgrader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/nbgrader/teams","hooks_url":"https://api.github.com/repos/jupyter/nbgrader/hooks","issue_events_url":"https://api.github.com/repos/jupyter/nbgrader/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/nbgrader/events","assignees_url":"https://api.github.com/repos/jupyter/nbgrader/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/nbgrader/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/nbgrader/tags","blobs_url":"https://api.github.com/repos/jupyter/nbgrader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/nbgrader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/nbgrader/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/nbgrader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/nbgrader/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/nbgrader/languages","stargazers_url":"https://api.github.com/repos/jupyter/nbgrader/stargazers","contributors_url":"https://api.github.com/repos/jupyter/nbgrader/contributors","subscribers_url":"https://api.github.com/repos/jupyter/nbgrader/subscribers","subscription_url":"https://api.github.com/repos/jupyter/nbgrader/subscription","commits_url":"https://api.github.com/repos/jupyter/nbgrader/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/nbgrader/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/nbgrader/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/nbgrader/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/nbgrader/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/nbgrader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/nbgrader/merges","archive_url":"https://api.github.com/repos/jupyter/nbgrader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/nbgrader/downloads","issues_url":"https://api.github.com/repos/jupyter/nbgrader/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/nbgrader/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/nbgrader/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/nbgrader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/nbgrader/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/nbgrader/releases{/id}","created_at":"2014-09-13T03:27:36Z","updated_at":"2015-04-05T01:08:07Z","pushed_at":"2015-04-05T18:57:53Z","git_url":"git://github.com/jupyter/nbgrader.git","ssh_url":"git@github.com:jupyter/nbgrader.git","clone_url":"https://github.com/jupyter/nbgrader.git","svn_url":"https://github.com/jupyter/nbgrader","homepage":null,"size":3726,"stargazers_count":36,"watchers_count":36,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":45,"forks":8,"open_issues":45,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/202"},"html":{"href":"https://github.com/jupyter/nbgrader/pull/202"},"issue":{"href":"https://api.github.com/repos/jupyter/nbgrader/issues/202"},"comments":{"href":"https://api.github.com/repos/jupyter/nbgrader/issues/202/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/202/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/202/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter/nbgrader/statuses/e282029d26dd1af2101e4df305431ff5660d7183"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"jhamrick","id":83444,"avatar_url":"https://avatars.githubusercontent.com/u/83444?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamrick","html_url":"https://github.com/jhamrick","followers_url":"https://api.github.com/users/jhamrick/followers","following_url":"https://api.github.com/users/jhamrick/following{/other_user}","gists_url":"https://api.github.com/users/jhamrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamrick/subscriptions","organizations_url":"https://api.github.com/users/jhamrick/orgs","repos_url":"https://api.github.com/users/jhamrick/repos","events_url":"https://api.github.com/users/jhamrick/events{/privacy}","received_events_url":"https://api.github.com/users/jhamrick/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":2,"additions":33,"deletions":15,"changed_files":5}}