{"action":"created","comment":{"url":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/comments/33520966","id":33520966,"diff_hunk":"@@ -0,0 +1,212 @@\n+# -*- coding: utf-8 -*-\n+from __future__ import unicode_literals\n+import os\n+import datetime\n+from pyramid.config import Configurator\n+from pyramid.view import view_config\n+from waitress import serve\n+\n+import sqlalchemy as sa\n+from sqlalchemy.ext.declarative import declarative_base\n+from sqlalchemy.orm import scoped_session, sessionmaker\n+from zope.sqlalchemy import ZopeTransactionExtension\n+\n+from pyramid.httpexceptions import HTTPFound\n+from sqlalchemy.exc import DBAPIError\n+\n+from pyramid.authentication import AuthTktAuthenticationPolicy\n+from pyramid.authorization import ACLAuthorizationPolicy\n+from cryptacular.bcrypt import BCRYPTPasswordManager\n+from pyramid.security import remember, forget\n+\n+Base = declarative_base()\n+DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))\n+DATABASE_URL = os.environ.get(\n+    'DATABASE_URL',\n+    'postgresql://jimgrant@localhost:5432/learning-journal'\n+)\n+HERE = os.path.dirname(os.path.abspath(__file__))\n+\n+\n+class Entry(Base):\n+    __tablename__ = 'entries'\n+\n+    id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)\n+    title = sa.Column(sa.Unicode(127), nullable=False)\n+    text = sa.Column(sa.UnicodeText, nullable=False)\n+    created = sa.Column(\n+        sa.DateTime, nullable=False, default=datetime.datetime.utcnow\n+    )\n+\n+    def __repr__(self):\n+        return self.title\n+\n+    @classmethod\n+    def all(cls, session=None):\n+        if session is None:\n+            session = DBSession\n+        return session.query(cls).order_by(cls.created.desc()).all()\n+\n+    @classmethod\n+    def write(cls, title=None, text=None, session=None):\n+        if session is None:\n+            session = DBSession\n+        instance = cls(title=title, text=text)\n+        session.add(instance)\n+        return instance\n+\n+    @classmethod\n+    def one(cls, eid=None, session=None):\n+        if session is None:\n+            session = DBSession\n+        return session.query(cls).filter(cls.id == eid).one()","path":"journal.py","position":62,"original_position":62,"commit_id":"2af59b8c9472e084fbb0609dc33b13e14498d6e5","original_commit_id":"2af59b8c9472e084fbb0609dc33b13e14498d6e5","user":{"login":"cewing","id":417109,"avatar_url":"https://avatars.githubusercontent.com/u/417109?v=3","gravatar_id":"","url":"https://api.github.com/users/cewing","html_url":"https://github.com/cewing","followers_url":"https://api.github.com/users/cewing/followers","following_url":"https://api.github.com/users/cewing/following{/other_user}","gists_url":"https://api.github.com/users/cewing/gists{/gist_id}","starred_url":"https://api.github.com/users/cewing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cewing/subscriptions","organizations_url":"https://api.github.com/users/cewing/orgs","repos_url":"https://api.github.com/users/cewing/repos","events_url":"https://api.github.com/users/cewing/events{/privacy}","received_events_url":"https://api.github.com/users/cewing/received_events","type":"User","site_admin":false},"body":"nice.  This will come in handy this week!","created_at":"2015-06-29T22:20:59Z","updated_at":"2015-06-29T22:20:59Z","html_url":"https://github.com/MigrantJ/learning-journal/pull/5#discussion_r33520966","pull_request_url":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/comments/33520966"},"html":{"href":"https://github.com/MigrantJ/learning-journal/pull/5#discussion_r33520966"},"pull_request":{"href":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/5","id":38695889,"html_url":"https://github.com/MigrantJ/learning-journal/pull/5","diff_url":"https://github.com/MigrantJ/learning-journal/pull/5.diff","patch_url":"https://github.com/MigrantJ/learning-journal/pull/5.patch","issue_url":"https://api.github.com/repos/MigrantJ/learning-journal/issues/5","number":5,"state":"open","locked":false,"title":"Start","user":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-26T22:41:37Z","updated_at":"2015-06-29T22:20:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28ff2a98aeb3340ac8bfef9ec99f01a21276c5a9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/5/commits","review_comments_url":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/5/comments","review_comment_url":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MigrantJ/learning-journal/issues/5/comments","statuses_url":"https://api.github.com/repos/MigrantJ/learning-journal/statuses/2af59b8c9472e084fbb0609dc33b13e14498d6e5","head":{"label":"MigrantJ:master","ref":"master","sha":"2af59b8c9472e084fbb0609dc33b13e14498d6e5","user":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"repo":{"id":37334280,"name":"learning-journal","full_name":"MigrantJ/learning-journal","owner":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MigrantJ/learning-journal","description":"A journal for the Code Fellows Python Development Accelerator","fork":false,"url":"https://api.github.com/repos/MigrantJ/learning-journal","forks_url":"https://api.github.com/repos/MigrantJ/learning-journal/forks","keys_url":"https://api.github.com/repos/MigrantJ/learning-journal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MigrantJ/learning-journal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MigrantJ/learning-journal/teams","hooks_url":"https://api.github.com/repos/MigrantJ/learning-journal/hooks","issue_events_url":"https://api.github.com/repos/MigrantJ/learning-journal/issues/events{/number}","events_url":"https://api.github.com/repos/MigrantJ/learning-journal/events","assignees_url":"https://api.github.com/repos/MigrantJ/learning-journal/assignees{/user}","branches_url":"https://api.github.com/repos/MigrantJ/learning-journal/branches{/branch}","tags_url":"https://api.github.com/repos/MigrantJ/learning-journal/tags","blobs_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/refs{/sha}","trees_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MigrantJ/learning-journal/statuses/{sha}","languages_url":"https://api.github.com/repos/MigrantJ/learning-journal/languages","stargazers_url":"https://api.github.com/repos/MigrantJ/learning-journal/stargazers","contributors_url":"https://api.github.com/repos/MigrantJ/learning-journal/contributors","subscribers_url":"https://api.github.com/repos/MigrantJ/learning-journal/subscribers","subscription_url":"https://api.github.com/repos/MigrantJ/learning-journal/subscription","commits_url":"https://api.github.com/repos/MigrantJ/learning-journal/commits{/sha}","git_commits_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/commits{/sha}","comments_url":"https://api.github.com/repos/MigrantJ/learning-journal/comments{/number}","issue_comment_url":"https://api.github.com/repos/MigrantJ/learning-journal/issues/comments{/number}","contents_url":"https://api.github.com/repos/MigrantJ/learning-journal/contents/{+path}","compare_url":"https://api.github.com/repos/MigrantJ/learning-journal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MigrantJ/learning-journal/merges","archive_url":"https://api.github.com/repos/MigrantJ/learning-journal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MigrantJ/learning-journal/downloads","issues_url":"https://api.github.com/repos/MigrantJ/learning-journal/issues{/number}","pulls_url":"https://api.github.com/repos/MigrantJ/learning-journal/pulls{/number}","milestones_url":"https://api.github.com/repos/MigrantJ/learning-journal/milestones{/number}","notifications_url":"https://api.github.com/repos/MigrantJ/learning-journal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MigrantJ/learning-journal/labels{/name}","releases_url":"https://api.github.com/repos/MigrantJ/learning-journal/releases{/id}","created_at":"2015-06-12T17:07:42Z","updated_at":"2015-06-12T20:05:20Z","pushed_at":"2015-06-26T22:41:38Z","git_url":"git://github.com/MigrantJ/learning-journal.git","ssh_url":"git@github.com:MigrantJ/learning-journal.git","clone_url":"https://github.com/MigrantJ/learning-journal.git","svn_url":"https://github.com/MigrantJ/learning-journal","homepage":null,"size":228,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"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":"MigrantJ:start","ref":"start","sha":"3c3d7be340c1d45871202da84d742f89ccd4eb17","user":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"repo":{"id":37334280,"name":"learning-journal","full_name":"MigrantJ/learning-journal","owner":{"login":"MigrantJ","id":7929451,"avatar_url":"https://avatars.githubusercontent.com/u/7929451?v=3","gravatar_id":"","url":"https://api.github.com/users/MigrantJ","html_url":"https://github.com/MigrantJ","followers_url":"https://api.github.com/users/MigrantJ/followers","following_url":"https://api.github.com/users/MigrantJ/following{/other_user}","gists_url":"https://api.github.com/users/MigrantJ/gists{/gist_id}","starred_url":"https://api.github.com/users/MigrantJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MigrantJ/subscriptions","organizations_url":"https://api.github.com/users/MigrantJ/orgs","repos_url":"https://api.github.com/users/MigrantJ/repos","events_url":"https://api.github.com/users/MigrantJ/events{/privacy}","received_events_url":"https://api.github.com/users/MigrantJ/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MigrantJ/learning-journal","description":"A journal for the Code Fellows Python Development Accelerator","fork":false,"url":"https://api.github.com/repos/MigrantJ/learning-journal","forks_url":"https://api.github.com/repos/MigrantJ/learning-journal/forks","keys_url":"https://api.github.com/repos/MigrantJ/learning-journal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MigrantJ/learning-journal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MigrantJ/learning-journal/teams","hooks_url":"https://api.github.com/repos/MigrantJ/learning-journal/hooks","issue_events_url":"https://api.github.com/repos/MigrantJ/learning-journal/issues/events{/number}","events_url":"https://api.github.com/repos/MigrantJ/learning-journal/events","assignees_url":"https://api.github.com/repos/MigrantJ/learning-journal/assignees{/user}","branches_url":"https://api.github.com/repos/MigrantJ/learning-journal/branches{/branch}","tags_url":"https://api.github.com/repos/MigrantJ/learning-journal/tags","blobs_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/refs{/sha}","trees_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MigrantJ/learning-journal/statuses/{sha}","languages_url":"https://api.github.com/repos/MigrantJ/learning-journal/languages","stargazers_url":"https://api.github.com/repos/MigrantJ/learning-journal/stargazers","contributors_url":"https://api.github.com/repos/MigrantJ/learning-journal/contributors","subscribers_url":"https://api.github.com/repos/MigrantJ/learning-journal/subscribers","subscription_url":"https://api.github.com/repos/MigrantJ/learning-journal/subscription","commits_url":"https://api.github.com/repos/MigrantJ/learning-journal/commits{/sha}","git_commits_url":"https://api.github.com/repos/MigrantJ/learning-journal/git/commits{/sha}","comments_url":"https://api.github.com/repos/MigrantJ/learning-journal/comments{/number}","issue_comment_url":"https://api.github.com/repos/MigrantJ/learning-journal/issues/comments{/number}","contents_url":"https://api.github.com/repos/MigrantJ/learning-journal/contents/{+path}","compare_url":"https://api.github.com/repos/MigrantJ/learning-journal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MigrantJ/learning-journal/merges","archive_url":"https://api.github.com/repos/MigrantJ/learning-journal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MigrantJ/learning-journal/downloads","issues_url":"https://api.github.com/repos/MigrantJ/learning-journal/issues{/number}","pulls_url":"https://api.github.com/repos/MigrantJ/learning-journal/pulls{/number}","milestones_url":"https://api.github.com/repos/MigrantJ/learning-journal/milestones{/number}","notifications_url":"https://api.github.com/repos/MigrantJ/learning-journal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MigrantJ/learning-journal/labels{/name}","releases_url":"https://api.github.com/repos/MigrantJ/learning-journal/releases{/id}","created_at":"2015-06-12T17:07:42Z","updated_at":"2015-06-12T20:05:20Z","pushed_at":"2015-06-26T22:41:38Z","git_url":"git://github.com/MigrantJ/learning-journal.git","ssh_url":"git@github.com:MigrantJ/learning-journal.git","clone_url":"https://github.com/MigrantJ/learning-journal.git","svn_url":"https://github.com/MigrantJ/learning-journal","homepage":null,"size":228,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/5"},"html":{"href":"https://github.com/MigrantJ/learning-journal/pull/5"},"issue":{"href":"https://api.github.com/repos/MigrantJ/learning-journal/issues/5"},"comments":{"href":"https://api.github.com/repos/MigrantJ/learning-journal/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MigrantJ/learning-journal/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/MigrantJ/learning-journal/statuses/2af59b8c9472e084fbb0609dc33b13e14498d6e5"}}}}