{"action":"created","comment":{"url":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/comments/33298763","id":33298763,"diff_hunk":"@@ -8,7 +8,54 @@\n from .models import Event\n \n \n-class MajorEventLogFeed(Atom1Feed):\n+class PaginatedFeedTypeMixin(object):\n+\n+    def _create_link_attr(self, rel, page):\n+        href = u'{0}?{1}={2}'.format(\n+            self.feed['link'], self.feed['page_query'], page)\n+\n+        return {u'rel': rel, u'href': href}\n+\n+    def add_root_elements(self, handler):\n+        from django.utils.feedgenerator import rfc3339_date\n+        handler.addQuickElement(\"title\", self.feed['title'])\n+        handler.addQuickElement(\n+            \"link\", \"\", {\"rel\": \"alternate\", \"href\": self.feed['link']})\n+\n+        if self.feed['feed_url'] is not None:\n+            handler.addQuickElement(\"link\", \"\", {\"rel\": \"self\", \"href\": self.feed['feed_url']})\n+\n+        handler.addQuickElement(u'link', '', self._create_link_attr(u'first', 1))\n+        handler.addQuickElement(u'link', '', self._create_link_attr(u'last', self.feed['last_page']))\n+\n+        if self.feed.get('prev_page', None) is not None:\n+            handler.addQuickElement(u'link', '', self._create_link_attr(u'prev_page', self.feed['prev_page']))\n+        if self.feed.get('next_page', None) is not None:\n+            handler.addQuickElement(u'link', '', self._create_link_attr(u'next_page', self.feed['next_page']))\n+\n+        handler.addQuickElement(\"id\", self.feed['id'])\n+        handler.addQuickElement(\"updated\", rfc3339_date(self.latest_post_date()))\n+\n+        if self.feed['author_name'] is not None:\n+            handler.startElement(\"author\", {})\n+            handler.addQuickElement(\"name\", self.feed['author_name'])\n+            if self.feed['author_email'] is not None:\n+                handler.addQuickElement(\"email\", self.feed['author_email'])\n+            if self.feed['author_link'] is not None:\n+                handler.addQuickElement(\"uri\", self.feed['author_link'])\n+            handler.endElement(\"author\")\n+\n+        if self.feed['subtitle'] is not None:\n+            handler.addQuickElement(\"subtitle\", self.feed['subtitle'])\n+\n+        for cat in self.feed['categories']:\n+            handler.addQuickElement(\"category\", \"\", {\"term\": cat})","path":"major_event_log/feeds.py","position":46,"original_position":46,"commit_id":"4ae0aaf7e4dd0e20449da1f96167c7e9919a5cb1","original_commit_id":"4ae0aaf7e4dd0e20449da1f96167c7e9919a5cb1","user":{"login":"damonkelley","id":4121849,"avatar_url":"https://avatars.githubusercontent.com/u/4121849?v=3","gravatar_id":"","url":"https://api.github.com/users/damonkelley","html_url":"https://github.com/damonkelley","followers_url":"https://api.github.com/users/damonkelley/followers","following_url":"https://api.github.com/users/damonkelley/following{/other_user}","gists_url":"https://api.github.com/users/damonkelley/gists{/gist_id}","starred_url":"https://api.github.com/users/damonkelley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damonkelley/subscriptions","organizations_url":"https://api.github.com/users/damonkelley/orgs","repos_url":"https://api.github.com/users/damonkelley/repos","events_url":"https://api.github.com/users/damonkelley/events{/privacy}","received_events_url":"https://api.github.com/users/damonkelley/received_events","type":"User","site_admin":false},"body":"Checkout the updated description on the PR.","created_at":"2015-06-25T20:07:57Z","updated_at":"2015-06-25T20:07:57Z","html_url":"https://github.com/unt-libraries/django-major-event-log/pull/39#discussion_r33298763","pull_request_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/comments/33298763"},"html":{"href":"https://github.com/unt-libraries/django-major-event-log/pull/39#discussion_r33298763"},"pull_request":{"href":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/39","id":38586139,"html_url":"https://github.com/unt-libraries/django-major-event-log/pull/39","diff_url":"https://github.com/unt-libraries/django-major-event-log/pull/39.diff","patch_url":"https://github.com/unt-libraries/django-major-event-log/pull/39.patch","issue_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues/39","number":39,"state":"open","locked":false,"title":"Mixins to enable paginated feeds.","user":{"login":"damonkelley","id":4121849,"avatar_url":"https://avatars.githubusercontent.com/u/4121849?v=3","gravatar_id":"","url":"https://api.github.com/users/damonkelley","html_url":"https://github.com/damonkelley","followers_url":"https://api.github.com/users/damonkelley/followers","following_url":"https://api.github.com/users/damonkelley/following{/other_user}","gists_url":"https://api.github.com/users/damonkelley/gists{/gist_id}","starred_url":"https://api.github.com/users/damonkelley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damonkelley/subscriptions","organizations_url":"https://api.github.com/users/damonkelley/orgs","repos_url":"https://api.github.com/users/damonkelley/repos","events_url":"https://api.github.com/users/damonkelley/events{/privacy}","received_events_url":"https://api.github.com/users/damonkelley/received_events","type":"User","site_admin":false},"body":"FYI: This will fail the flake8 check.\r\n\r\nSo here is what is going on with this.\r\n\r\nI have created 2 mixins (`PaginatedFeedMixin`, and `PaginatedFeedTypeMixin`).\r\n\r\n`PaginatedFeedMixin` sets of the Feed object with some class variables and adds some helper functions to setup of the paginator, and to send additional kwargs to the FeedType object.\r\n\r\n`PaginatedFeedMixin` adds a `_create_link_attr()` and overrides `add_root_elements()`.\r\n`add_root_elements()` is taken directly from [here](https://github.com/django/django/blob/bc77eb6d0858652e197c08c299efaeb06c51efee/django/utils/feedgenerator.py#L349-L369), but the paginated links are added in between the `feed_url` element and the `author_name`.\r\n\r\nI am still very unfamiliar with the Sax utilities that Django uses to write the XML. I was looking for a way to call `super` on `add_root_elements`, and then jump back to specific point in the document to write the additional link elements. Since Sax does **not** use a DOM, I am not sure if that approach is possible.","created_at":"2015-06-25T19:52:19Z","updated_at":"2015-06-25T20:07:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"481e246cacb7c3df1afab9689e5ee76eb62fe274","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/39/commits","review_comments_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/39/comments","review_comment_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues/39/comments","statuses_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/statuses/4ae0aaf7e4dd0e20449da1f96167c7e9919a5cb1","head":{"label":"unt-libraries:paginated-feeds","ref":"paginated-feeds","sha":"4ae0aaf7e4dd0e20449da1f96167c7e9919a5cb1","user":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"repo":{"id":36522749,"name":"django-major-event-log","full_name":"unt-libraries/django-major-event-log","owner":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unt-libraries/django-major-event-log","description":"","fork":false,"url":"https://api.github.com/repos/unt-libraries/django-major-event-log","forks_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/forks","keys_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/teams","hooks_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/hooks","issue_events_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues/events{/number}","events_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/events","assignees_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/assignees{/user}","branches_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/branches{/branch}","tags_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/tags","blobs_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/refs{/sha}","trees_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/statuses/{sha}","languages_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/languages","stargazers_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/stargazers","contributors_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/contributors","subscribers_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/subscribers","subscription_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/subscription","commits_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/commits{/sha}","git_commits_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/commits{/sha}","comments_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/comments{/number}","issue_comment_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues/comments{/number}","contents_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/contents/{+path}","compare_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/merges","archive_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/downloads","issues_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues{/number}","pulls_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls{/number}","milestones_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/milestones{/number}","notifications_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/labels{/name}","releases_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/releases{/id}","created_at":"2015-05-29T18:44:24Z","updated_at":"2015-05-29T19:07:30Z","pushed_at":"2015-06-25T19:52:19Z","git_url":"git://github.com/unt-libraries/django-major-event-log.git","ssh_url":"git@github.com:unt-libraries/django-major-event-log.git","clone_url":"https://github.com/unt-libraries/django-major-event-log.git","svn_url":"https://github.com/unt-libraries/django-major-event-log","homepage":null,"size":968,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"base":{"label":"unt-libraries:fix-xml","ref":"fix-xml","sha":"796443ffb2c02c0eb463514f3eea7f8729318c18","user":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"repo":{"id":36522749,"name":"django-major-event-log","full_name":"unt-libraries/django-major-event-log","owner":{"login":"unt-libraries","id":6526233,"avatar_url":"https://avatars.githubusercontent.com/u/6526233?v=3","gravatar_id":"","url":"https://api.github.com/users/unt-libraries","html_url":"https://github.com/unt-libraries","followers_url":"https://api.github.com/users/unt-libraries/followers","following_url":"https://api.github.com/users/unt-libraries/following{/other_user}","gists_url":"https://api.github.com/users/unt-libraries/gists{/gist_id}","starred_url":"https://api.github.com/users/unt-libraries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unt-libraries/subscriptions","organizations_url":"https://api.github.com/users/unt-libraries/orgs","repos_url":"https://api.github.com/users/unt-libraries/repos","events_url":"https://api.github.com/users/unt-libraries/events{/privacy}","received_events_url":"https://api.github.com/users/unt-libraries/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unt-libraries/django-major-event-log","description":"","fork":false,"url":"https://api.github.com/repos/unt-libraries/django-major-event-log","forks_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/forks","keys_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/teams","hooks_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/hooks","issue_events_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues/events{/number}","events_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/events","assignees_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/assignees{/user}","branches_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/branches{/branch}","tags_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/tags","blobs_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/refs{/sha}","trees_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/statuses/{sha}","languages_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/languages","stargazers_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/stargazers","contributors_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/contributors","subscribers_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/subscribers","subscription_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/subscription","commits_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/commits{/sha}","git_commits_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/git/commits{/sha}","comments_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/comments{/number}","issue_comment_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues/comments{/number}","contents_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/contents/{+path}","compare_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/merges","archive_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/downloads","issues_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues{/number}","pulls_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls{/number}","milestones_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/milestones{/number}","notifications_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/labels{/name}","releases_url":"https://api.github.com/repos/unt-libraries/django-major-event-log/releases{/id}","created_at":"2015-05-29T18:44:24Z","updated_at":"2015-05-29T19:07:30Z","pushed_at":"2015-06-25T19:52:19Z","git_url":"git://github.com/unt-libraries/django-major-event-log.git","ssh_url":"git@github.com:unt-libraries/django-major-event-log.git","clone_url":"https://github.com/unt-libraries/django-major-event-log.git","svn_url":"https://github.com/unt-libraries/django-major-event-log","homepage":null,"size":968,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/39"},"html":{"href":"https://github.com/unt-libraries/django-major-event-log/pull/39"},"issue":{"href":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues/39"},"comments":{"href":"https://api.github.com/repos/unt-libraries/django-major-event-log/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unt-libraries/django-major-event-log/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/unt-libraries/django-major-event-log/statuses/4ae0aaf7e4dd0e20449da1f96167c7e9919a5cb1"}}}}